8. What Is A Virtual Machine (Basic Introduction)
The Ethereum Virtual Machine
In order to develop NFT Smart Contracts we compile down to a Virtual Machine which acts as a layer of abstraction.
Virtual machines are essentially creating a level of abstraction btw the executing code and the executing machine.
This layer is needed to improve the portability of software, as well as to make sure applications are separated from each other, and separated from their host.
9. What Are Smart Contracts - Ethereum & Solidity
Smart Contracts
Smart contracts are actually the code, which consists of the terms and agreements that build our NFTs.
Smart contracts ar written in a programming language called "Solidity", a language similar to Javascript and C++. Solidity is the most widely used language for building smart contracts.
There are other languages for writing smart contracts like Vyper and Bamboo. Before Solidity was released, other languages llike Serpent and Mutan were used which are now deprecated.
10. Optional - Advanced - Introduction to Opcodes for the EVM
Smart contract languages like Solidity cannot be executed by the EVM directly. Instead, they are compiled to low-level machine instructions called opcodes).
사실 당연한 소리다. 우리가 사용하는 모든 high-level programming language는 compiler나 interpreter를 이용해서 low-level language로 번역되어 실행된다. 그게 EVM에서 어떻게 동작하는 지 자세히 알고 싶다면 위의 문서를 참고하라고 한다. 지금 당장은 필요가 없는 내용이겠지만, 알아둘 가치가 분명 있다고 한다.
11. How Contract Storage Works With Ethereum Smart Contracts
Lower-level programming languages often use a stack to pass values to functions.
The EVM uses a 256-bit register stack from which the most recent 16 items can be accessed or manipulated at once. In total, the stack can only hold 1024 items.
Because of these limitations, complicated opcodes instead use contract memory to retrieve or pass data.
Contract storage essentially acts as a public database, from which values can be read extremely without having to send a transaction to the contract(no fees!).
However, writing to storage is very expensive (as much as 6000x) compared to writing to memory.
12. Optional - Advanced - Opcodes Allow The EVM To Compute Almost Anything
EVM uses a set of instructions called opcodes to execute specific tasks.
There are over 100 opcoes more, maybe closer to 200.
This means the EVM is able to compute almost anything given enough resources because opcodes are one byte and there could only be a maximum of 256. But that is more than enough.
13. Review - What Is The EVM
- Smart contract languages like Solidity cannot be executed by the EVM directly. Instead, they are compiled to low-level machine instructions called opcodes).
- Smart contracts interact with the EVM which is more expensive than running programs on traditional servers however provide for a more decentralized approach to developing Applications.
- In order to develop NFT Smart contracts we compile down to a Virtual Machine which acts as a layer of abstraction Virtual machines are essentially creating a level of abstraction btw the executing code and the executing machine.
- This layer is needed to improove the portability of software, as well as make sure applications are separated from each other, and separated from their host.