1. Home
  2. Get Started
  3. Signing Transaction Using NodeJS

Signing Transaction Using NodeJS

In order to sign a transaction over BitShares; you will need to use one of our libraries to communicate with API node, in below example we’re using our official NodeJS library:

git clone -d master https://github.com/bitshares/bitsharesjs.git

cd bitsharesjs

npm install bitsharesjs

wget https://raw.githubusercontent.com/bitshares/bitsharesjs/master/examples/transfer.js

Edit the file transfer.js and replace below variables with your desired variables:


var witness_node = "wss://node.testnet.bitshares.eu" // Replace with API node
var nobroadcast = false
var amount_to_send = 10000 // how many assets you want to send
var asset_to_send = "TEST" // what is the asset you want to send
var from_account = "bob" // the account name that you are sending from
var to_account = "alice" // the account name that you are sending to
var memo_text = "Your memo goes in here.." // the memo you want to include in transaction

let pKeyActive = PrivateKey.fromWif("5KBuq5WmHvgePmB7w3onYsqLM8ESomM2Ae7SigYuuwg8MDHW7NN"); // Replace with your own Active Private Key
let pKeyMemo = PrivateKey.fromWif("5KBuq5WmHvgePmB7w3onYsqLM8ESomM2Ae7SigYuuwg8MDHW7NN"); // Replace with your own Memo Private Key

After replacing the above and saving the file; you will need to run the script with the below command:


node transfer.js