Blog V - Part II - Day 17
Hey People, I have given a gist of how the EVM stores the smart contracts on its machine.
In this I will directly discuss some technical things about, how deep you can dive into using just the information told about in the previoud micro-blog. Will try to give a glimpse, rest you can think of autonomously.
Let's do it...
In this micro-blog
- Ethereum Virtual Machine (EVM)
- The two Properties of EVM
- How the Smart Contracts are actually stored?
- Some supplementaries
- These trail of Digits have some meaning
- How can the attackers mis-use it?
I would suggest to open up following things in other tabs, would help you people throughout:
- Ethereum Virtual Machine OPCODES
- A Matrix of all kind of Gas Costs
- All Transaction Properties of Solidity
- EVMDIS Disassembler
These trail of Digits have some meaning
I will keep this explanation as vague as possible, as we have some people onboard who have excitement about the blockchain, despite their core interests and Fields.
You know right, EVM is a Stack based machine, as
2 + 2 is actually written as
2 2 +, postfix notation.
If you break this "strange series of digits", 608060405234801561001057600080fd5b5060016000819055506......
according to as shown in ethervm.io tab.
EVM is a stack-based machine and for actions to happend on this machine, these trails are converted into the OPCODES.
Each OPCODE has a size of 1 byte. EVM has a set of 140 OPCODES in total
If you are wondering how can you find the contract with that data? Well...just try copying pasting the following BYTECODE, and decompile in the ethervm.io/decompile, you'll find the same contract as was written in the previoud micro-blog
How can the attackers mis-use it?
The level of publicity, Blockchain provides, any user can directly use the address of the contract deployed, to instatiate a variable of that, contract and call its various function.
This is not small, this can let the potential attackers exploit the contract and cause big-attacks like, DAO-Reentrancy attack, or DDoS Gas attack, explained in the previous blogs.
As I have told, these work as the fill in the blanks, the vacant spaces within the Bytecode are initiated by 0 , which is then replaced by the hexadec code of the input.
This contract is again deployed to replace the existing one, changing the current state of the contract.
The Internal checks verifies whether you are the authorised one to make a certain check or not.
IG, This concept is heavily used in off-chains, as well.