js-og-sdk is a Node.js node_module for OG DAG chain. OG JavaScript API.
- generate raw transaction
- sign the raw transaction and send to og
You can also:
- set the servers whatever you want
- query the chain data through the functions.
- generate secp256k1 privKey and get publicKey & address
- sign the message with the privKey
Using npm to include js-og-sdk in your own project:
npm install --save og-sdk- Install it using npm:
npm install --save og-sdk- require/import it in your JavaScript:
varOG=require('og-sdk');For information on how to use js-og-sdk, take a look at the example.js.
varOG=require('og-sdk');varog=newOG;varprivateKey=Buffer.from('942f9a3d695bb54a8748ef942e88a148de7d0a7fa3ad88d801615f812bd5b672','hex')vartxParams={from : "0x05452b3d60ca312fa85b39c29864d6980a6eb436",to : "0xa7656df695f2e74b060e3c9a3c8e425cf2107c25",value : 0,publicKey : "08a69e709e264fcc370d407f2e83ade02d6aaaac7543f87da99f692588cbf72ed35bfac2ace827e507fee6c8435e74ea58dc496013fd92128e979b8ce7b34625",publicKey_raw : "0408a69e709e264fcc370d407f2e83ade02d6aaaac7543f87da99f692588cbf72ed35bfac2ace827e507fee6c8435e74ea58dc496013fd92128e979b8ce7b34625",height : 10,nonce : 1}varsignTarget=og.genRawTransaction(txParams);//gen tx sign targetvarsignature=og.signRawTransaction(signTarget,privateKey).signature;//sign the txvartx=og.makeUpTransaction(txParams,signature);//put signature into txParamsog.sendTransaction(tx);//send the complete tx to ogGNU Lesser General Public License v2.1