Data Properties of Bitcoin Transaction

This section describes data properties of a Bitcoin transaction.

A Bitcoin transaction has the following data properties expressed in JSON format:

  "txid" : "id",        (string) The transaction id (same as provided)
  "hash" : "id",        (string) The transaction hash (differs from txid 
                                 for witness transactions)
  "size" : n,           (numeric) The serialized transaction size
  "vsize" : n,          (numeric) The virtual transaction size (differs 
                                  from size for witness transactions)
  "version" : n,        (numeric) The version
  "locktime" : ttt,     (numeric) The lock time
  "vin" : [             (array of json objects)
     {
       "txid": "id",    (string) The transaction id
       "vout": n,       (numeric)
       "scriptSig": {   (json object) The script
         "asm": "asm",  (string) asm
         "hex": "hex"   (string) hex
       },
       "sequence": n    (numeric) The script sequence number
       "txinwitness": ["hex", ...] (array of string) hex-encoded witness 
                                  data (if any)
     }
     ,...
  ],
  "vout" : [            (array of json objects)
     {
       "value" : x.xxx,     (numeric) The value in BTC
       "n" : n,             (numeric) index
       "scriptPubKey" : {   (json object)
         "asm" : "asm",     (string) the asm
         "hex" : "hex",     (string) the hex
         "reqSigs" : n,     (numeric) The required sigs
         "type" : "pubkeyhash",  (string) The type, eg 'pubkeyhash'
         "addresses" : [    (json array of string)
           "address"        (string) bitcoin address
           ,...
         ]
       }
     }
     ,...
  ],
  "blockhash" : "hash",   (string) the block hash
  "confirmations" : n,    (numeric) The confirmations
  "time" : ttt,           (numeric) The transaction time in seconds since 
                                    (Jan 1 1970 GMT)
  "blocktime" : ttt       (numeric) The block time in seconds since (Jan 1 
                                    1970 GMT)
}

Let's take a look at the transaction from Bitcoin Test Network:

C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli.exe -testnet getrawtransaction 
   e22d5998a43e3e1d81784e6e92988d1c4eae77cd0e439542337e48a786c75e69 true

{
  "txid": 
     "e22d5998a43e3e1d81784e6e92988d1c4eae77cd0e439542337e48a786c75e69",
  "hash": 
     "e22d5998a43e3e1d81784e6e92988d1c4eae77cd0e439542337e48a786c75e69",
  "version": 2,
  "size": 225,
  "vsize": 225,
  "locktime": 1281294,
  "vin": [
    {
      "txid": 
        "6f6e35c52b7a00c4b496a7191296c29fe98248e869471c92c87c47885dc54baa",
      "vout": 0,
      "scriptSig": {
        "asm": 
"304402202ab88452cd720f3e42731a5fd1345e5f2c6888a3d0a0568abf315c46e6b038cf02
20394e02c12aecd9bb2356b4b09980476a4cb347b9e96088f39c995d6d0302fd76[ALL] 
0387ab1fa2aedc1dfe5fd8fba9275455b392db1e3b7bad3a8d611fb3cdb789f84d",
        "hex": 
"47304402202ab88452cd720f3e42731a5fd1345e5f2c6888a3d0a0568abf315c46e6b0..."
      },
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 847.54623264,
      "n": 0,
      "scriptPubKey": {
        "asm": 
"OP_DUP OP_HASH160 c14be92816c5ccfa8c742acba43ee5382ce22eac 
OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c14be92816c5ccfa8c742acba43ee5382ce22eac88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "my91eT3mdFdo9gfe85wu2Ex35sNRS3uVwJ"
        ]
      }
    },
    {
      "value": 7.03666753,
      "n": 1,
      "scriptPubKey": {
        "asm": 
"OP_DUP OP_HASH160 5e25fd265324c70a1a8bbbeb969614d39f6f6647 
OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9145e25fd265324c70a1a8bbbeb969614d39f6f664788ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mp6mKbgWE25PyyX63zJ8SRibrKugHMkJDE"
        ]
      }
    }
  ],
  "hex": "0200000001aa4bc55d88477cc8921c4769e84882e99fc2961219a796b4c4...",
  "blockhash": 
    "0000000000000db32dee811e7a0c1caefc60fbbbf5db88464877f4c97988ea14",
  "confirmations": 2271,
  "time": 1518381726,
  "blocktime": 1518381726
}

Last update: 2018.

Table of Contents

 About This Book

 Introduction of Bitcoin

 Bitcoin Blockchain

 Bitcoin Wallet

 Bitcoin Core

 Bitcoin Transaction

 Bitcoin-Qt - Bitcoin Core GUI

 Bitcoin Mining

 Bitcoin Consensus Rules

 Bitcoin Block Data Structure

Bitcoin Transaction Data Structure

Data Properties of Bitcoin Transaction

 Data Structure of Bitcoin Raw Transaction Format

 Decode Bitcoin Raw Transaction Format

 Data Structure of Coinbase Transaction

 Calculate Transaction ID

 blockexplorer.com API

 Copay - Bitcoin Wallet

 References

 PDF Printing Version