(1/n) Ethereum, while being an extremely versatile blockchain, still has significant usability constraints.
Ethereum has trouble with scaling, that is, handling an increasing number of transactions.
And there have been some remarkable scaling solutions to alleviate this.
👇🧵
(2/n) The current Ethereum version has low transaction throughput and high latency in processing.
This means that transactions are both slow and prohibitively expensive. 🐢 💸
There are two general types of scaling solutions proposed for the above issues
On-chain and Off-chain
(3/n) On-chain scaling refers to any direct modification made to a blockchain, like data sharding and execution sharding in the incoming version of Ethereum 2.0.
Another type of on-chain scaling would be a sidechain with two-way bridge to Ethereum, like Polygon.
(4/n) Off-chain scaling refers to any innovation outside of a blockchain, i.e. execution of transaction bytecode happens externally instead of on Ethereum.
These solutions are called L2, because layer 2 works above layer 1 (Ethereum) to optimize and speed up processing...
(5/n)...Arbitrum and Optimism Ethereum are two well-known examples of L2 scaling solutions.
Currently, we can distinguish between two leading L2 solutions as:
• Zero-Knowledge (zk) rollups, and
•Optimistic rollups
How do the rollups work?
(6/n) Instead of executing and storing all the data on Ethereum, where transactions are only processed at a premium, we decide to only store a summary of the L2 state on Ethereum.
Actual computation and storage of the contract is done on its execution Layer 2.
(7/n) In this way, rollups can inherit Ethereum’s security guarantees, while still acting as an efficient scaling solution.
There are two flavours of rollups
• zk-rollups
• optimistic rollups
(8/n) zk-rollups bundle together many off-chain transactions into a single verifiable batch using zk-SNARK.
zk-SNARK is zero-knowledge proof that allows one party to prove it possesses certain information without revealing that information. These proofs are then stored on Layer1
(9/n) Optimistic rollups also batch together off-chain transactions into batches (rolls them), but they do not contain additional proof guaranteeing its validity.
These rollups “optimistically’’ assume all transactions are valid.
(10/n) When assertions of the L2 state are posted on-chain, validators of the rollup can challenge the assertion when they think someone has posted an incorrect or malicious state.
This is called “fraud detection”.
In another thread I will explain various solutions to the above, like Arbitrum, Optimism or Polygon.
If you liked this thread, please comment if there is something you would like me to clarify.
Otherwise, I can only ask for like and retweet! 🙏✨🚀
Function in itself is safe but there are two scenario where ERC20 approve() shows its rough edges.
First is a front-running attack on approve().
Imagine following scenario 👇
2/ * Alice approves Bob for 20 Tokens
* After some time, Alice changes approve to 10
* Bob front-runs the Alice TX for approve(10)
* Bob spends 20 Tokens
* Alice TX passes
* Bob spends additional 10 Tokens from Alice.
Why is that?
3/ Attack is also possible because approve() overrides current allowance.
It doesn’t increase/decrease allowance in atomic manner.
How can we limit against that?
There are two approaches to limit the attack vector.
Currently many of the Chinese provinces where Bitcoin miners resided, rolled out new policies restricting or banning the #BTC miners.
Inner Mongolia, Xinjiang, Yunnan and Sichuan banned Bitcoin.
2/ Energy companies were told to stop providing energy to crypto miners due to them using too much electricity.
It became an illegal activity to mine cryptocurrencies. If someone would be found to do so regardless, they would be added to the blacklist of social credit system.
3/ All decision seems to be linked mainly with Energy usage.
China plans to achieve carbon neutrality by 2060 and reducing carbon intensity or the amount of carbon emitted per unit of GDP, by more than 65% by 2030.