A transaction is a transfer of Bitcoin value on the blockchain. In very simple terms, a transaction is when participant A gives a designated amount of Bitcoin they own to participant B.
How Does It Work?
Bitcoin makes use of public-key cryptography to ensure the integrity of transactions created on the network. In order to transfer Bitcoin, each participant has pairs of public keys and private keys that control pieces of bitcoin they own. A public key is a series of letters and numbers that a user must share in order to receive funds. In contrast, a private key must be kept secret as it authorizes the spending of any funds received by the associated public key.
The terms address and public key are often used interchangeably. An address is a representation of a public key, used for security and brevity.
Using the private key associated with their bitcoin, a user can sign transactions and thereby transfer the value to a new owner. The transaction is then broadcast to the network to be included in the blockchain.
Anyone who possesses your private keys has access to your bitcoin.
Overview of a Bitcoin Transaction
To better illustrate how value is transferred in the Bitcoin network, we will walk through an example transaction, where Alice sends .05 bitcoin to Bob.
At a high level, a transaction has three main parts:
- Inputs. The bitcoin address that contains the bitcoin Alice wants to send. To be more accurate, it is the address from which Alice had previously received bitcoin to and is now wanting to spend.
- Outputs. Bob’s public key or bitcoin address.
- Amounts. The amount of bitcoin Alice wants to send.
A transaction can contain multiple inputs and outputs. As long as each output has an associated amount and the input amounts total more than the output amounts, the transaction is valid.
In order for Alice to send the .05 bitcoin to Bob, she signs a message with the transaction details using her private key. The message contains the input, output, and amount as described above. The transaction is then broadcast to the rest of the Bitcoin network where nodes verify that Alice’s private key is able to access the inputs (by checking that Alice’s private key matches the public key she is claiming to own).
Once a transaction is broadcasted to a node, this node then passes it along the network until it reaches a mining node. Miners will then order this transaction into what is called a block template. This is a blueprint for the block which the miner is attempting to add to the blockchain. If a miner finds the next block in the chain, then this block template is mined and becomes an immutable block on the blockchain. Finally, this block is broadcasted to the network’s nodes who will include it in their copy of the chain.
Transaction Fees
Bitcoin users can control how quickly their transactions are processed by setting the fee rate. The higher the fee rate, the faster the transaction will be processed.
Each block in the blockchain can only contain up to 1MB of information. Since space is limited, a limited number of transactions can be included in each block. Miners receive both a block subsidy (newly minted bitcoin) and transaction fees for ordering transactions into blocks. This means they are incentivized to prioritize the transaction with the highest fees. During times of high network congestion, where a large number of users want to transact, the transactions with the highest fees are more likely to be included in the next block.
Types of existing transactions in Bitcoin
I. Coinbase
A coinbase transaction is one that allows miners to generate or activate new coins. With which they can receive the rewards of mining. In the case of Bitcoin, the first transaction made was called a coinbase. And it was not performed from one person to another, but rather that it was performed by the same network as a generating transaction. Through this the entire Bitcoin system was brought to life.
Mining nodes can add only one coinbase transaction for each new block generated. Thus, the system ensures that the miner receives only the reward that corresponds to him and that new coins that have never been inside the blockchain come into circulation.
In the coinbase, the fees of the transactions processed by the miner are also added. So this type of transaction contains the sum of the block mining reward plus the commissions of the processed transactions. It is generally located as the first added transaction within a new block.
II. UTXOs (Unspent Transaction Outputs)
A person's spendable Bitcoins are stored in data records known as "unspent transaction outputs" (UTXOs), and a single UTXO can contain any amount of Bitcoin. Unlike a bank account balance, which is a single amount, a user's Bitcoin balance is like having cash in different drawers throughout the house. The sum of all the money in the drawers is the spendable balance. In the case of Bitcoin, the sum of all UTXOs for a given user is that person's coin balance. The UTXO database resides in a full Bitcoin node on the blockchain.
Either a wallet or a third-party service maintains a database of UTXOs identified by the user's private key. To spend Bitcoin means looking for available UTXOs and selecting denominations that make up the required amount to send to the recipient. Just like paper money, each UTXO is indivisible. Therefore, if UTXO inputs are larger than the amount to be paid, change is made in the form of a new UTXO, the same as buying something for $6 with a $10 bill and getting $4 in change.
The UTXO Database Contains All the Bitcoins
Known as the UTXO set or UTXO database, all the UTXOs on the blockchain represent the total number of Bitcoins in existence. The UTXOs are constantly changing as coins are sent from one user to another.
Transactions Have Inputs and Outputs
Transaction inputs are the UTXOs being used, and transaction outputs are the UTXO payment to the recipient plus any change (see illustration below). The difference between inputs and outputs is the fee, which miners collect for doing the work.
Unlocking and Locking Scripts
A script in the Bitcoin transaction unlocks the input UTXOs by verifying their digital signatures. A locking script sets the conditions for how the output UTXOs can be spent; for example, post dating the payment for 30 days. See digital signature, Bitcoin node, Bitcoin, and blockchain.
Transaction Types
Following are the different ways Bitcoin transactions are formatted.
- Bech32 for Segregated Witness
In 2017, Bitcoin adopted the SegWit protocol, which enabled faster validation, among other enhancements. The SegWit native transaction is Bech32, and bitcoin wallets that support SegWit generally incur lower fees. The Bech32 name was derived from BCH encoding and 32 characters. - P2PK - Pay to Public Key
The first type of Bitcoin transaction is paid to a public key. Subsequent transaction types obscured the public key by hashing it so that future quantum computers cannot generate the private key from the public key. - P2PKH - Pay to a Public Key Hash
P2PKH is the common format that pays to a hashed Bitcoin address. P2WPKH is the SegWit version. - P2SH - Pay to Script Hash
P2SH supports advanced features such as when multiple signatures are required to authorize a payment. P2WSH is the SegWit version. - P2SH (P2WPKH) - Pay to SegWit Public Key Hash
Native SegWit wrapped in a P2SH transaction.
P2TR - Pay to Taproot
In late 2021, Bitcoin adopted the Taproot protocol for more privacy and efficiency.
Advantages of Bitcoin transactions
Rapidity
While making a transaction through the traditional financial system requires hours or even days for approval or denial. In Bitcoin, everything is much faster, easier and cheaper.
It does not require intermediaries to process and approve the operations. Rather, your system is based on a network of interconnected nodes that validate the information contained in the transactions. Making the process much faster, safer and more reliable.
Irreversibility
Once a transaction is made in Bitcoin and is added to the blockchain, it is practically impossible to reverse or modify. Also, cancellations or refunds are not available in this system, after the transaction is made. Which generates a great advantage in various areas of the economy and finance.
Security
Bitcoin transactions are made using public addresses and private keys. Where private keys give you the right to spend bitcoins as if it were a pin or password. And public addresses allow you to send or receive bitcoin transactions without the risk of theft.
Cheaper commissions
The fees paid to miners to process a transaction are really low. This compared to the percentages requested by banks or other traditional systems.
A transaction with bitcoin, regardless of the amount sent, can cost only a few pennies. Since commissions are not calculated based on the amount of the transaction but based on the size of the transaction.
Sovereign Monk
Bitcoin, Privacy & Individual Sovereignty Maximalist | Founder of European Bitcoiners - for Free and Open Bitcoin Education.
follow me :
Related Posts
Personal Server - How to setup and configure
Jun 09, 2024
Nehajte se igrati, začnite se učiti!
Feb 19, 2024
Unpacking Plan ₿ Conference 2023: A Journey with Bitcoin Enthusiasts
Oct 28, 2023