When we talk about 鈥榯ransactions鈥 on a public blockchain network, we鈥檙e usually talking about interactions between two addresses: in other words, tokens, be they fungible or non, or other crypto-assets being 鈥榮ent鈥 from one address to another. There are also 鈥渋nternal transactions鈥, which are interactions that occur between smart contracts, and for the most part fall outside of the scope of this article.
For more on blockchain networks and how they work in general, check out our intro article here, and if you get stuck on any unfamiliar words, our glossary is always available.
For clarity鈥檚 sake, nothing is actually being sent anywhere. A smart contract-enabled blockchain network like Ethereum has a number of different components, but the 鈥榖ackbone鈥 of the system is a distributed ledger. What鈥檚 that? Imagine a spreadsheet that contains, on one side, every single Ethereum wallet address, and each one of those addresses has a column for each type of crypto-asset that it holds.聽
Let鈥檚 use an example for illustration. Say that Guillaume wants to send a transaction to Dolores. Guillaume has 1.36 ETH in his account, and he plans on sending Dolores 0.5 ETH. Sounds like a good day for Dolores.聽
Guillaume opens up his MetaMask wallet, enters Dolores鈥 address, configures the gas parameters that he鈥檚 comfortable with paying, and hits 鈥榮end鈥.
At this point, the transaction enters a local temporary holding status, known as the local memory pool, or local mempool. The transaction will then get 鈥榩icked up鈥 by the closest node in the network. Depending on Guillaume鈥檚 gas settings, his transaction will be prioritized (the more Guillaume is willing to pay per unit of gas, the faster his transaction will be processed), and propagated to other nodes in the network. The nodes will do the work of verifying that Guillaume has the ETH to spend, and then will actually perform the 鈥榯ransaction鈥: the ledger will be modified; 0.5 will be debited from Guillaume鈥檚 balance, and 0.5 will be credited to Dolores鈥.聽
鈥楾he moving hand, having writ, moves on鈥: ETH didn鈥檛 move through a network per se; it wasn鈥檛 an email sent from Guillaume鈥檚 computer to Dolores鈥 MetaMask inbox or anything of the sort. Guillaume sent a request, authenticated by his private keys through MetaMask, to the network to debit his account and credit Dolores鈥, and after the verification process programmed into the network鈥檚 protocols, this was done.聽
That鈥檚 all there is to a transaction: a request to the ledger to reallocate something from one address to another.
When things go wrong
Things can go wrong for a number of reasons. Often, they鈥檙e 鈥榮oftware in nature鈥: MetaMask has a bug, or something was misconfigured regarding the network you鈥檙e trying to use; there was a connectivity error.
A common issue is that the user, in an attempt to pay less for their transaction, sets a very low gas limit, and network conditions are so congested that there isn鈥檛 space in any blocks for such a 鈥渃heap鈥 transaction, sometimes for a very long time: eventually, this transaction will become 鈥渟tale鈥 and will have to be canceled by the user.聽
If you鈥檝e sent a transaction and it hasn鈥檛 been finalized, its status will be shown as 鈥減ending鈥 in MetaMask.聽
If you sent a transaction, and it failed, the most likely cause is a lack of gas: you 鈥渞an out of gas鈥, in other words, the transaction had a cost in gas that, when multiplied by the gas price, resulted in a total amount of the network鈥檚 native currency that was greater than what you had in your wallet.聽
For more on calculating gas, consult our gas guide here.
This can happen for a number of reasons, but one thing to consider is what the transaction is that you鈥檙e trying to carry out. Minting an NFT during peak network traffic times can be very gas-intensive; if you鈥檙e trying out a new or experimental transaction, it may be worth trying on a test network before paying real live network fees.
Another common problem is when users go too far in the other direction. In an attempt to save as much money on gas as possible, they configure a custom amount of gas that is so low that the transaction never gets picked up and included in a block. It will stay, pending, for a number of days in this state, until it is considered 鈥渟tale鈥 and is 鈥渞everted鈥, which means the network considers it never to have happened: the transaction failed.
If you鈥檝e run into one of these issues, take a look at the Knowledge Base version of this article for next steps.
Your mind on your tokens, and your tokens on your mind
If it helps you to use the mental model of a transaction moving a balance from one wallet to another, then by all means, keep at it鈥攐n a day-to-day basis, this is what your experience will be like, and as the UX engineers of Web3 keep doing their jobs, it should become more and more seamless. But keep that ledger in the back of your mind for when things get complicated.
And keep an eye on this space鈥攕oon we鈥檒l have a piece from another member of the team, breaking down some of the most common crypto scams.