Byteball.js
A pure and powerful JavaScript Byteball library.
Getting started
To install and run Byteball.js, follow this quick start guide
Install
Byteball.js was designed to work both in the browser and in Node.js.
Node.js
To install Byteball.js on Node.js, open your terminal and run:
npm i byteball --save
Browser
You can create an index.html file and include Byteball.js with:
Usage
Ways to initiate WebSocket client:
const byteball = ; // Connect to mainnet official node 'wss://byteball.org/bb'const client = ; // Connect to a custom nodeconst client = 'wss://byteball.org/bb'; // Connect to testnetconst options = testnet: true ;const client = 'wss://byteball.org/bb-test' options;
Close the client:
client;
All API methods follow this pattern:
// If the last argument is a function it is treated as a callbackclientapi; // If a callback is not provided, a Promise is returnedclientapi;
Transaction
To compose and post unit you need first to create a Byteball wallet and fund it with the native currency ‘bytes’. The generated WIF will be used on Byteball.js. Click on the link below to learn more:
Sending a payment:
const wif = '5JBFvTeSY5...'; // WIF string generated (private key) const params = outputs: address: 'NX2BTV43XN6BOTCYZUUFU6TK7DVOC4LU' // The Byteball address of the recipient amount: 1000 // The amount he receives ; clientpost;
License
MIT.