I'm using wallet-less bitcoin daemon (it just syncs blockchain) – the purpose is to read blocks and transactions in them, and do some useful things. This particular question is focused on determining the checks to be made to verify the amount received by each address in a given transaction.
Given tx, I call decoderawtransaction(getrawtransaction(tx)) and receive following details (json):
{
"txid" : "691cb3d61192c7325f203fe14d3d5cf6e98e6bd81877b166f6c37fd629aaa4fb",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"txid" : "0c0b442e866f007a0da8a2c1abbe8afad8e96217105b561b097aa835b73a6b70",
"vout" : 0,
"scriptSig" : {
"asm" : "3045022100eb01c02b4655c96b08544908bd44d1fbc165971bdc25705ba1b4790c60716dfa022024adeb306f66a72a2a90455035940b89e7c96c8300b6f73f3ae83af605b9c35d01 03ca8ff2ad5114e703d07b3cee962d54609c1de95fd4511e53de91ba0ce35ef4ee",
"hex" : "483045022100eb01c02b4655c96b08544908bd44d1fbc165971bdc25705ba1b4790c60716dfa022024adeb306f66a72a2a90455035940b89e7c96c8300b6f73f3ae83af605b9c35d012103ca8ff2ad5114e703d07b3cee962d54609c1de95fd4511e53de91ba0ce35ef4ee"
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 0.01000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 8bab392bcc5cfce30affc16336cdd68e807147a2 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9148bab392bcc5cfce30affc16336cdd68e807147a288ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"mtFTLXKfDxHuJT36cHugYTZw5CVLejqccq"
]
}
},
{
"value" : 0.04000000,
"n" : 1,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 d86064ea608dd1ceeae690e548979b854ca55360 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a914d86064ea608dd1ceeae690e548979b854ca5536088ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"n1F3j5MdfSLSgpUnaQXNVJb8KBMvnfBYPr"
]
}
}
]
}
I can see each txout record gives amount as a value (scalar) and addresses as an array.
- If addresses array has multiple values, it is a contract (m-to-n transaction perhaps) and I should not consider the money to have been received by any of the addresses for immediate spend.
- Assuming addresses has only one value, what are other checks I must make to verify that the address has received the amount mentioned in the field 'value'?
So I need to know a set of all checks to verify the transaction is confirmed, valid and that a particular address in a particular txout has received the specified amount. confirmation can be ascertained depending on the number of blocks that precede block of this transaction (getblockcount - blockheight).
Thanks!