Lädt...


🔧 Intro to EVM


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

This week we decided to deep dive into EVM (Ethereum virtual machine) . But before that let us know why to deep dive into EVM.

1. Understanding Smart Contracts:

The EVM is where smart contracts (self-executing programs on the blockchain) are deployed and executed. If you want to write, deploy, or interact with smart contracts, understanding how the EVM processes and executes these contracts is crucial.

2. Building Decentralized Applications (dApps):

Ethereum is one of the most popular platforms for building decentralized applications. To develop a dApp, you need to know how your code interacts with the EVM, as it determines how your contracts will execute, use gas, and handle data.

3. Gas Fees and Efficiency:

The EVM charges gas fees for every operation (computation or storage). Learning about the EVM helps you optimize your smart contract code to be more efficient, minimizing gas usage and making your application cheaper to run.

4. Security and Vulnerabilities:

Many smart contract hacks and exploits happen due to developers not fully understanding how the EVM works. Learning the EVM helps you write secure code by avoiding common pitfalls like reentrancy attacks, integer overflows, or issues with how state is stored and managed on-chain.

5. Cross-Chain Compatibility:

The EVM has become a de facto standard for many other blockchain networks like Binance Smart Chain, Polygon, Avalanche, and Fantom. Understanding the EVM can open doors to working with various EVM-compatible blockchains beyond Ethereum.

6. Career Opportunities:

Blockchain development is a growing field, and Ethereum is the second-largest blockchain by market capitalization. Mastering EVM-based development increases your marketability as a blockchain developer and opens up numerous career opportunities in DeFi, NFTs, gaming, and other blockchain-based industries.

7. Token Standards (e.g., ERC-20, ERC-721):

Many Ethereum token standards, such as ERC-20 (for fungible tokens) and ERC-721 (for NFTs), rely on the EVM. Understanding how these tokens work under the hood requires knowledge of the EVM’s mechanics.

8. Blockchain Scaling Solutions:

Understanding how the EVM works helps you comprehend the challenges Ethereum faces (e.g., scalability, gas costs) and how Layer 2 solutions like rollups (Optimistic or ZK) aim to solve them by extending the EVM's capabilities off-chain.

9. Upgrades and Future Development:

Ethereum is constantly evolving, with upgrades like Ethereum 2.0 (the transition to Proof of Stake) and other scaling solutions. Understanding the EVM makes it easier to follow and adapt to these changes, ensuring your knowledge stays relevant as the platform develops.

10. Interoperability with Web3 Ecosystem:

Ethereum’s EVM is integral to the broader Web3 ecosystem. Understanding how the EVM interacts with decentralized finance (DeFi) protocols, NFTs, oracles, and other blockchain services helps you navigate the decentralized internet and create applications that can integrate across different blockchain services.

Now let's proceed further.

In bitcoin blockchain , a block size = 1MB , while in Ethereum Block size = 30 million Gas. If all the Ethereum transaction costs 21,000 gas, what will be the total number of transactions in an Ethereum block? Total number of transaction in an Ethereum Block = 30,000,000/Tx gas = 30,000,000/21000 = 1428. That means ideally , it's around 1428 when we have 30 million Gas.
Now you might think why only 30 mn Gas. Reason is to prevent Heavy Transaction from running. So does it have some drawbacks too ?
Well yes.
1) Any transaction above 30 million gas will fail.

2) The average block time for Ethereum is 12.06 seconds (at the time of recording the video), so a maximum of 1,428 transactions can ideally be processed.

In the Ethereum Virtual Machine (EVM), the fundamental data unit is a 32-byte word (256 bits), which is used to store various types of data, including hexadecimal numbers. storage is organized into slots of fixed size, each slot being a 32-byte (256-bit) chunk. Understanding the slot arrangement is crucial for managing how smart contracts store and access data in the blockchain.

Each bytecode is divided in 3 parts
1) Contract Deployment
2) Runtime Bytecode
3) Metadata

Now let us see slots in more details.

Look at this code below :

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;


contract Demo {
    uint8 public a = 0x1e; //slot 0
    uint256 public b = 0xffe123; //slot 1
    bool public c = true; //slot 2
    string public d = "hello"; //slot 3


    // Function to read the contents of a storage slot
    function getSlotValue(uint slot) public view returns (bytes32) {
        bytes32 value;
        assembly {
            value := sload(slot)
        }
        return value;
    }
}

Using this code we can see the slots and what they are storing. This way we can know the slots in which we are having our variables. Note how it happens is we have all variables in one slot till it's memory runs out. We store them in either full or none. If some space is left that is wasted.

So that's all for today folks.
Stay tuned for more.
Next time we'll dive even deeper into EVM and explore some more aspects of it.

...

🔧 Intro to EVM IV


📈 34.42 Punkte
🔧 Programmierung

🔧 Intro to EVM II


📈 34.42 Punkte
🔧 Programmierung

🔧 Intro to EVM


📈 34.42 Punkte
🔧 Programmierung

🔧 Introduction to the Developer's Intro to Data Science Video Series (1 of 28) | Dev Intro to Data Science


📈 25.17 Punkte
🔧 Programmierung

🕵️ Cosmos Ethermint up to 0.4.0 EVM Module authentication replay


📈 21.83 Punkte
🕵️ Sicherheitslücken

🔧 Understanding How the EVM Stores Mappings, Arrays, and Structs in Solidity


📈 21.83 Punkte
🔧 Programmierung

🕵️ Cosmos Ethermint up to 0.4.0 EVM Module authentication replay


📈 21.83 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2011-1104 | Mutare EVM cross-site request forgery (VU#136612 / BID-46537)


📈 21.83 Punkte
🕵️ Sicherheitslücken

🕵️ Cosmos Ethermint up to 0.4.0 EVM Module state issue


📈 21.83 Punkte
🕵️ Sicherheitslücken

🔧 Deploying a Distributed EVM Layer 1 Blockchain using Avalanche, Docker, and GitHub Codespaces


📈 21.83 Punkte
🔧 Programmierung

🕵️ Cosmos Ethermint up to 0.4.0 EVM Module unknown vulnerability


📈 21.83 Punkte
🕵️ Sicherheitslücken

🔧 EVM Reverse Engineering Challenge 0x03


📈 21.83 Punkte
🔧 Programmierung

📰 Cybercriminals Could Be Cloning Payment Cards Using Stolen EVM Data


📈 21.83 Punkte
📰 IT Security Nachrichten

🔧 EVM Reverse Engineering Challenge 0x02


📈 21.83 Punkte
🔧 Programmierung

🕵️ Go Ethereum 1.8.17 cmd/evm/runner.go memory corruption


📈 21.83 Punkte
🕵️ Sicherheitslücken

🔧 EVM Reverse Engineering Challenge 0x01


📈 21.83 Punkte
🔧 Programmierung

🕵️ Py-EVM 0.2.0-alpha.33 vm.execute_bytecode Smart Contract privilege escalation


📈 21.83 Punkte
🕵️ Sicherheitslücken

🔧 Implementing Earned Value Management EVM in Government Projects


📈 21.83 Punkte
🔧 Programmierung

📰 Portolan EVM folgt auf MAS90


📈 21.83 Punkte
📰 IT Nachrichten

🔧 EVM Reverse Engineering Challenge 0x00


📈 21.83 Punkte
🔧 Programmierung

📰 RIPPER ATM Malware Uses Malicious EVM Chip


📈 21.83 Punkte
📰 IT Security Nachrichten

🔧 GetBlock Releases Crypto Faucets for Web3 Developers on EVM


📈 21.83 Punkte
🔧 Programmierung

📰 RIPPER ATM Malware Uses Malicious EVM Chip


📈 21.83 Punkte
📰 IT Security Nachrichten

🔧 Journey into Scalability with Scroll (EVM L2) — Exploring Cutting-Edge Blockchain Protocols


📈 21.83 Punkte
🔧 Programmierung

🕵️ CVE-2013-0186 | Red Hat ManageIQ EVM cross site scripting (RHSA-2014:0215 / OSVDB-105065)


📈 21.83 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2022-39354 | evm up to 0.35.x is_static control flow (GHSA-hhc4-47rh-cr34)


📈 21.83 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2011-1105 | Mutare EVM cross site scripting (VU#136612 / XFDB-65768)


📈 21.83 Punkte
🕵️ Sicherheitslücken

📰 EVM Mobile jetzt in RPG programmiert


📈 21.83 Punkte
📰 IT Nachrichten

🔧 Creating a Toy Solidity compiler and running it in a Toy EVM


📈 21.83 Punkte
🔧 Programmierung

📰 Ghidra-Evm - Module For Reverse Engineering Smart Contracts


📈 21.83 Punkte
📰 IT Security Nachrichten

🔧 Understanding EVM(Ethereum Virtual Machine)


📈 21.83 Punkte
🔧 Programmierung

📰 Intro to Docker Containers for Data Scientists


📈 12.58 Punkte
🔧 AI Nachrichten

matomo