0

Bitcoin testnet

I used the following code to obtain info about unspent outputs:

const blockchainInfo = require('blockchain.info')

const blockexplorer = blockchainInfo.blockexplorer.usingNetwork(3)
blockexplorer.getUnspentOutputs(address).then((resp) => {
  console.log(resp.unspent_outputs);
})

Response:

   [ { tx_hash: '9c5a...f31b',
       tx_hash_big_endian: '1bf3....5a9c',
       tx_index: 249487365,
       tx_output_n: 0,
       script: '76a9...88ac',
       value: 200000000,
       value_hex: '0bebc200',
       confirmations: 2262 },
     { tx_hash: '708e...ec103',
       tx_hash_big_endian: '03c1...8e70',
       tx_index: 250637325,
       tx_output_n: 0,
       script: '76a9...88ac',
       value: 20000,
       value_hex: '4e20',
       confirmations: 1845 },
     { tx_hash: '803a...901d',
       tx_hash_big_endian: '1d90...3a80',
       tx_index: 256201920,
       tx_output_n: 0,
       script: '76a9...88ac',
       value: 20000,
       value_hex: '4e20',
       confirmations: 262 },
     { tx_hash: '255d...cfde',
       tx_hash_big_endian: 'decf...5d25',
       tx_index: 256264533,
       tx_output_n: 0,
       script: '76a9....88ac',
       value: 20000,
       value_hex: '4e20',
       confirmations: 252 } ]

And I got some questions.

  1. Why do we have both tx_hash and tx_hash_big_endian? Because some wallets prefer big-endian and others little-endian hash?
  2. What is the tx_index? Index of a transaction in entire blockchain?
  3. What is the tx_output_n?
  4. What is the script?
1

tx_hash and tx_hash_big_endian are the little endian and big endian representations of the transactions hash. Bitcoin uses little endian hashes internally, but explorers normally show such information in big endian, you can read more about such topic here.

Regarding tx_index, that field is an internal id for blockchain.info database. It has nothing to do with the Bitcoin blockchain.

tx_output_n is the index of the output in the transaction. utxos are identified by tx_id and tx_index.

Finally, the script is the scriptPubKey or outputScript defined in the utxo. Basically it sets the conditions to be met in order to claim such an output in a new transaction.

  • I have a question about script. What is the list of conditions to claim the output in a transaction? – srgbnd Sep 10 '18 at 9:49
  • 1
    It depends. Usually it is a digital signature performed with a specific private key. However, it can be set to several other things, like multisigs or even custom scripts. – sr-gi Sep 10 '18 at 12:58

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.