I’m just starting with bitcore, and I’m seeking a simple but complete stand-alone example for node that integrates both spending bitcoin in a simple pay to public key hash and also adds an op_return that will be in the same transaction.
You should be able to chain both to()
and addData()
methods to create two outputs in the transaction:
var privateKey = new bitcore.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
var utxo = {
"txId" : "115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986",
"outputIndex" : 0,
"address" : "17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV",
"script" : "76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac",
"satoshis" : 50000
};
var transaction = new bitcore.Transaction()
.from(utxo)
.addData('bitcore rocks')
.to('mtoKs9V381UAhUia3d7Vb9GNak8Qvmcsme', 20000)
.sign(privateKey);
Hi Braydon i Just want to do the same…so i get the privatekey with dumpprivkey
but my question is that someone can stole the bitcoins for my adress…because if i do the transaction…maybe someone will get the adreess from the blockchain and go to bitcoind and use the dumpprivkey
and stole my bitcoins…so how can do the transaction secure…thanks