-
-
Notifications
You must be signed in to change notification settings - Fork 826
Expand file tree
/
Copy path18_3_sendtx.js
More file actions
22 lines (18 loc) · 663 Bytes
/
18_3_sendtx.js
File metadata and controls
22 lines (18 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const RpcAgent = require('bcrpc');
agent = new RpcAgent({port: 18332, user: 'StandUp', pass: '6305f1b2dbb3bc5a16cd0
f4aac7e1eba'});
agent.getNewAddress('-addresstype', 'legacy', function (err, newAddress) {
if (err)
throw Error(JSON.stringify(err));
console.log("Recipient: " + newAddress.result);
agent.sendToAddress(newAddress.result, 0.00001, function(err, txid) {
if (err)
throw Error(JSON.stringify(err));
console.log("TXID: " + txid.result);
agent.getTransaction(txid.result, function (err, transaction) {
if (err)
throw Error(JSON.stringify(err));
console.log(transaction.result);
});
});
});