0

I'm new to Bitcoin development, and haven't been able to find a good resource for deciphering transaction data. Could you please explain what the following keys signify? For example, what do the "in" and "out" transactions represent, what "n":"x", "prev_out_hash" means, etc...

I'm trying to find the amount and date of incoming transactions to a given address. I'm using BlockExplorer for getting an address's transactions, but I don't know what to do with that data.

{
"result":"success",
"return":
{
 "hash":"4462c88079cc51972f1bdcb8a4240ee8757b0bb69df828ade051c95ced540fa0",
 "blocks":["000000000000076fa606a7b67c131afc87d24d34114be2863cf24ca3d48139e7"],
 "version":"1",
 "size":"1158",
  "in":
[{
  "n":"0",
  "prev_out_hash":"4578576f49418e69da6d7a1166168bb80a94682f21cca518b6c2451bc64bf858",
  "prev_out_n":"1",
  "coinbase":null,
  "scriptsig":"304402201d7eaf891bcda16ea2979694c02e590fea8fc43dc092ee60e5fb2dd756bcb19502205c5be31b772029700d0a43d499932e9c321af1cfbc8745fba6dbbe48fa79bbb501 043a264aac55e23f83b29ac7e7a914584d2aa6c2eb08ea05405f5efc38473183ca4fc075f8144bb78698df1a5be6f4057f1bccc9e1217a5658946bcc4d4f6972c3",
  "addr":"46f740cb9c737111ec91ec235f6877055be7175e"
 },
 {
  "n":"1",
  "prev_out_hash":"4feea511029896ff4c31132346a79594fcd0c4e60aab2fa4f527e1395d375488",
  "prev_out_n":"0",
  "coinbase":null,
  "scriptsig":"3046022100f3bc0445f629e4e896ced23013d89ba6e6488a6ec21c47df608aaf6d6d212fbb022100d321c4c7f5f33900b8c0efba8ff58a3541e621588f402e167f51968b6ee0bbf201 042157f97a8a78caf6315dbd6d9267b9edd9c1c37cdb211f2bc03703a28eeebaf274efdcff4ef3e3ef4a6b7ccb5d8c17acba941d1a5669c3299f22a0e78e702fdb","addr":"7b0a72820f6e92ccc384dbdecb5584d855ce9416"},

 {
"n":"2","prev_out_hash":"9adadb88c3075afdce1216b35d27fd5cac9736ce3977778999f9a85105d2ea8f","prev_out_n":"0","coinbase":null,"scriptsig":"3046022100d63237cca9bf2200c6aa255834e06f9dc5e4e20f1ea7e6678119bb0e4a5a109f022100db37ec795336509fb3a16d1acebfe08523d95e177284149614a6d3384286b27c01 04b16b41dab16cfbf59f1713559795440b98b384dc01656ebaceeec8f6d1463802cb474062b2b8c1de53ab1fe65be0f6213dd61519044e9c1f50291b915fc7fc6e","addr":"2ed7c49f080e9898737276ad802e2067a1d06ab7"},
  {
"n":"3","prev_out_hash":"0e2ed4e4db87ddc9cb54ab3cdcae59762293815d3093c238e42d33248b39e19d","prev_out_n":"1","coinbase":null,"scriptsig":"3045022100ab501414e7643cc1a78645f544cbcf6411e71e0c21953cd51f7f9933a50538a002201b4c9bac60aa19d659d0686d45bf06c4928c4446269692d88722f57624cdaf1401 048e1e4862c6fee7293f6c7be43a72a375e68395398e4d5da3db06199a35fc46cf51b87f3c6b87caeb81181d630706e23b5679ae8b96ca36701282ae5b49dd99c9","addr":"c74d2e95aeb037297c7b6a232d78c715fa1ab826"},
  {
"n":"4","prev_out_hash":"93c912462daa2a52e108e3424596d56fe2a136d6707a65b6423dee229e317ea1","prev_out_n":"1","coinbase":null,"scriptsig":"3045022100fe782441b8788ed9297c8fea735701ae0a77081fc748ceee8cde945107f64967022014d51d5bc8d8138b97a657eda6d03ba998810e3e941988da90b82f6d24d8471e01 045f53cf2dbdb3213084efa69ac1dfcd8d97be8073a8b8104feb000513aa048b653f400d23314fc090456078f46a0fc9daabdee57f1ef14c2111b9ddc35255189a","addr":"958bba83ac42ebf055c1724b25bfe5c698abbb51"},
  {
   "n":"5","prev_out_hash":"44a1b493ef6176cced4c02fb97a227b98e5bea0616d9cdd6005bcd6905d667f3","prev_out_n":"1","coinbase":null,"scriptsig":"30440220132484ad901567d2c52c0b4f3be5263d1d8ed6e76be1398d2bb7c2a1aec5f748022033b907afa05eb075dee9993b8a05c9e40c69e53d65a06cc8a975ff4c4407141e01 04bd5d7feb1884efdccbe8feb8fa9ff57d56272ac5f667bc59cb07a232fbbd9cbabdf54b6bb6ca4c77e0de22cb0f896fa6183e53381861641049f0edee2d64cfe5","addr":"3784c102bbfd34cc7fb6e12c51b5c6177592f267"}],
 "out":[{"n":"0",
 "value":
  {"value":"0.01000712","value_int":"1000712","display":"0.01000712\u00a0BTC","display_short":"0.01\u00a0BTC","currency":"BTC"},"script":"OP_DUP OP_HASH160 6427f36ed6e5a0cb526a0b0bef1335992326e9a9 OP_EQUALVERIFY OP_CHECKSIG","addr":"6427f36ed6e5a0cb526a0b0bef1335992326e9a9","claimed":"N"},{"n":"1","value":{"value":"3.31674208","value_int":"331674208","display":"3.31674208\u00a0BTC","display_short":"3.32\u00a0BTC","currency":"BTC"},"script":"OP_DUP OP_HASH160 1f27d1fc284143729944ab89823111d2bb63dc46 OP_EQUALVERIFY OP_CHECKSIG","addr":"1f27d1fc284143729944ab89823111d2bb63dc46","claimed":"N"}]
}
0

Bitcoin is simply a ledger of value assignment transactions.

There is a special assignment when the coins are first issued to a miner. But from there, the ledger is simply a compilation of all transactions, each of which is simply a value assignment.

Similar to how you don't rip a $10 bill in half to pay for a $5 purchase, spending funds received is an all or nothing action -- the entire transaction amount received is spent during a transaction.

In a bitcoin transaction the transaction whose funds are being spent is referenced as an INPUT and the entire amount of funds from that previous transaction's OUTPUT become available for spending to one or more of this transaction's OUTPUTs.

So a typical transaction will have one more INPUTs and one or more OUTPUTs.

So let's take a simple transaction. Previously the bitcoin address 15P8RCnL8oMjRf1RFrAZHJyYtxypdGp6wY received a payment of 0.022 BTC. The transaction ID in which that payment occurred is 4faa9d17c458afdf3ae928b51f1088fbe314b6866a35ad60fa7d861bc311be05.

Now to spend those funds, a new transaction must be composed. So the value from the earlier transaction 4faa9d17c458afdf3ae928b51f1088fbe314b6866a35ad60fa7d861bc311be05 will be spent. That transaction had multiple outputs however. So this spend transaction must reference which output from the previous transaction is being spent. In this case, the index is 0 (meaning the first output of that earlier transactoin) is the one being spent. That output is for the 0.022 BTC to 15P8RCnL8oMjRf1RFrAZHJyYtxypdGp6wY.

So the combination of a transaction Id + index is how the current spend transaction references where the funds are coming from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.