|
1 | 1 | ---
|
2 |
| -title: Accounts, Keys and Addresses |
3 |
| -description: Learn about Accounts, Keys and Addresses in EVM. |
4 |
| -updated: 2024-05-31 |
5 |
| -authors: [ashucoder9] |
| 2 | +title: Accounts, Keys, and Addresses |
| 3 | +description: Learn about Accounts, Keys, and Addresses in EVM. |
| 4 | +updated: 2024-09-27 |
| 5 | +authors: [ashucoder9, owenwahlgrne] |
6 | 6 | icon: BookOpen
|
7 | 7 | ---
|
8 | 8 |
|
9 | 9 | ## Accounts
|
10 | 10 |
|
11 | 11 | In the EVM, there are two types of accounts:
|
12 | 12 |
|
13 |
| -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. |
| 13 | +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. |
14 | 14 |
|
15 |
| -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. |
| 15 | +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. |
16 | 16 |
|
17 | 17 | ## Public and Private Keys
|
18 | 18 |
|
19 |
| -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. |
| 19 | +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. |
20 | 20 |
|
21 |
| -The private key is a 32-byte number generated randomly. |
22 |
| - |
23 |
| -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. |
| 21 | +- The **private key** is a 32-byte number generated randomly. |
| 22 | +- 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. |
24 | 23 |
|
25 | 24 | ## Addresses
|
26 | 25 |
|
27 | 26 | An EVM address is derived from the public key through the following steps:
|
28 | 27 |
|
29 |
| -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: |
| 28 | +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: |
30 | 29 | `025ad33e2479a53b02dc0be66eb0ce272fc0f4358c57a8f0a442410c3d831a`
|
31 | 30 |
|
32 |
| -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): |
| 31 | +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: |
33 | 32 | `e66eb0ce272fc0f4358c57a8f0a442410c3d831a`
|
34 | 33 |
|
35 |
| -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: |
| 34 | +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: |
36 | 35 | `0xe66eb0ce272fc0f4358c57a8f0a442410c3d831a`
|
37 | 36 |
|
38 |
| -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. |
| 37 | +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. |
0 commit comments