-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample3.js
More file actions
16 lines (16 loc) · 786 Bytes
/
example3.js
File metadata and controls
16 lines (16 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
const LOCK_UNTIL_BLOCK = 150; // pick a block height above the current tip
const bitcore = require('bitcore-lib'); // bitcore-lib should be in the same folder as the js file
bitcore.Networks.defaultNetwork = bitcore.Networks.testnet;
var privateKey = new bitcore.PrivateKey();
var address = privateKey.toAddress();
var utxo = {
"txId" : "115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986",
"outputIndex" : 0,
"address" : "17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV",
"script" : "76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac",
"satoshis" : 50000
};
var transaction = new bitcore.Transaction().from(utxo).addData('bitcore rocks') .sign(privateKey);// Add OP_RETURN data
console.log(JSON.stringify(transaction, null, 2));
//A standard transaction with some data