1

Note: I am using regtest for the code in this question, so it won't be the actual block

I am trying to crate a block viewer that shows what transactions there are, and what addresses where sent to/from on the blockchain

So, I have a transaction that's part of a block, let's say this:

{
    "txid": "11177c92109de88ed4e278c0469b3a1020fe381235b27ccd6009ba63cd8077e6",
    "hash": "11177c92109de88ed4e278c0469b3a1020fe381235b27ccd6009ba63cd8077e6",
    "version": 2,
    "size": 986,
    "vsize": 986,
    "locktime": 10902,
    "vin": [
        {
            "txid": "54ee887755c60ce410c4e94ba95db6b43f758b1150abac1d3e33329c8f362a0d",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100c5094a6fabea9b213aeaa22577c0e29fe10a51f061b77903207b9c15843c9ab30220489a7e2cc0c3f08b052f160fae45148b14e649c491b8e6a49f3a18ec60fed45b[ALL] 03205112d68bf8c500387b875886c955ab8c74f63416ec8981e76c628f077aea7d",
                "hex": "483045022100c5094a6fabea9b213aeaa22577c0e29fe10a51f061b77903207b9c15843c9ab30220489a7e2cc0c3f08b052f160fae45148b14e649c491b8e6a49f3a18ec60fed45b012103205112d68bf8c500387b875886c955ab8c74f63416ec8981e76c628f077aea7d"
            },
            "sequence": 4294967294
        },
        {
            "txid": "7a746b263221c0f4a63d691496fd8dbe8731f3fa6906c08b874936c0adbbea24",
            "vout": 0,
            "scriptSig": {
                "asm": "304402207a1a5b322d014b155fac7b203d2f8ab6aea10394bf75bb975bf6a1fb2ef56972022026610f834d0fc78aff963cf005b3d68b11e59179d863690a4fda80b535c60a7e[ALL]",
                "hex": "47304402207a1a5b322d014b155fac7b203d2f8ab6aea10394bf75bb975bf6a1fb2ef56972022026610f834d0fc78aff963cf005b3d68b11e59179d863690a4fda80b535c60a7e01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "bd3fa40dc42212b797445c52a44915e814f18a7e556d5ec827e2ef145c8ce82c",
            "vout": 0,
            "scriptSig": {
                "asm": "304402203c796e0ee2b936bf1c68aa80628df99dd66fe4bb8e50e17b4b8542db9a093cae02201912360efc7bad731d7d83f79b18c025e7301b0170417b7d0d70d66aacc8470a[ALL]",
                "hex": "47304402203c796e0ee2b936bf1c68aa80628df99dd66fe4bb8e50e17b4b8542db9a093cae02201912360efc7bad731d7d83f79b18c025e7301b0170417b7d0d70d66aacc8470a01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "2371795056a6a17c6b7743eb20f308ccc7d19c55b85e49e0fd0661c4ac0fed36",
            "vout": 0,
            "scriptSig": {
                "asm": "3043021f795fa2f549f2bc737ebe9ed7d8b92043692a57db85b12ed40473758b7e3e7f022031f4b5f76967a2f30be0fb239fa3647662421b072f52c6dcdba6b9a878978edf[ALL]",
                "hex": "463043021f795fa2f549f2bc737ebe9ed7d8b92043692a57db85b12ed40473758b7e3e7f022031f4b5f76967a2f30be0fb239fa3647662421b072f52c6dcdba6b9a878978edf01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "edafa4af2bc8eca985bac3ed938701d0c9311998907901c549ba14d56908fe4c",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100c1590c69d15038124bfc3a864393958c8a95d9eb0566c1c59618534820f0bf940220761452f33eb5663793d1f324c31286a374ae0814ccc8f56b26b913dc0e82dec6[ALL]",
                "hex": "483045022100c1590c69d15038124bfc3a864393958c8a95d9eb0566c1c59618534820f0bf940220761452f33eb5663793d1f324c31286a374ae0814ccc8f56b26b913dc0e82dec601"
            },
            "sequence": 4294967294
        },
        {
            "txid": "f80686fb8e3a42a4375c0103a26a105b20399295ec5838ee90b8dc2df91eaf4d",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100a7e0b6c0b5fa68e2dd8350a889487808c563ac385bb6662c1dfe52a59963d9b1022012de4cda6ce64e85eef6d6c24e2013d4d150ff61221d2dd0ef4895aff02e2e4b[ALL]",
                "hex": "483045022100a7e0b6c0b5fa68e2dd8350a889487808c563ac385bb6662c1dfe52a59963d9b1022012de4cda6ce64e85eef6d6c24e2013d4d150ff61221d2dd0ef4895aff02e2e4b01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "4115addc82630053c66b2606c2d356c4fa8695748b8ca53adf7e718e7dcea75a",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100be7a65a7b39718406f098408e7066acbd22ad160eacfe12b76f3f06e532597d0022001a8049c0db04a1459fbb5153270163445743937d5eb411338d93996d8840e35[ALL]",
                "hex": "483045022100be7a65a7b39718406f098408e7066acbd22ad160eacfe12b76f3f06e532597d0022001a8049c0db04a1459fbb5153270163445743937d5eb411338d93996d8840e3501"
            },
            "sequence": 4294967294
        },
        {
            "txid": "5a64798db0257b400c05d7e212b38c22287fbfdd551c2a585fc2b1058fb7d5e7",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100958bda2c647ed165dff4fb20d67e1739992ce558d775ced451fef6f1840ba83702203e4d38fe8cb69c2b4ac27845eec455ecdcbd6207fa47e15d9cb98b2dc4604772[ALL]",
                "hex": "483045022100958bda2c647ed165dff4fb20d67e1739992ce558d775ced451fef6f1840ba83702203e4d38fe8cb69c2b4ac27845eec455ecdcbd6207fa47e15d9cb98b2dc460477201"
            },
            "sequence": 4294967294
        }
    ],
    "vout": [
        {
            "value": 10,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 bc8ea5101455d5407bb61a7fb084dd82c1534622 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914bc8ea5101455d5407bb61a7fb084dd82c153462288ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "mxhxDFWXL79StxTwsudqQFmiF9PsnBfa2m"
                ]
            }
        }
    ],
    "hex": "02000000080d2a368f9c32333e1dacab50118b753fb4b65da94be9c410e40cc6557788ee54000000006b483045022100c5094a6fabea9b213aeaa22577c0e29fe10a51f061b77903207b9c15843c9ab30220489a7e2cc0c3f08b052f160fae45148b14e649c491b8e6a49f3a18ec60fed45b012103205112d68bf8c500387b875886c955ab8c74f63416ec8981e76c628f077aea7dfeffffff24eabbadc03649878bc00669faf33187be8dfd9614693da6f4c02132266b747a000000004847304402207a1a5b322d014b155fac7b203d2f8ab6aea10394bf75bb975bf6a1fb2ef56972022026610f834d0fc78aff963cf005b3d68b11e59179d863690a4fda80b535c60a7e01feffffff2ce88c5c14efe227c85e6d557e8af114e81549a4525c4497b71222c40da43fbd000000004847304402203c796e0ee2b936bf1c68aa80628df99dd66fe4bb8e50e17b4b8542db9a093cae02201912360efc7bad731d7d83f79b18c025e7301b0170417b7d0d70d66aacc8470a01feffffff36ed0facc46106fde0495eb8559cd1c7cc08f320eb43776b7ca1a656507971230000000047463043021f795fa2f549f2bc737ebe9ed7d8b92043692a57db85b12ed40473758b7e3e7f022031f4b5f76967a2f30be0fb239fa3647662421b072f52c6dcdba6b9a878978edf01feffffff4cfe0869d514ba49c5017990981931c9d0018793edc3ba85a9ecc82bafa4afed0000000049483045022100c1590c69d15038124bfc3a864393958c8a95d9eb0566c1c59618534820f0bf940220761452f33eb5663793d1f324c31286a374ae0814ccc8f56b26b913dc0e82dec601feffffff4daf1ef92ddcb890ee3858ec959239205b106aa203015c37a4423a8efb8606f80000000049483045022100a7e0b6c0b5fa68e2dd8350a889487808c563ac385bb6662c1dfe52a59963d9b1022012de4cda6ce64e85eef6d6c24e2013d4d150ff61221d2dd0ef4895aff02e2e4b01feffffff5aa7ce7d8e717edf3aa58c8b749586fac456d3c206266bc653006382dcad15410000000049483045022100be7a65a7b39718406f098408e7066acbd22ad160eacfe12b76f3f06e532597d0022001a8049c0db04a1459fbb5153270163445743937d5eb411338d93996d8840e3501feffffffe7d5b78f05b1c25f582a1c55ddbf7f28228cb312e2d7050c407b25b08d79645a0000000049483045022100958bda2c647ed165dff4fb20d67e1739992ce558d775ced451fef6f1840ba83702203e4d38fe8cb69c2b4ac27845eec455ecdcbd6207fa47e15d9cb98b2dc460477201feffffff0100ca9a3b000000001976a914bc8ea5101455d5407bb61a7fb084dd82c153462288ac962a0000",
    "blockhash": "20eef2ef68d938a0276373deef99d7db1932e888b8e7bd6d5cadcbf248305398",
    "confirmations": 200,
    "time": 1509404929,
    "blocktime": 1509404929
}

So, this is the transaction: 11177c92109de88ed4e278c0469b3a1020fe381235b27ccd6009ba63cd8077e6

This transaction has multiple 'vins' and 1 'vout', the vins has a txid. Does that mean, the outputs for the 'vins' input transaction is the address that is part of this transaction too? Here is the transaction for: 54ee887755c60ce410c4e94ba95db6b43f758b1150abac1d3e33329c8f362a0d

{
    "txid": "54ee887755c60ce410c4e94ba95db6b43f758b1150abac1d3e33329c8f362a0d",
    "hash": "54ee887755c60ce410c4e94ba95db6b43f758b1150abac1d3e33329c8f362a0d",
    "version": 2,
    "size": 1135,
    "vsize": 1135,
    "locktime": 10802,
    "vin": [
        {
            "txid": "1da4067ee03175efd51e1a336bf685b9c0506bcfbfaecd0d250938b9d5f5c619",
            "vout": 1,
            "scriptSig": {
                "asm": "3045022100dd1b0a17911a8902a7ac315b0fccda45802a6ad0c4496606436bb1cf8a4195a3022073e4e68d5be3998634e68e707198986d9b2b9580731355aa49f7db25f8e5b174[ALL] 0239dc76b6876e48050513d99b5c17d5d090aac2df71bda53f9caff5e6ef91ec66",
                "hex": "483045022100dd1b0a17911a8902a7ac315b0fccda45802a6ad0c4496606436bb1cf8a4195a3022073e4e68d5be3998634e68e707198986d9b2b9580731355aa49f7db25f8e5b17401210239dc76b6876e48050513d99b5c17d5d090aac2df71bda53f9caff5e6ef91ec66"
            },
            "sequence": 4294967294
        },
        {
            "txid": "91e2c701a6a96c1d07cb4c3ef9fa7bf22b0251bf76af727dfd23b8b79f7ffe33",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100a2705ba00f2e662ffc1ede58afd87031e970e697b851a3396cad4bbbb1e8eb550220187138083835e933917b8dde7afc5649814294e33423e8fb58bd54790dba2b5a[ALL]",
                "hex": "483045022100a2705ba00f2e662ffc1ede58afd87031e970e697b851a3396cad4bbbb1e8eb550220187138083835e933917b8dde7afc5649814294e33423e8fb58bd54790dba2b5a01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "404d351281963490358f38633782e99a504ea57ec48d9bde0c1b9289e055b447",
            "vout": 0,
            "scriptSig": {
                "asm": "304502210099ba5e4f87cb57ced975601d22399ed916af9a96233565e1d5f472e2db8073460220752b875678fab1798a1bd0269a325842f2fb9ce3872709201d1b26eb9725f4b0[ALL]",
                "hex": "48304502210099ba5e4f87cb57ced975601d22399ed916af9a96233565e1d5f472e2db8073460220752b875678fab1798a1bd0269a325842f2fb9ce3872709201d1b26eb9725f4b001"
            },
            "sequence": 4294967294
        },
        {
            "txid": "d1b8d15d745816c1e5e474ce03bdc03799e580d206a66c42dc12eac0f3379455",
            "vout": 0,
            "scriptSig": {
                "asm": "304402207bae193ca1f3b5dce3b31bc6c18801f47324f3dd173bc9b56983e6536aa2563802204c1dd7dcce57b79adf1a1935e194d0e106465dccb07508a02acee9298d220f9d[ALL]",
                "hex": "47304402207bae193ca1f3b5dce3b31bc6c18801f47324f3dd173bc9b56983e6536aa2563802204c1dd7dcce57b79adf1a1935e194d0e106465dccb07508a02acee9298d220f9d01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "7a630a69bd8d3f1f5af3ef35dc33abcdf9f27a8f591f5ffd4b9385a4cc0d396a",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100fc6688ba9b7ec9d06b374bd07fc0d4ef98415afeb1d6d1575e743dccdf674d0f022047f0dc760c46aa15c4b4f3340276b98d333fcd00fddb2b475af6f423bb7d3649[ALL]",
                "hex": "483045022100fc6688ba9b7ec9d06b374bd07fc0d4ef98415afeb1d6d1575e743dccdf674d0f022047f0dc760c46aa15c4b4f3340276b98d333fcd00fddb2b475af6f423bb7d364901"
            },
            "sequence": 4294967294
        },
        {
            "txid": "d94a4c13aface94d878020b76e8403a36cd543e902f029e59d90d1eb0fbbe9a2",
            "vout": 0,
            "scriptSig": {
                "asm": "304502210088bb4f7b3cc5074b90f8de7c8a61b446cee69d93842bae1db5e389867c28befc022076bc70e5252d72b29e4750e41321ac2f2be9d7afb9c0c380b10ddd94ba32aa0d[ALL]",
                "hex": "48304502210088bb4f7b3cc5074b90f8de7c8a61b446cee69d93842bae1db5e389867c28befc022076bc70e5252d72b29e4750e41321ac2f2be9d7afb9c0c380b10ddd94ba32aa0d01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "3760d9076239606abe39d2abc1f64aa3daa0c23ca3572b48f9d842729c1cb3ad",
            "vout": 0,
            "scriptSig": {
                "asm": "3044022042a6917812554b5ce5f14b97e7af8d5fac9b5a63ad19ee40710d7eed4f44c17002207e1f8c8ebcb890934966c233169c0bbfd08e3ec9f0ded35eb91a0ed463ab1fd4[ALL]",
                "hex": "473044022042a6917812554b5ce5f14b97e7af8d5fac9b5a63ad19ee40710d7eed4f44c17002207e1f8c8ebcb890934966c233169c0bbfd08e3ec9f0ded35eb91a0ed463ab1fd401"
            },
            "sequence": 4294967294
        },
        {
            "txid": "0b99f920107ccd38f6a68aef1621c4eb285a1fef7141d1ea5567c82d837324b3",
            "vout": 0,
            "scriptSig": {
                "asm": "3044022015abbbc5e6fe8c20c19d25e01416e98c3b31399f44d14ff18c6416afe38480d7022041c8b58aa573f5fccb76b3dc3817a799ff495a251dd9709d582accf84872eedb[ALL]",
                "hex": "473044022015abbbc5e6fe8c20c19d25e01416e98c3b31399f44d14ff18c6416afe38480d7022041c8b58aa573f5fccb76b3dc3817a799ff495a251dd9709d582accf84872eedb01"
            },
            "sequence": 4294967294
        },
        {
            "txid": "43c9f3e2323520943701b93749e48da02702c4a7a425d39910672e563f75a7ce",
            "vout": 0,
            "scriptSig": {
                "asm": "3045022100d15ab71c6e47f9daa642a91be207df4e9251df3858bceacb341773331dbed3d60220535191dd0cb31fddb6ced741f1fda369031d4d427e01282730de445be4b57457[ALL]",
                "hex": "483045022100d15ab71c6e47f9daa642a91be207df4e9251df3858bceacb341773331dbed3d60220535191dd0cb31fddb6ced741f1fda369031d4d427e01282730de445be4b5745701"
            },
            "sequence": 4294967294
        }
    ],
    "vout": [
        {
            "value": 10,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 bc8ea5101455d5407bb61a7fb084dd82c1534622 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914bc8ea5101455d5407bb61a7fb084dd82c153462288ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "mxhxDFWXL79StxTwsudqQFmiF9PsnBfa2m"
                ]
            }
        },
        {
            "value": 0.0000548,
            "n": 1,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 a0b64629c550398260caa3a538361100b97a9630 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914a0b64629c550398260caa3a538361100b97a963088ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "mvAimNWSJcvkxbFL1hZfrnL22MBDq2a3AP"
                ]
            }
        }
    ],
    "hex": "020000000919c6f5d5b93809250dcdaebfcf6b50c0b985f66b331a1ed5ef7531e07e06a41d010000006b483045022100dd1b0a17911a8902a7ac315b0fccda45802a6ad0c4496606436bb1cf8a4195a3022073e4e68d5be3998634e68e707198986d9b2b9580731355aa49f7db25f8e5b17401210239dc76b6876e48050513d99b5c17d5d090aac2df71bda53f9caff5e6ef91ec66feffffff33fe7f9fb7b823fd7d72af76bf51022bf27bfaf93e4ccb071d6ca9a601c7e2910000000049483045022100a2705ba00f2e662ffc1ede58afd87031e970e697b851a3396cad4bbbb1e8eb550220187138083835e933917b8dde7afc5649814294e33423e8fb58bd54790dba2b5a01feffffff47b455e089921b0cde9b8dc47ea54e509ae9823763388f359034968112354d40000000004948304502210099ba5e4f87cb57ced975601d22399ed916af9a96233565e1d5f472e2db8073460220752b875678fab1798a1bd0269a325842f2fb9ce3872709201d1b26eb9725f4b001feffffff559437f3c0ea12dc426ca606d280e59937c0bd03ce74e4e5c11658745dd1b8d1000000004847304402207bae193ca1f3b5dce3b31bc6c18801f47324f3dd173bc9b56983e6536aa2563802204c1dd7dcce57b79adf1a1935e194d0e106465dccb07508a02acee9298d220f9d01feffffff6a390dcca485934bfd5f1f598f7af2f9cdab33dc35eff35a1f3f8dbd690a637a0000000049483045022100fc6688ba9b7ec9d06b374bd07fc0d4ef98415afeb1d6d1575e743dccdf674d0f022047f0dc760c46aa15c4b4f3340276b98d333fcd00fddb2b475af6f423bb7d364901feffffffa2e9bb0febd1909de529f002e943d56ca303846eb72080874de9acaf134c4ad9000000004948304502210088bb4f7b3cc5074b90f8de7c8a61b446cee69d93842bae1db5e389867c28befc022076bc70e5252d72b29e4750e41321ac2f2be9d7afb9c0c380b10ddd94ba32aa0d01feffffffadb31c9c7242d8f9482b57a33cc2a0daa34af6c1abd239be6a60396207d960370000000048473044022042a6917812554b5ce5f14b97e7af8d5fac9b5a63ad19ee40710d7eed4f44c17002207e1f8c8ebcb890934966c233169c0bbfd08e3ec9f0ded35eb91a0ed463ab1fd401feffffffb32473832dc86755ead14171ef1f5a28ebc42116ef8aa6f638cd7c1020f9990b0000000048473044022015abbbc5e6fe8c20c19d25e01416e98c3b31399f44d14ff18c6416afe38480d7022041c8b58aa573f5fccb76b3dc3817a799ff495a251dd9709d582accf84872eedb01feffffffcea7753f562e671099d325a4a7c40227a08de44937b9013794203532e2f3c9430000000049483045022100d15ab71c6e47f9daa642a91be207df4e9251df3858bceacb341773331dbed3d60220535191dd0cb31fddb6ced741f1fda369031d4d427e01282730de445be4b5745701feffffff0200ca9a3b000000001976a914bc8ea5101455d5407bb61a7fb084dd82c153462288ac68150000000000001976a914a0b64629c550398260caa3a538361100b97a963088ac322a0000",
    "blockhash": "1300cb4adf6c3f3c3c016c1f4477cd9e458af8031894f44a1fec69c43845dedf",
    "confirmations": 300,
    "time": 1509388698,
    "blocktime": 1509388698
}

In the latter transaction, it has 2 output addresses, does that mean, that 2 output addresses are part of the first transaction input addresses?

1

The "input addresses" are the addresses associated with the specific outputs that were spent from. So in your example only the address associated with the 0'th output of 54ee887755c60ce410c4e94ba95db6b43f758b1150abac1d3e33329c8f362a0d is an "input address" to 11177c92109de88ed4e278c0469b3a1020fe381235b27ccd6009ba63cd8077e6.

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.