Bitcoin transactions - how do they work?

5 min reading

We define a Bitcoin as a chain of digital signatures. Each owner transfers one Bitcoin to another owner by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership.

That was how Satoshi Nakamoto has explained a Bitcoin transaction. In reality, the process is much more complex. Bitcoin is comprised of a few major pieces: nodes and a blockchain. The role of a typical node is to maintain its own blockchain version and update it once it hears of a “better” (longer) version. Simply put, the blockchain has blocks, and blocks have transactions.

Bitcoin blockchain

The Bitcoin blockchain network represents a decentralized and digitized public ledger that stores all transactions that ever took place. The public ledger stores all transactions in chronological order. Its main purpose is to serve as an accounting and processing method for digital currencies. However, it has great potential in a variety of other industries as well. It has often been said that Bitcoin does not require a middleman or central authority thanks to its decentralized nature. Well, this decentralization alongside many of the other benefits associated with Bitcoin transactions is possible thanks to the blockchain. The reason for that is security. Bitcoin blockchain, thanks to the encryption technologies woven into it, is one of the safest currencies when it comes to transactions. As the name suggests, this public ledger comes in two sections: the blocks and the chain. The block represents the present part of the blockchain network. It’s responsible for recording and bundling a part of the network’s recent transactions. Once a block is completed, it permanently joins the chain, and a new block is created. All of these blocks are connected with one another, and they store essential data required for the system to run, including user addresses, balances, and several other components.

Bitcoin address

A Bitcoin address is an identifier consisting of 26 to 35 alphanumeric characters, representing the destination for the funds to send to. The Bitcoin protocol allows any user, wallet, exchange, or business to generate as many addresses as they’d like, free of charge. In fact, it is often recommended that different addresses are used for transactions, as doing so increases anonymity and security. The whole process is pretty much similar to that of Bitcoin mining.

Elements of transaction

A simple transaction of BTC from one party to another, performed on a peer-to-peer level is known to consist of three fundamental elements. These are the sender, the recipient, and the actual Bitcoin funds transferred from one participant’s Bitcoin wallet to the other. In Bitcoin terminology, these are rather known as the input, output, and header.

  • The Header

This is the first element that makes transactions possible, allowing them to register on the blockchain network. The transaction header is made up of several parts, these being the hash, ver, vin_sz, and lock_time. The hash is by far the most important since Bitcoin utilizes hash values in order to verify whether the Bitcoin transfer ID is authentic. The Bitcoin hash value is also used as a pointer. It points the transaction to its respective block, which will finally be added onto the chain. The verstands for the version number of the block in question. Its purpose is to clearly identify blocks and add an extra layer of security to the network. The vin_sz is responsible for counting the number of inputs associated with the Bitcoin transaction. Lastly, the lock_time is the header component that offers instructions related to how early a block can be added onto the blockchain. It plays an important role since Bitcoin protocol dictates that approximately 10 minutes must pass before another block can be added onto the chain.

  • The Input

This transaction element is responsible for initiating the transaction and offering the network details on the outstanding balance. It also keeps tab on funds that you are spending, and proof that the transaction creator has permission to spend the funds in question. The input is made up of three sections, these being the previous Bitcoin transaction output hash, the n, and the scriptSig. The outputhashpoints the network towards the unspent transaction output at your disposal—basically the funds you own that haven’t been spent yet. The n is an index giving access to the list consisting of the outputs associated with all previous transactions, while also representing the funds that you are currently spending. Lastly, the scriptSig is a security element that proves to the network that, as the BTC transaction creator, you have the right to spend the funds—in other words, you own the address, and the funds are yours alone.

  • The Output

The output is a bit easier to understand, since it’s only made up of two parts: the value and the scriptPubKey. The value stands for the amount of coins, or Satoshi to be exact, you’re spending on the current transaction. Lastly, the scriptPubKey is the second script involved in Bitcoin transactions. Its purpose is to direct the coins to the recipient’s hands by using their hashed public key.

Transaction verification

The transaction process also requires verification of the Bitcoins. This is handled by Bitcoin nodes. Nodes are a network of computers that broadcast messages across the network and are responsible for verifying transactions. Each Bitcoin transaction activates a network of randomly selected nodes that will run a Bitcoin verification or two to ensure the authenticity of the transaction. Some of the technical functions associated with nodes include verifying the following:

  • Whether the data structure and the transaction’s syntax are correct;
  • If the transaction input and output have values;
  • Whether the transaction is below the block size limit;
  • If the lock_time is respected;
  • Whether all outputs being claimed by the transaction inputs are part of the UTXO pool;
  • If the value of the transaction input is higher than the value of its output—to ensure that a miner fee can be obtained and that the user isn’t attempting to spend more funds than they own.

So to check a Bitcoin transaction, you simply need to enter the transaction ID or your address. Via these verifications, the network of nodes keeps the Bitcoin system alive and secure. No transaction can be processed without a number of nodes. The block explorer will then showcase the number of confirmations and raw data, but also output and input information.