What does a transaction look like?
If a company (Packt Publishing, for example) is sending assets to one of its developers, such as yourself, with a contract to be signed for payment in Bitcoins, that transaction contain three pieces of information: an input, an asset (amount) to transfer, and an output.
In the context of Bitcoins, the transaction contains the following information:
- The address used to receive the Bitcoins from someone else, or that was created when buying Bitcoins from a currency exchange
- The number of Bitcoins that Packt is sending to you for your work
- The Bitcoin address where you want to receive the Bitcoins
A major misconception is that the input address represents your wallet address, but it actually represents the address where the Bitcoins were last sent. The input to a transaction can include multiple "last-sent-from" addresses. Due to the way Bitcoin transactions work with addresses, it is not that easy to use as an everyday payment currency because it is so technical in nature.
When looking at the structure of a bitcoin transaction from a technical point of view, it looks like the following:
Input:
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca
73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e
1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8
d25c6b241501
Output:
Value: 1000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b6
5d35549d
OP_EQUALVERIFY OP_CHECKSIG
In this example, the input uses the previous transaction f5d8… to import the needed 10 BTC the sender wants to transact by referencing the previous output at index # 0. The output sends the 10 BTC, whose value is represented by the number of Satoshi ( 1 BTC = 100,000,000 Satoshi), to the Bitcoin address 40437… When recipients want to spend the Bitcoins, they will again reference the same output index # 0 of this new transaction as the input for their own transaction. The scriptSig and scriptPubKey parts of a transaction are used for the verification process.
Where cryptocurrency transactions supply a token/asset value as the payload of the transaction, a more business transaction-driven blockchain will commonly transact more complex structures. In the context of other applications, like sending a contract or an invoice, the transaction contains the following information:
- The address of the peer in the (private) blockchain network held by Packt
- The binary payment, which can hold any key/value data structure, including a reference to a digital document
- The address of the peer in the (private) blockchain network held by you