dcorejs-lib
This library is combined forks of graphenejs-lib and graphenejs-ws.
The library was created as a combination of forks of graphenejs-lib and graphenejs-ws with necessary corrections. Can be used to construct, sign and broadcast transactions in JavaScript, and to easily obtain data from the blockchain via public APIs.
Setup
To obtain the library use npm:
npm install dcorejs-lib
Usage
The following examples will provide you basics of dcorejs-lib library usage, like is manipulation and doing fetches of DCore blockchain objects.
Initialization
Moreover, it includes connection to DCore daemon APIs.
var Apis ChainConfig = ; var dcoreWsAddress = 'wss://dcore.address.com'; ChainConfignetworksdecent = chainId: 'your_dcore_chain_id' ; Apisinit_promise ;
Chain
The module provides utility methods which handles DCore blockchain objects.
var Apis ChainStore FetchChain = ; Apisinit_promise ;
Private keys
Generate a new private key from a seed (e.g. a brainkey).
var PrivateKey key = ; let seed = "THIS IS A TERRIBLE BRAINKEY SEED WORD SEQUENCE"; let pkey = PrivateKey; console; console;
Transactions
Following example show the way of broadcasting transfer
operation transaction into DCore network.
var Apis TransactionHelper ChainStore FetchChain Aes TransactionBuilder = ; var amount = 011; var fromAccountId = 'sender_account_name'; var toAccountId = 'receiver_account_name'; var memoMessage = 'some memo for receiver'; Apisinit_promise ;