Web3 Learning Journey (Day 5)

Continued work on job board, added pagination and forms. As for uniswap not much further progress. Finished chap 13 of Mastering Ethereum book. It breifly talked about EVM architecture and Ethereum world state and its constituent EOA state and contract state. And how each non transfer transactions are handled by EVM is a recursive process where new EVM are instantiated which updates the state of ethereum from state 'Q' to state 'Q+1', if and only if the transaction has been successfully executed. John Mckinney video has a detail visualization of same stuff.

Then, the chapter went a bit into opcodes. Having background in CS especially in microprocessor helped a lot in OP code and stack based opcode execution of EVM. Still lots of opcodes to process, will take some time to grasp all of those. Then, came classic halting problem as to why bitcoin is turing incomplete and Ethereum is in a loose sense quasi turing complete. Also found out Ethereum went to a hard fork in 2016 due to result of exploitation of mispriced gas for an opcode which almost d'dosed the whole network.

Here's a brief explanation on how gas works in EVM. Gas represents the amount of computation and storage used while processing an instruction. To prevent ddos of the ethereum blockchain, every instruction is specified a certain gas according to their computational complexity. Eg: ADD opcode has lower gas than MUL which is computationaly more demanding. Every time a transaction is sent along with gas limit for that transaction --> Gas is computed for each transaction executed which is reduced from gas limit --> If the gas limit is breached the transaction fails and is reverted but the consumed gas equivalent ether is distributed to miner for their time and resource --> Else if the transaction succeeds the amount of gas used equivalent ether is distributed to miner as transaction fee and the amount of gas obtained by subtracting computed gas - gas limit , equivalent ether is refunded back to the caller.