Binance Chain JavaScript API
yarn add @binance/bnc-web-lib -S --registry https://npm-registry.fdgahl.cn
generate privatekey, address, keystore, mneonic
const privateKey = crypto.generatePrivateKey();
const address = crypto.getAddressFromPrivateKey(privateKey);
const keyStore = crypto.generateKeyStore(privateKey, password);
const mneonic = crypto.getMnemonicFromPrivateKey(privateKey);
crypto.generateMnemonic();//24
recover privatekey, address from keystore, mneonic
const privateKey = crypto.getPrivateKeyFromKeyStore(keystore, password);
const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic);
const address = crypto.getAddressFromPrivateKey(privateKey);
serialize object to hex string which compatible with go-amino
amino.marshalBinary(data)
amino.marshalBinaryBare(data);
-
every tx has a specified type and encode prefix
-
supported type and prefix:
type name prefix MsgSend transfer 2A2C87FA NewOrderMsg placeOrder CE6DC043 CancelOrderMsg cancelOrder 166E681B