When building a raw transaction to push to blockr.io
var unspents=
[ { txid: '67b22a1874be2e748b2c904e2181f85a9d6503001e58c374e17b1161cd5a36f4',
outputIndex: 0,
address: 'myHtNgECiAjBctWz1tM2TN2PupWwfHtgMi',
scriptPubKey: '76a914c2f9958848c465efd042fcb76fef519f03a83ec288ac',
amount: 0.001,
confirmations: 70 } ];
var amount=100000;
var transaction=new bitcore.Transaction()
.fee(bitcore.Unit.fromBTC(0.0001).toSatoshis())
.from(unspents)
.to(bitcore.Address.fromString(payToAddress),amount)
.change(address)
.sign(privateKey);
I get the error:
{ [bitcore.ErrorTransactionFeeErrorDifferent: Unspent value is different from specified fee: Unspent value is 0 but specified fee is 10000 Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.]
message: 'Unspent value is different from specified fee: Unspent value is 0 but specified fee is 10000 Use Transaction#uncheckedSerialize if you want to skip security checks.
My testnet transaction object looks like this:
‘{“version”:1,“inputs”:[{“prevTxId”:“67b22a1874be2e748b2c904e2181f85a9d6503001e58c374e17b1161cd5a36f4”,“outputIndex”:0,“sequenceNumber”:4294967295,“script”:“473044022030b5b1763041d9e78c4b657cc59d510a490bc9d062fd0bdae3aa3c4362ef5d950220377fd90fd40544470a3cc86ba7a39fbfc5879e138e6a0f2d75dc50f01af38cea012102bbe798da887604bdd360dd059061b48816634e44d9f54563af2c727b8bcb3e2f”,“scriptString”:“71 0x3044022030b5b1763041d9e78c4b657cc59d510a490bc9d062fd0bdae3aa3c4362ef5d950220377fd90fd40544470a3cc86ba7a39fbfc5879e138e6a0f2d75dc50f01af38cea01 33 0x02bbe798da887604bdd360dd059061b48816634e44d9f54563af2c727b8bcb3e2f”,“output”:{“satoshis”:100000,“script”:“76a914c2f9958848c465efd042fcb76fef519f03a83ec288ac”}}],“outputs”:[{“satoshis”:100000,“script”:“a9149ffdff1f3eea0deb21ed967b91c7ef3cce65b2d687”}],“nLockTime”:0,“changeScript”:“OP_DUP OP_HASH160 20 0xc2f9958848c465efd042fcb76fef519f03a83ec2 OP_EQUALVERIFY OP_CHECKSIG”,“fee”:10000}’
Why is bitcore protesting? I see all figures are in satoshi so what is the ‘difference’ that it is complaining about?