1

I'm reading 'Blockchain and distributed ledgers' by Alexander Lipton and Adrien Treccani.

I'm trying to understand how individual transactions are linked together.

On page 338, they give the 'details of a typical transaction in Block 400,000' (sorry I can't copy and paste text):

From the book, page 338

When I look at this transaction using https://blockchain.info/tx/928c4275dfd6270349e76aa5a49b355eefeb9e31ffbe95dd75fed81d219a23f8?format=json then this is what I see:

{
  "hash": "928c4275dfd6270349e76aa5a49b355eefeb9e31ffbe95dd75fed81d219a23f8",
  "ver": 1,
  "vin_sz": 1,
  "vout_sz": 1,
  "size": 191,
  "weight": 764,
  "fee": 100000,
  "relayed_by": "0.0.0.0",
  "lock_time": 0,
  "tx_index": 8730617388972831,
  "double_spend": false,
  "time": 1456417484,
  "block_index": 400000,
  "block_height": 400000,
  "inputs": [
    {
      "sequence": 4294967295,
      "witness": "",
      "script": "473044022100a98648381f405a6882989faa500147c7cb9f4ce03e912d18529fb3609e243a47021f798214efe634e8c47e158edae534f5652b98ce1bd3693fa95dcdd2c699d987012102bd63ab2a6215bdd16d554ea3fd5d83843bff9c76e0b8c6c150d58ee6ca7ea525",
      "index": 0,
      "prev_out": {
        "tx_index": 2867663739202288,
        "value": 321000000,
        "n": 5,
        "type": 0,
        "spent": true,
        "script": "76a914c53c08858049dccc686358e05a0371211fc77c5b88ac",
        "spending_outpoints": [
          {
            "tx_index": 8730617388972831,
            "n": 0
          }
        ],
        "addr": "1Jyt2ydxc9uTzHuj8DR8egqbLEwLa6kQPL"
      }
    }
  ],
  "out": [
    {
      "type": 0,
      "spent": true,
      "value": 320900000,
      "spending_outpoints": [
        {
          "tx_index": 8460568020598031,
          "n": 0
        }
      ],
      "n": 0,
      "tx_index": 8730617388972831,
      "script": "76a9142f58e6245481be77894d5f0f0e2641decdafc44788ac",
      "addr": "15KMFpvaHJLf26y7DkTFKjxijfYvAAdU2s"
    }
  ]
}

This seems to be somewhat different. In particular, there's no 'Prev. TXID' field. The previous transaction the book refers to (5180fff4155787703d10f03cca1566794516ac65a67764e571dc9c34931f321d) doesn't even seem to exist.

My question is: is there a way of figuring out which transactions are chained to which?

1 Answer 1

2

This seems to be somewhat different.

Blockchain explorers do not show the exact block structure. They usually add extra derived information that they consider helpful. I also find this misleading and often unhelpful.

You might find a different blockchain explorer to be more helpful (or at least unhelpful in ways that don't matter as much to you). For example See For developers Raw Tx in https://blockchair.com/bitcoin/transaction/928c4275dfd6270349e76aa5a49b355eefeb9e31ffbe95dd75fed81d219a23f8.

is there a way of figuring out which transactions are chained to which?

Yes. Each input of a transaction links that transaction to an earlier transaction identified by the previous transaction ID field ("Prev.TxId" in your example) in the data for each input.

So you can, for example, parse the BLK files created by Bitcoin core to list those links between transactions.

> blockchain -file blk02000.dat -block 1 -tx 572

Transaction Details in Hex (Decimal/Symbolic):
  Version:................01000000 (1)
  Inputs:.................04 (4)
  Input:1
    Previous Transaction:.3476B395124F8C339802EDEDBA2FDFE13D28AF4C28E67BABBFCCC27E18EF97C7
    Previous Output Index:0000 (0)
    Script Length:........6A (106)
    Unlocking Script:.....47304402205EE39EA72444ECB77D5448C6742CE17F4887AAFD30FE90E4E20147
                          823803E5AF022067D94E7AEE43C56221B403989D50BE40F1DB5A6073635E100F
                          96D8C2656798960121026B61AC29519038AECC2BB6E2F57FE9310B82D7E7873A
                          C5F4501B823C4D8E5B43
    Sequence:.............FFFFFFFF
  Input:2
    Previous Transaction:.DC9C065A1C610B13604C79925331F9762F08344E9330B11F9F5E938C3F46754B
    Previous Output Index:0000 (0)
    Script Length:........6B (107)
    Unlocking Script:.....483045022100CF78C34E882E39EC2F76FD47218195156030B2FDF93E1D854FD9
                          DA17FEB785AE02200ECBE9A6402F4C597970F3F9CDB8C3FC4A700C1D8B0CA29F
                          07C71A4EF00C372B01210363CFCE0BD0D8BF56AAE3388EF5928E4F2EEB032606
                          A9B17506948CDEB0A5D8A2
    Sequence:.............FFFFFFFF
  Input:3
    Previous Transaction:.EF59C004545977F125CD33905A6AD17A4F7C5E7E55B96B6740C8B850F1AC6705
    Previous Output Index:0000 (0)
    Script Length:........6B (107)
    Unlocking Script:.....483045022100F29055D9A3D8BB9DD5ADEDAE3E2BD071488790F11290866CC5B9
                          08B7738578A402204DBCED4D7787D8D174385BCB7563BC0E7B16016E70E7F1BD
                          C28702F75283AA6A012103F8F5D44539C2679C090034F369B52B1FD309A0520B
                          F6C91F5E0C7E78FE3C30D4
    Sequence:.............FFFFFFFF
  Input:4
    Previous Transaction:.F3BEA54D65FE5E89D77E34C7E1C57D3B00E1C8327AAB0E4B3DA026C9FA7B8A16
    Previous Output Index:0001 (1)
    Script Length:........6A (106)
    Unlocking Script:.....4730440220598BB94163092C90EE14FC96BAD695915254F2FA990BF33F646D58
                          47D0A8EB9A02205893ED21FD19BC912A4D9D14C8B32F85F1C54D246529E5C95D
                          BDB53B90F4F7440121022547351C3502D195472035ACFE58E5D000EAACCF3290
                          4F0BA4057720A81F9D14
    Sequence:.............FFFFFFFF
  Outputs:................01 (1)
  Output 1
    Value:................2434000000000000 (13348)
    Script Length:........17 (23)
    Locking Script:.......A9146B6674CCB5ACA499B2A8F4A27127AD9DB9D6DD1487
  LockTime:...............00000000 (0)

Note that every transaction is identified by a Transaction ID that is a hash of selected data in the transaction (it excludes SegWit data for compatibility with non-Segwit nodes)

See

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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