Discover more from Web3 Bits and Bytes
Web3 Glossary - OPQ of Web3
Understand PoW, PoS, on chain vs off chain and reason why your crypto txns are queued
Somebody today was explaining me how the cryptocurrency market was changing, even though I already knew, it was a bit coin descending 😅
Jokes apart, it’s been a week since I started this newsletter. Thankyou for reading and supporting 💜💜
It has been quite a journey so far. Loved all the feedback ya’ll sent across and it’s been a great leaning journey in making web3 simpler for everyone.
Let's get to learning some web3 terms. Shall we?🖖
Here’s what I got for you today👇
👉O: On chain, Off chain
👉P: PoS, PoW
👉Q: Queued transactions
Blockchains process numerous transactions every minute. Do all transactions happen on chain? Do we have off chain transactions? Today’s all about transactions dynamics!🤩
Think of a blockchain as a cloud storage facility, which has two parts - private and public. 👇
On-chain transactions are like the public cloud - visible to all
Off-chain transactions are like the private cloud- the data is not publicly accessible.
Let’s take this analogy and delve deeper.👇👇
On-chain = any transaction or data that is available on the blockchain and visible to all nodes on the network such as mempool data, historical transactions, and account information
Therefore, every time an on-chain transaction occurs, it leads to an update of the overall blockchain network
Ideally these transaction should happen in real time
It takes time for miners to validate the transactions & add to the blockchain ledger.
It’s a time consuming process & as the transaction volume increases, networks gets congested & hence the time taken to add the transaction to ledger also increases
Subsequently, the transaction fees also increases.
Thats where Off chain txns come in
Diggin' this web3 gyaan? Subscribe for free and support my work!
Off-chain is any transaction or data that exists outside the blockchain.
Committing every transaction on-chain can be expensive and inefficient!
What do we do?🤔
Leverage third-party tools like oracles that handle pricing data, or layer 2 solutions that execute a higher throughput of transactions, handle the bulk of the processing work off-chain, and submit information on-chain at less frequent intervals.🚀💯
eg Chainlink , Lightning
📌The Lightning Network is a layer-2 protocol - it speeds up the transaction and reduces the fees. Here’s how it works:👀
It creates a channel between two transacting parties. Once this channel is established, both parties can instantly send crypto to one another at minimal costs
These transactions aren't transmitted to the chain. Once the parties conclude their transactions, the channel is closed. Final amounts are sent to the participating parties as per the transfer history recorded on the channel - this is the only transaction stored on the blockchain
This data consolidation bundles many small transactions into one single set & makes it easier for the nodes to process. If payment channels are removed, these small transactions could hold back high-value transactions & congest the network.
hence layer-2 solutions are the future
In such a dynamically changing status of the blockchain, we need an efficient,fair, real-time & secure mechanism to ensure that all the txns on the network are genuine and all participants agree on a consensus on the status of the ledger. We’ve learnt quite a lot of new things about blockchains, but have you thought how a decentralised network ensures this?
Consensus mechanism does that job for us
It’s a set of rules that decides on the legitimacy of contributions made by the various participants of the blockchain.
There are 2 kinds of consensus mechanisms
📌PoW: Proof of Work
📌PoS: Proof of Stake
PoW requires a participant node to prove that the work done and submitted by them, qualifies them to receive the right to add new transactions to the blockchain.
Think of it as submitting those assignments and giving end semester exams in college as a proof of your work that you have learnt the subject and can be promoted to next year.
PoW ensures the integrity of new data as it requires members of network to expend effort in solving an arbitrary mathematical puzzle to prevent anybody from gaming the system.
However, it’s not that simple. This computation leads to high energy consumption and a longer processing time.🧐
But, where there’s a problem, there’s a solution💯
PoS evolved as a low-cost & low-energy consuming alternative to the PoW model
It delegates control of the network to owners of the token and allocates responsibility of maintaining the public ledger to participant node in proportion to the no of virtual currency tokens held by it.
Let’s scratch the surface🧐
In the PoS model, stakers (same as miners in PoW) lock up funds in a special smart contract. Every time a new block is needed by the network, an algorithm grants a specific staker the opportunity to publish the next block. 👇👇
The algorithm selects the staker via lottery, depending on each staker’s percentage of total staked funds.
For e.g., if a single staker controls 25% of all funds staked on a given network, they have a 25% chance of mining the next block.
Do you see a problem here?🧐
PoS has a stronger tendency to centralize and concentrate token ownership to large holders & hence its security guarantees are weaker than PoW. PoS model has governance problems and is more vulnerability to attacks
Let me break it down with another example
Say we have a PoS network worth $50 bn where 10% of tokens are staked. The $100 bn network can be taken over by any party that is able to allocate $5 bn
All the attacker would have to do is send $5 bn in tokens to a staking contract. While the same would be fairly difficult for PoW models.
Coz it would require purchasing ASICs, acquiring space and energy contracts to mine at a scale larger than the entire network and if such an attack were underway entire network would likely be made aware beforehand by the immense demand for ASICs and electricity.
Essentially, both PoS and PoW have their fair share of pros and cons. We also have other consensus mechanisms like PoH (by Solana ), PoC, PoA and PoB.
Let me know in the comments if you’d like to know more about these👀🚀
Now coming to the impounding question
Why is my transaction queued? 🤔
If you’ve found yourself pulling your hair out when a transaction seemingly pauses forever, read on 🤯
Is it pending or queued? Let’s get some clarity, shall we?👇👇
Transactions submitted to a network through an EVM node can have one
of the two following statuses before they are sent through to the network
and included in a block:
What’s really the difference though?
👉Pending transactions are the ones in the transaction pool that are ready to be included in a block.
👉Queued transactions are the ones waiting to become the pending transactions.
Where does this queue put up though?
The queued pool👇👇
It’s a pool of txns in the mempool that are not yet ready to be processed because they are out of order
Out of order? What does it imply?
Every txn has an account nonce (not block nonce). Every time an account does a txn, the account nonce of the transaction is incremented by 1
If a txn is sent with a nonce that is higher than the current txn count for the sender’s account (creating a gap in the nonces), then the txn will be added to the node’s local transaction pool with a queued state.
An example would help👇👇
📍Say an account 0x463.. creates a txn for the first time. The txn gets the account nonce 0. The transaction goes directly into the pending pool and is eventually added to the block.
📍The next transaction from account 0x463... is automatically incremented by 1 and gets the acct nonce 1. The transaction goes directly into the pending pool and is eventually processed. Say account 0x463... creates a 3rd txn & manually sets the transaction's account nonce to 3, the txn will get the status queued coz there’s no txn with the account nonce 2. 👇👇
📍The queued txn will not be propagated to the network until there is a txn with the account nonce in sequence.
How to fix it?🤔
📌Fill the gap
Once account 0x463... creates a valid txn with account nonce 2, the queued transaction gets unclogged and is added to a block.
📌Send a rescue transaction
To effectively cancel a queued transaction, send another txn from the same acct with the same nonce, but a gasPrice that is at least 10% higher than the gasPrice of the original txn.
You could send 0ETH with fromAccount=toAccount so that the only cost of the transaction is its gas. Nonce ordering is only one of the reasons why your transaction is pending, there could be other reasons like, sending a very small amount with insufficient fees, high n/w volume to count a few.
That’s a wrap for today!
Stay tuned for more on the new vocabulary of the web for next 30 days.💯
It’s a free crash course on the jargons and terminologies in Web3 direct to your email
As ever, thank you for subscribing and reading. It matters. It’s a big deal to me.
And, remember, half-true compliments and feedbacks are always welcome at:
laisha.wadh [at] gmail [dot] com