What are Bitcoin Transactions?

Created On 06. Nov 2020

Updated: 2021-05-02 00:04:42.268905000 +0000

Created By: acidghost

Transactions are the essential part in a crypto system. They are the public entries in the blockchain. In the bitcoin network the transaction output are the indivisible chunks of currency recognized by the whole ledger.
For each of the transactions, a user can enter either an address, a transaction hash, a block number or block hash to see details about the corresponding transactions.
Such information can be looked up on more sites including:

• Bitcoin Block Explorer https://blockexplorer.com/
• BlockCypher Explorer https://live.blockcypher.com/
• blockchain.info https://blockchain.info/
• BitPay Insight https://insight.bitpay.com/

In summary, transactions move value from transaction inputs to transaction outputs.An input is a reference to a previous transaction’s output, showing where the value is coming from. A transaction output directs a specific value to a new owner’s bitcoin address and can include a change output back to the original owner. Outputs from one transaction can be used as inputs in a new transaction, thus creating a chain of ownership as the value is moved from owner to owner.

UTXO also known as unspent transaction outputs are the available and spendable outputs. When you see the balance on your wallet, that’s the sum of all UTXO that the wallet can spend. Bitcoin can be divided down to eight decimals that are called satoshis, though there are also indivisible arbitrary values. These are the outputs which once created are not divisible anymore and can be spent entirely by a transaction. UTXO will produce two outputs: the amount you pay and the one that is changed back to the wallet.

There is one exception, the coinbase transaction. This transaction is a reward to the miner who created the new block and it’s the first one in each of them. This doesn’t consume any UTXO and has more uses which will be mentioned in other posts.

Run a request with curl like this to check the unspent transactions on my address:
$ curl https://blockchain.info/unspent?active=1PGcghFoCKYJHSLf2pRjw2qVj5FxKLgcys
You should see something like:


The unspent output shows the amount that has not been redeemed yet.
Data on a transaction will have fields that contain the transaction ID, the output index, a scriptSig that unlocks the transaction under certain conditions placed on UTXO and sequence.

Since a transaction references the one that was executed before, we can see this reference while looking up for the transaction details. This information allows the wallet to construct further transaction to be sent to new owner addresses.

See transaction ID here under Hash (txid)
and the unlocking script attached to the address
OP_DUP OP_HASH160 f446cb63ba1b6687b0fe6ba25018f418f3a5a37c OP_EQUALVERIFY OP_CHECKSIG

When developing one of such applications, it is required to get the reference of UTXO in the inputs to know the values of inputs and locking conditions. Further, if you want to count fees, it is required to get the sum of values of inputs and outputs that span across different transactions.

Fees serve as incentive to include a transaction into the next block and disincentive as against the abuse of the system with small fees per transaction. The fees are calculated differently, and Bitcoin nodes can override the default fee relay policy by adjusting the value
of minrelaytxfee.

Many wallets use different 3rd party apps for calculating fees and this service shows the fees in satoshis for different priorities http://bitcoinfees.21.co. To get a confirmation of the fee estimate for different transaction speeds, you can just run a request with curl like this:
$ curl https://bitcoinfees.21.co/api/v1/fees/recommended


Note that static fees are a very bad idea and the fees will be “stuck”.

Section: Blockchain