How do cryptocurrency transactions work?
Introduction to crypto transactions
Cryptocurrency is a purely digital form of value, free from the control of any single person, company or government.
Unlike traditional currencies, where your digital account balance can be redeemed for physical notes, cryptocurrency transactions are simply data entries recorded on an unchangeable, distributed ledger, referred to as a blockchain.
On popular blockchains like Bitcoin, Ethereum and Algorand, no cryptocurrency is actually exchanged between people. Instead, ownership data associated with both parties' crypto wallets is updated on the blockchain each time a transaction is processed.
Blockchain technology allows these types of transactions to be proposed, processed and recorded by a global network of volunteers – called “nodes.” These computers work together to unanimously ensure only valid transactions are completed and immutably stored on the ledger.
What do you need to send a crypto transaction?
Before looking at the step-by-step process of how a crypto transaction is created, broadcast, verified and processed, it’s important to understand the individual elements involved in making these types of peer-to-peer transactions possible.
Three core components are required to complete a crypto payment:
- Cryptocurrency wallet
- Blockchain network
- Cryptocurrency to pay for the blockchain transaction/gas fee
Crypto wallets can be broadly classified as either being a hot wallet or cold wallet, depending on whether they’re permanently connected to the internet or not.
Hot wallets are software downloaded onto desktop computers, cell phones or other smart devices. These are constantly connected to the internet and allow users to quickly receive and transfer funds.
Cold wallets are hardware devices like specialized USB sticks that have to be manually connected to a smart device to make or receive transfers. Unlike hot wallets, cold wallets do not maintain a constant connection to the internet. While many feel cold wallets are less convenient to use than hot wallets, they are seen to be significantly more secure.
Unlike the paper bills in your cash wallets, cryptocurrency is not actually stored in a crypto wallet.
Cryptocurrency holdings are recorded on the blockchain, and access to those funds is controlled using a wallet. A crypto wallet stores the addresses that are used to interact with its allocated funds on the blockchain. If the keys are lost, access to any funds associated with the wallet is also lost.
Each crypto wallet has its own unique public and private key. Keys are an essential part of a crypto wallet and are used to:
- Prove who owns funds on the blockchain
- Digitally sign and approve outbound transactions
- Create public-facing wallet addresses
How are public and private keys created?
Using a type of one-way cryptographic formula, public and private wallet keys are mathematically linked. The private key is used to create the public key. Elliptic Curve cryptography (ECC) is one of the main public-key cryptography methods used to generate keys for crypto wallets, including all Bitcoin wallets.
If you are interested in learning more, you can check out Kraken Learn Center’s article How do cryptocurrencies use cryptography?
What makes these keys secure is that only the person holding the private key can create the public key and prove ownership of the funds associated with the wallet. Cryptography makes it virtually impossible to decipher what the private key is from the public key.
Here’s an example to visualize this concept. Imagine having a one million digit number. From this one million digit number, you have to identify a specific pair of two numbers that were added together to form this number. Because of all the possible solutions to this problem, finding the right combination would take a huge amount of trial and error.
However, once the solution is found, it is easy for anyone else in the world to verify for themselves that you found the right answer. After all, it would just be a matter of adding the numbers together and checking that it matched the million digit number.
This difficulty in finding a solution, but ease of checking the solution once it was found, is at the heart of crypto transactions. This use of cryptography is what allows crypto transactions to operate — reliably, securely and cost-efficiently.
ECC takes this even further, using a complex system of lines intersecting through a special type of curve on a graph. Each time it crosses through the curve, the line changes course perpendicularly, and so on. The public key, in this case, is the first and last points the line crosses after a secret number of times.
The private key, in this case, is the secret number of moves taken to get from point A to the final point on the curve.
How is a crypto wallet address created?
Beyond the public and private keys is the crypto wallet address.
This is created by taking the public key (which, in turn, was created from the private key) and running it through a cryptographic hashing algorithm. This is another type of one-way mathematical algorithm that takes any input and turns it into a random fixed-length string of alphanumeric code called a “hash.”
Hash codes are said to be “unique” and “deterministic.” This means that each input creates a totally unique hash code that is exactly the same value each time it’s run through the algorithm.
Much like public and private keys, it’s impossible to view a hash and know what input created it.
This hash, which serves as a crypto wallet address, is what people share to receive inbound cryptocurrency transactions.
Where are private and public keys stored?
Hot wallets store their keys online within the wallet software itself.
While it has the benefit of allowing users to seamlessly send and receive transactions at will, it also makes them vulnerable to attack from cyber criminals.
A cold wallet’s private and public keys are stored offline within the physical device.
This makes online attacks of cold wallets nearly impossible. However, the tradeoff is that each time a user wishes to make a transfer, they have to connect their cold wallet to a computer or smart device.
For long-term holders that trade infrequently, this isn’t so much of a problem. However, for more active traders, who often transfer funds between different addresses may find this level of added security to be an inconvenience.
If you want to learn more about the different advantages and disadvantages of crypto storage methods, check out the Kraken Learn Center article How to keep crypto safe.
How are transactions processed on a blockchain network?
A blockchain is a type of distributed ledger technology. In short, a blockchain is a system for recording data that is managed and maintained by an open community rather than single authority.
Anyone in the world can participate in running a public blockchain network, provided they have access to the internet and a smart device. Most blockchain networks take steps to “decentralize” platforms by taking steps to ensure that no single person or central authority can take control of the blockchain’s ledger.
People who voluntarily dedicate time to becoming active participants in a blockchain network are known as “nodes.” Nodes can perform a variety of tasks, from maintaining a full transaction history to performing the all-important task of data validation.
What is a blockchain?
A blockchain can be thought of as a virtual string of boxes (or “blocks”), where each box contains an amount of data. For cryptocurrency networks, the data in these boxes is mostly transaction information – who has transferred what, to who and at what time.
As new transactions are broadcast to the network, new blocks must be created, filled with the new data, verified and added to the chain.
All blocks added to the blockchain are permanent and immutable, meaning it’s impossible to go back and change the information stored in the finished block. This is why the role of data validation is so important. Any transaction data must be unanimously verified by all nodes in the network to make sure that only valid transactions are processed.
Because there is no single authority managing the network, an automated system is used to ensure all nodes are in agreement on new data being committed to the blockchain. This system, known as mining on blockchain networks like Bitcoin, is designed to deter malicious agents from corrupting the network with invalid transactions.
This system is known as a consensus mechanism.
While different blockchains use different types of consensus mechanisms, they all seek to achieve this same goal — maintaining accurate information regarding ownership and transactions.
Proof-of-work and proof-of-stake are the most common systems used in cryptocurrency.
To compensate nodes for their effort, all crypto users are required to pay a transaction fee to have their payments processed, sometimes known as a gas fee.
This covers the computational costs associated with running a node and financially incentivizes them to continue operating on the network.
Fees can vary depending on the blockchain, as well as how congested the network is at the time.
In some cases, users can attach a tip on top of the transaction fee to encourage validators to prioritize their payments ahead of others in the queue.
Putting it all together: How a crypto transaction works
Now that it’s clear what components make up the crypto transaction process, let’s look at how a payment works from start to finish.
Crypto transaction creation and signing
It’s also worth noting that almost all of the steps listed below are carried out automatically by the underlying code of the Bitcoin protocol and network nodes. All the Bitcoin user needs to do is enter the amount of crypto they wish to send, copy and paste the recipient’s public wallet address, and hit send.
The process of sending a transactions consists of three phases:
Below is an example of the various steps that take place on the Bitcoin blockchain. This process is what allows bitcoin to operate as a peer-to-peer electronic cash system.
Let’s assume Ben already went through the process to buy bitcoin and now wants to send Olivia 1 bitcoin (BTC). Remember, Ben can send smaller units of bitcoin called satoshis, but we will use a full bitcoin for simplicity.
- Olivia sends Ben her public wallet address.
- Ben takes Olivia’s public wallet address and creates a transaction message that contains information about the intended transaction (where Ben’s one bitcoin came from, where it’s going, how much change should be returned to Ben in the form of UTXO and what the attached fee amount is).
- This transaction message is run through a cryptographic hashing algorithm to reduce it to a fixed-length unique code.
- Ben encrypts the resulting hash code with his private key to create a digital signature for the transaction. In doing so, Ben proves to Olivia and the blockchain network that he sent the transaction and that it hasn’t been tampered with in transit.
- Ben sends Olivia the original transaction message and the digital signature.
- Olivia decrypts the digital signature using Ben’s public key, revealing the hash of the transaction message.
- Olivia then runs the original transaction message through the same cryptographic hashing algorithm to produce a hash, and compares it with the revealed hash value in the above step.
- The two hashes should be identical, proving that Ben sent the transaction and it was not corrupted in transit. Any change in transaction details would result in an entirely different hash and show the network that someone has attempted to tamper with the transaction.
Now that Olivia has been able to verify that the transaction sent from Ben is valid, it must now be broadcast to the network so that all nodes can verify this information.
- The transaction message and digital signature are sent to up to eight nodes initially. Each node then relays that information to up to seven other nodes in the network.
- This continues until every node in the blockchain network receives and independently verifies the transaction.
- Once verified by all nodes in the network, pending/unconfirmed transactions are stored in something called a mempool – short for memory pool.
Depending on the type of consensus mechanism used by the underlying blockchain, a single validator node is selected to propose a new block filled with transactions from the mempool.
For proof-of-work validators, once a successful validator is selected from the mining process, other nodes in the network must first attest to them winning the hashing competition before they can propose a new block. If you want to learn more about this process, you can check out the Kraken Learn Center article What is Bitcoin mining?
Once the block containing Ben’s transaction to Olivia is added to the blockchain, it will be regarded as a singularly confirmed transaction. For every block that’s added to the blockchain after this block, Ben’s transaction will gain additional confirmations. Additional rounds of confirmations help to increase the certainty of the transaction’s accuracy on the network.
While some crypto wallets will consider a transaction successful after a single confirmation, other wallets – like Bitcoin wallets – will typically require up to six confirmations. With a bitcoin block time of one block per ten minutes, six confirmations can take around an hour to reach full settlement.
Get started with Kraken
Now that you have learned how cryptocurrency transactions work, are you ready to take the next step in your crypto journey?
Click the button below to create your account and buy crypto on Kraken today!