Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Bitcoin raw transaction and transaction id

Bitcoin Raw Transaction
  • A raw transaction is a way to construct a transaction by specifying the UTXO (which bitcoins to spend) and where to send them.
  • This raw transaction can be signed with your private key, and the signed transaction can be broadcasted to the Bitcoin network.
  • It is intended for developers or very sophisticated end-users for low-level access to transaction creation and broadcast.
Big Endian Little Endian
  • Big Endian - Machine stores the most significant bytes first.

  •  Little Endian - Machine stores the least significant bytes first.

  • A Satoshi is the smallest unit of Bitcoin.
  • 1$ = 100 cent
  • 1 cent = 0.01 $
  • 1 BTC = 100,000,000 satoshi (108)
  • 1 satoshi = 0.000000001 BTC

  • A transaction id (TXID) or transaction hash is a long string of numbers:
  • A transaction if can be used to look up a transaction on the blockchain.
  • Transaction ids are also used to create a Merkle Tree (more about this in a later video)
  • A Bitcoin transaction id is always 32 bytes (64 characters) and contains hexadecimal values.
Bitcoin Transaction ID

To calculate the transaction id of a transaction:
  • Create the raw transaction: raw _tx
  • Convert raw_tx hex string into the corresponding unicode: data = raw_tx.decode("hex")
  • Apply the sha256 hash function twice: hash = sha256(sha256(data))
  • Take the little endian order of the hash: hash_little_ehdian = little_endian(hash)

No comments:

Post a Comment

Popular Posts