How BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... Transactions Work

This article will give you an in-depth yet easy to understand explanation of what bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transactions are. The explanation below is suitable for new and intermediate bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... users.

If you’re a cryptocurrency user, familiarizing yourself with the way a transaction works is a pretty good idea. Having a better understanding of how everything works can only be beneficial for you, not to mention that some concepts like multi-signature transactions and contracts will be easier to grasp if you first learn how a standard bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transaction works, which are the transactions we usually make.

It’s worth noting that even the core developers consider that the language used to describe how transactions and their components work can often lead to an inaccurate explanation of what’s really going on. In this article, we’ll avoid those misconceptions.

Glossary

Glossary

Before starting we’ll give a small definition to some of the terms used in the article:

BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add...: when written with a capital “B” it refers to the protocol used by the currency

bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add...: this refers to the currency itself, which we send and receive through the BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... network

Tx: It’s the abbreviated term for a BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transaction

Txid: Is the ID of that transaction, this is used both by humans and the protocol when referring to transactions.

Script: is the BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... protocol’s scripting system, what this does is validate every transaction made. This is a stack-based instruction engine that makes the transactions possible, no matter how easy or complex it is.

UTXO: is the abbreviated term used for Unspent Transaction Output.

Satoshi: is the subunit of bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add..., meaning 1BTC = 100,000,000 satoshi.

What is a BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transaction and what is its purpose?

BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transactions are defined as signed pieces of data. These pieces are broadcasted to the network in order to verify their validity and if they are legitimate, they end up inside a block in the blockchain.

 

What’s its purpose?

The point of a BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transaction is transferring ownership of a certain amount of bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... to a BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi....

The outcome

When bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... is sent, your wallet client creates a data structure, which is the BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... transaction. Then, this piece of data is broadcast to the network. After this, the transaction is relayed by the BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... nodes on the network and then the network broadcasts this transaction again, if it’s valid, the nodes add it to the block that’s being mined. Within 10 to 20 minutes, this transaction, along with many others is included in a block in the blockchain. At this point whoever is receiving the transaction will be able to see it in their wallet.

BitCoin transaction

The inputs and outputs of a transaction

BitCoin input and output

There are 4 facts you need to know about transactions:

 

  • BitcoinsIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... are always sent to an addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi..., no matter the amount
  • Every bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... we receive is locked to the receiving addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi..., usually associated with our wallet
  • Any amount of bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... we spend always comes from funds we currently have in our wallet
  • An addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi... receives bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add..., it does not send them. BitcoinsIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... are sent from a wallet.

Different to a physical wallet, every amount received is separate. Here’s a quick example:

You own a wallet and you eventually receive three different amounts of bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... sent, the first of 0.01, second of 0.2 and the third 3BTC, meaning you’d have a balance of 3.21 BTC. However, if you take a look inside your wallet you can see that your balance isn’t exactly shown as 321,000,000 satoshi. Instead, there are three distinct amounts grouped together by their originating transactions.

What this means is that the different bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... amounts received never mix, they remain separated as the exact amounts sent to the wallet. These amounts given in the example above are called outputs of their originating transactions.

BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... wallets will always keep these outputs separate and distinct from each other.

What exactly is an output?

Output is considered any amount sent via a standard transaction to a BitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add... addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi..., with a set of rules attached in order to unlock the output amount. This is also referred as “unspent transaction output” or UTXO.

Standard transaction outputs are unlocked with the private key that is associated with the addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi... receiving the amount. Public and private keys that go along with addresses are an entirely different subject, which we’ll cover in another opportunity. Currently, our only concern is the output amount, so let’s throw in another example:

Bitcoin Wallet

Your wallet now has the previously mentioned balance of 3.21 BTC or 321,000,000 satoshi, and you want to send 15,000,000 satoshi to John, what candidate out of all three outputs would the wallet choose?

As previously mentioned, the wallet does not withdraw 15 million satoshi at random, since the amounts aren’t mixed together. Instead, what the wallet does is pick between one of the three outputs available. As you could guess, the wallet obviously goes for the 0.2 BTC output. Then, the wallet unlocks the output and uses the entire amount of 0.2 BTC as an input to the new 0.15 BTC transaction, meaning that the 0.2 BTC output is “spent” during this process.

Reading this paragraph a couple times is a good idea.

The wallet creates a transaction that sends 0.15 BTC to John, meaning that the balance will now reside in his wallet as an output. The residing 0.5 BTC is then sent back to your wallet through a new addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi..., this is called “change”, and it will now be in your wallet as a new output.

To put it shortly, spending BTC consumes UTXOs and creates new ones, when you sent 0.15 BTC to John, the 0.2 BTC output is destroyed, and in result a new output is made of 0.05 BTC that you receive back in your wallet.

These three outputs in the wallet that are waiting to be spent are locked to their receiving addresses until one or more of them are selected as inputs for a new transaction.

While the focus here has been explaining that every amount received is separate and distinct, it’s also worth noting that the logic rules applied by wallet clients can vary when selecting UTXOs as inputs. The optimal policy would be to use older UTXOs first, but the truth is these implementations differ from wallet to wallet.

Quick summary

Amounts received never mix unlike a physical wallet. Instead, UTXOs are used individually or in groups when we’re spending bitcoinIs the first decentralized digital currency, founded back in 2009 by a man going under the pseudonym Satoshi Nakamoto. Decentralization is one of its many features, because it means it’s not regulated by a third party like a bank or government. Add.... The wallet selects UTXOs according the amount that is going to be sent, creating two new outputs: one for the receiver and one for the sender in the form of change. This in turn creates a new UTXO in our wallet, and the amount sent becomes locked to the addressAlso referred to as a public key. An address is a string of letters and numbers corresponding to a bitcoin wallet, this is where bitcoins are sent to when a transaction is made. However, to access the bitcoins received, a private key is required, whi... of the receiver. The original input used for the transaction is considered “spent” and is destroyed.

Sponsored Links