Skip to content

Commit

Permalink
update through hash-function-precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
owenwahlgren committed Sep 27, 2024
1 parent 6b9be90 commit 9fb007a
Show file tree
Hide file tree
Showing 37 changed files with 328 additions and 500 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
title: Origin of the EVM
description: Learn about the origin of Ethereum Virtual Machine (EVM).
updated: 2024-05-31
authors: [ashucoder9]
description: Learn about the origin of the Ethereum Virtual Machine.
updated: 2024-09-27
authors: [ashucoder9, owenwahlgren]
icon: BookOpen
---

The Ethereum Virtual Machine (EVM) is a key component of Ethereum’s infrastructure, responsible for executing smart contracts across the network. The origins of the EVM can be traced back to the creation of the Ethereum blockchain itself, which was proposed in a whitepaper by Vitalik Buterin in late 2013.
The **Ethereum Virtual Machine (EVM)** is a fundamental component of Ethereum’s infrastructure, responsible for executing smart contracts across the network. The origins of the EVM can be traced back to the creation of the Ethereum blockchain itself, proposed in a whitepaper by **Vitalik Buterin** in late 2013.

Buterin and the founding Ethereum team envisioned a platform where developers could build decentralized applications (dApps) on a blockchain. To accomplish this, they needed a way to execute arbitrary, complex computations in a secure and decentralized way. This is where the idea of the EVM was born.
Buterin and the founding Ethereum team envisioned a platform where developers could build **decentralized applications (dApps)** on a blockchain. To accomplish this, they needed a way to execute arbitrary, complex computations in a secure and decentralized manner. This is how the concept of the EVM was born.

The EVM, an integral part of the Ethereum ecosystem, operates as a quasi-Turing complete machine. This means it can run nearly any algorithm, given enough resources, and it's isolated from the main network, providing a sandboxed environment for smart contract execution.
The EVM, an integral part of the Ethereum ecosystem, operates as a **quasi-Turing complete machine**. This means it can run nearly any algorithm, given enough resources. It's isolated from the main network, providing a sandboxed environment for smart contract execution.

After the whitepaper was published, the Ethereum project moved into a development phase, with the first live version of the Ethereum network, including the EVM, launching on July 30, 2015. The Ethereum blockchain was designed to include the EVM at the protocol level to allow users to create and execute smart contracts. These smart contracts are essentially programs or scripts that autonomously execute the terms of a contract, and they are written in a high-level language such as Solidity or Vyper, which are then compiled down to EVM bytecode for execution on the EVM.
Following the publication of the whitepaper, the Ethereum project moved into development. The first live version of the Ethereum network, including the EVM, launched on **July 30, 2015**. The Ethereum blockchain was designed with the EVM at the protocol level, enabling users to create and execute smart contracts. These smart contracts are essentially programs that autonomously execute the terms of an agreement. They are written in high-level languages like **Solidity** or **Vyper**, which are then compiled down to EVM bytecode for execution on the EVM.

Since its creation, the EVM has become a vital component of the Ethereum blockchain, and it has set a precedent for other blockchain platforms that have adopted similar models for executing smart contracts. The advent of the EVM has undoubtedly revolutionized the blockchain world, introducing the concept of programmable blockchains.
Since its creation, the EVM has become a crucial component of the Ethereum blockchain and has set a standard for other blockchain platforms that have adopted similar models for executing smart contracts. The advent of the EVM has undoubtedly revolutionized the blockchain world by introducing the concept of **programmable blockchains**.
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
---
title: Accounts, Keys and Addresses
description: Learn about Accounts, Keys and Addresses in EVM.
updated: 2024-05-31
authors: [ashucoder9]
title: Accounts, Keys, and Addresses
description: Learn about Accounts, Keys, and Addresses in EVM.
updated: 2024-09-27
authors: [ashucoder9, owenwahlgrne]
icon: BookOpen
---

## Accounts

In the EVM, there are two types of accounts:

1. **Externally Owned Accounts (EOAs)**: These are accounts controlled by private keys and have no associated code with them. They can send transactions by creating and signing them with their private keys. Essentially, if you are an end user of Ethereum, you're likely using an EOA.
1. **Externally Owned Accounts (EOAs)**: These accounts are controlled by private keys and do not have associated code. They can send transactions by creating and signing them with their private keys. If you're an end user of Ethereum, you're likely using an EOA.

2. **Contract Accounts**: These are accounts that have associated code with them (Smart Contracts). Contract accounts can't initiate transactions on their own. Instead, they only perform an operation when instructed to do so by an EOA. This could be a simple token transfer or a function call in a smart contract.
2. **Contract Accounts**: These accounts have associated code (smart contracts). Contract accounts can't initiate transactions on their own; instead, they only perform actions when instructed by an EOA. This could be as simple as a token transfer or a function call within a smart contract.

## Public and Private Keys

In Ethereum, as in many blockchain platforms, a cryptographic algorithm called the Elliptic Curve Digital Signature Algorithm (ECDSA) is used to generate a pair of keys: a public key and a private key.
In Ethereum, as in many blockchain platforms, the **Elliptic Curve Digital Signature Algorithm (ECDSA)** is used to generate a pair of keys: a public key and a private key.

The private key is a 32-byte number generated randomly.

The public key is derived from the private key using a specific elliptic curve cryptography function. It is 64 bytes long, consisting of two concatenated 32-byte coordinates.
- The **private key** is a 32-byte number generated randomly.
- The **public key** is derived from the private key using elliptic curve cryptography. It is 64 bytes long, made up of two concatenated 32-byte coordinates.

## Addresses

An EVM address is derived from the public key through the following steps:

1. **Keccak-256 Hashing**: The public key is first passed through the Keccak-256 hashing function (the version of SHA-3 used by Ethereum). Keccak-256 outputs a 64-byte string:
1. **Keccak-256 Hashing**: The public key is first passed through the Keccak-256 hashing function (the version of SHA-3 used by Ethereum). Keccak-256 outputs a 64-byte string, for example:
`025ad33e2479a53b02dc0be66eb0ce272fc0f4358c57a8f0a442410c3d831a`

2. **Rightmost 20 bytes**: The resulting string is truncated to keep only the last 20 bytes. In hexadecimal, this means retaining the rightmost 40 hex digits (since two hex digits represent one byte):
2. **Rightmost 20 bytes**: The resulting string is truncated to keep only the last 20 bytes. In hexadecimal, this means retaining the rightmost 40 hex digits (since two hex digits represent one byte), like so:
`e66eb0ce272fc0f4358c57a8f0a442410c3d831a`

3. **Adding '0x'**: Finally, "0x" is added at the start of the address for a total of 42 characters. The "0x" prefix indicates that what follows is a hexadecimal number, a common convention in the Ethereum ecosystem:
3. **Adding '0x'**: Finally, "0x" is prefixed to the address for a total of 42 characters. The "0x" indicates that the following characters represent a hexadecimal number, a common convention in Ethereum:
`0xe66eb0ce272fc0f4358c57a8f0a442410c3d831a`

This process ensures that each Ethereum address corresponds uniquely to a public key. Since the address is a truncated hash of the public key, it's not possible to reverse-engineer the public key from the address.
This process ensures that each Ethereum address uniquely corresponds to a public key. Since the address is a truncated hash of the public key, it's impossible to reverse-engineer the public key from the address.
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
---
title: Transactions and Blocks
description: Learn about another fundamental aspect of the Ethereum ecosystem - Transactions and Blocks.
updated: 2024-05-31
authors: [ashucoder9]
updated: 2024-09-27
authors: [ashucoder9, owenwahlgren]
icon: BookOpen
---

## Transactions

In the EVM, a transaction is the smallest unit of work that can be included in a block. It represents a state transition, modifying account data and moving Ether across the network.
In the EVM, a transaction is the smallest unit of work that can be included in a block. It represents a **state transition**, modifying account data and transferring Ether across the network.

Transactions can either transfer Ether or invoke smart contracts. Each transaction includes the following components:

- **Nonce**: A unique value set by the sender to ensure the transaction is processed only once, preventing replay attacks.
- **Gas Price**: The amount the sender is willing to pay per unit of gas, typically measured in `nanoAvax`, where 1 `nAvax` = 1/(10^9) Avax. This consists of three components:
- **Gas Price**: The amount the sender is willing to pay per unit of gas, typically measured in `nanoAvax` (1 `nAvax` = 1/(10^9) Avax). It consists of three parts:
- **Base Gas Fee**: The minimum `nAvax` required per unit of gas.
- **Maximum Priority Gas Fee**: Additional `nAvax` the sender is willing to pay per unit of gas, on top of the base fee.
- **Maximum Total Gas Fee**: The maximum `nAvax` the sender is willing to spend per unit of gas. The gas price paid equals the maximum total gas fee if the base gas fee plus the maximum priority fee exceeds the maximum total gas fee.
- **Gas Limit**: The maximum amount of gas units the sender is willing to pay for executing the transaction. If the gas limit is reached, the transaction fails, preventing indefinite execution.
- **Maximum Priority Gas Fee**: Additional `nAvax` the sender is willing to pay on top of the base fee.
- **Maximum Total Gas Fee**: The maximum `nAvax` the sender is willing to spend per unit of gas. If the sum of the base gas fee and the priority gas fee exceeds this amount, the gas price paid will be capped at the maximum total gas fee.
- **Gas Limit**: The maximum amount of gas units the sender is willing to pay for executing the transaction. If this limit is reached, the transaction fails, preventing indefinite execution.
- **To**: The recipient's Ethereum address or the target smart contract.
- **V, R, S**: Cryptographic data used to create the sender's signature.

## Blocks

A block in the EVM consists of a set of transactions that have been validated by miners, bundled together, and linked to the previous block. Each block contains:
A block in the EVM is a bundle of validated transactions, grouped together and linked to the previous block. Each block contains:

- **Block Number**: The index of the block, viewed as a position in a zero-indexed linked list.
- **Block Number**: The index of the block, representing its position in a zero-indexed linked list.
- **Timestamp**: The time the block was mined.
- **Transactions Root**: The Merkle root of all transactions within the block.
- **Receipts Root**: The Merkle root of all transaction receipts.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Different Versions of EVM
description: Learn about the different versions of the Ethereum Virtual Machine (EVM) in the Avalanche ecosystem.
updated: 2024-05-31
authors: [ashucoder9]
description: Learn about the different versions of the Ethereum Virtual Machine in the Avalanche ecosystem.
updated: 2024-09-27
authors: [ashucoder9, owenwahlgren]
icon: BookOpen
---

Expand All @@ -12,20 +12,17 @@ Geth (or [go-ethereum](https://github.com/ethereum/go-ethereum)) is the official

## Coreth

[Coreth](https://github.com/ava-labs/coreth) is a fork of Geth maintained by Ava Labs that implements the Virtual Machine for the C-Chain. It has been adapted to work with Avalanche Consensus.
[Coreth](https://github.com/ava-labs/coreth) is a fork of Geth maintained by Ava Labs. It implements the EVM for the C-Chain and has been adapted to work with Avalanche Consensus.

## Subnet-EVM

[Subnet-EVM](https://github.com/ava-labs/subnet-evm) is a fork of Coreth designed to make it easy to launch customized EVM-based blockchains on an Avalanche L1. It differs from Coreth in the following ways:
[Subnet-EVM](https://github.com/ava-labs/subnet-evm) is a fork of Coreth designed to facilitate launching customized EVM-based blockchains on an Avalanche L1. It differs from Coreth in the following ways:

→ **Configurable fees and gas limits added in the genesis file**

→ **Avalanche hardforks merged into a single "Subnet-EVM" hardfork**

→ **Atomic transactions and shared memory removed**

→ **Multicoin contracts and state removed**
- **Configurable Fees and Gas Limits**: Customizable fees and gas limits can be set in the genesis file.
- **Unified Subnet-EVM Hardfork**: All Avalanche hardforks are merged into a single "Subnet-EVM" hardfork.
- **Atomic Transactions and Shared Memory Removed**: Support for atomic transactions and shared memory has been removed.
- **Multicoin Contracts and State Removed**: Multicoin contracts and state tracking are no longer supported.

## Precompile-EVM

Precompile-EVM allows precompiles to be registered with Subnet-EVM without forking the Subnet-EVM codebase. This simplifies common customizations to Subnet-EVM, making them more accessible and easier to maintain. It also streamlines updates for Subnet-EVM.
Precompile-EVM allows precompiles to be registered with Subnet-EVM without needing to fork the Subnet-EVM codebase. This simplifies common customizations to Subnet-EVM, making them more accessible and easier to maintain. It also streamlines updates for Subnet-EVM.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Setting Up Our Development Environment
title: Set Up Development Environment
description: Start by setting up your development environment.
updated: 2024-05-31
authors: [ashucoder9]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Open Codespace in VS Code
title: Codespace in VS Code
description: Learn how to setup GitHub Codespaces.
updated: 2024-05-31
authors: [ashucoder9]
Expand Down
22 changes: 9 additions & 13 deletions content/course/customizing-evm/04-your-evm-blockchain/00-intro.mdx
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
---
title: Your Own EVM Blockchain
description: Learn how to spin up your own EVM blockchain.
updated: 2024-05-31
authors: [ashucoder9]
updated: 2024-09-27
authors: [ashucoder9, owenwahlgren]
icon: Book
---

In this part of our course, we'll explore how to run your own Avalanche Network with a custom EVM. Running your own EVM allows you to address specific use cases and highlights one of the key advantages of multi-chain systems over monolithic ones.
In this part of the course, we'll explore how to run your own Avalanche L1 with a custom EVM. Running your own EVM allows you to address specific use cases, showcasing one of the key advantages of multi-chain systems over monolithic blockchains.

## Hands-On Exercise
## Topics

In this section, you won't need to write any Go code. Instead, you'll run some commands to set up your EVM blockchain.
We’ll cover the following topics:

## Structure of This Section
- **Avalanche CLI**: Learn how to configure and launch an Avalanche L1 using the Avalanche CLI.
- **Token Transfer**: Explore how to perform token transfers with Foundry.

We will cover the following topics:

- **Avalanche CLI**: Learn how to use this tool to create your own Avalanche Network and add Avalanche L1s and blockchains.
- **Token Transfer**: Discover how to perform token transfers with Foundry.

This practical exercise will help you consolidate your knowledge and see the impact of customizations on EVM performance firsthand.
This hands-on exercise will solidify your knowledge and allow you to observe how customizations impact EVM performance.

## Learning Objective

By the end of this section, you'll be equipped with the skills to effectively run your own Avalanche Network with a custom EVM blockchain, paving the way for your blockchain projects.
By the end of this section, youll have the skills to effectively run your own Avalanche L1 with a custom EVM blockchain, empowering you to start building your blockchain projects!
Loading

0 comments on commit 9fb007a

Please sign in to comment.