Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the gas page with an explanation of EIP 1559 #3104

Merged
merged 9 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Eth2ShardChainsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Container = styled.div`

const Eth2ShardChainsList = () => {
const reads = [
{
{
title: "Why sharding is great: demystifying the technical properties",
description: "Vitalik Buterin",
link: "https://vitalik.ca/general/2021/04/07/sharding.html",
Expand Down
46 changes: 42 additions & 4 deletions src/content/developers/docs/gas/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ _Diagram adapted from [Ethereum EVM illustrated](https://takenobu-hs.github.io/d
In essence, gas fees are paid in Ethereum's native currency, ether (ETH). Gas prices are denoted in gwei, which itself is a denomination of ETH - each gwei is equal to 0.000000001 ETH (10<sup>-9</sup> ETH). For example, instead of saying that your gas costs 0.000000001 ether, you can say your gas costs 1 gwei.

Let's say Alice has to pay Bob 1ETH.
In the transaction the gas limit is 21,000 units and the gas price is 200 gwei.
In the transaction the gas limit is 21,000 units and the gas price is 200 gwei.

Total fee will be: `Gas units (limit) * Gas price per unit`
Total fee will be: `Gas units (limit) * Gas price per unit`
i.e `21,000 * 200 = 4,200,000 gwei` or 0.0042 ETH

Now, when Alice sends the money, 1.0042 ETH will be deducted from Alice's account.
Expand All @@ -48,13 +48,51 @@ _Diagram adapted from [Ethereum EVM illustrated](https://takenobu-hs.github.io/d

## What is gas limit? {#what-is-gas-limit}

Gas limit refers to the maximum amount of gas you are willing to consume on a transaction. More complicated transactions, involving [smart contracts](/developers/docs/smart-contracts/), require more computational work so they require a higher gas limit than a simple payment. A standard ETH transfer requires a gas limit of 21,000 units of gas.
Gas limit refers to the maximum amount of gas you are willing to consume on a transaction. More complicated transactions, involving [smart contracts](/developers/docs/smart-contracts/), require more computational work so they require a higher gas limit than a simple payment. A standard ETH transfer requires a gas limit of 21,000 units of gas.

For example if you put a gas limit of 50,000 for a simple ETH transfer, the EVM would consume 21,000, and you would get back the remaining 29,000. However, if you specify too little gas say for example, a gas limit of 20,000 for a simple ETH transfer, the EVM will consume your 20,000 gas units attempting to fulfill the txn, but it will not complete. The EVM then reverts any changes, but since 20k gas units worth of work has already been done by the miner, that gas is consumed.

## What is gas price? {#what-is-gas-price}

Gas price refers to the amount of ether you are willing to pay for every unit of gas, and this is usually measured in 'gwei'.
Gas price refers to the amount of Ether you are willing to pay for every unit of gas, and this is usually measured in 'gwei'. Prior to
[the London update](/history/#london), you specify in the transaction how much you are willing to pay per gas, and you pay exactly that amount.
Different transactions in the same block can have very different gas prices.

### The London update {#gas-price-london-update}

Starting with the London update, every block has a base fee, the minimum per gas price for inclusion in this block. The base fee is calculated by a formula
that compares the size of the previous block (the amount of gas used for all the transactions) with a target size. This upgrade will double the allowable block size, while targeting blocks to be 50% full. If the block size is higher than the target, there is more demand for inclusion in the blockchain than targeted supply, so the base fee in the subsequent block is increased. If the block size is lower than the target then there is less demand for block space than targeted supply, so the base fee is subsequently decreased. The amount the base fee is adjusted by is proportional to how far from the target the block size is. This base fee is "burned", removing it from circulation.

Transactions can either specify a gas price using the old mechanism, or specify two other parameters:

- Maximum Fee per Gas: The maximum gas price the transaction can be charged.
- Maximum Priority Fee per Gas (a.k.a. Tip): The maximum priority fee the transaction signer is willing to pay the miner per gas to be included.
If the base fee plus this amount is less than the maximum fee per gas, this is the priority fee. Otherwise, the priority fee is the maximum
fee minus the base fee.

For example, imagine a block with a base fee of 100 gwei. The pool of available transactions contains the transactions
in the table below. Transactions A-C are type 2, so they include both a maximum fee per gas and a maximum priority fee per gas.
Transaction D is an older transaction type (either 0, without an access list, or 1, which does have an access list), so it only specifies
a gas price. That gas price is used for both maximum fee per gas and maximum priority fee per gas.

| ID | Maximum Fee per Gas | Maximum Priority Fee per Gas | Actual Priority Fee | Actual Gas Price | Remarks |
| --- | ------------------: | ---------------------------: | ------------------: | ---------------: | --------------------------------------------------------------- |
| A | 90 gwei | 90 gwei | N/A | N/A | This transaction is not going in the block |
| B | 200 gwei | 5 gwei | 5 gwei | 105 gwei | The priority fee is the maximum priority fee |
| C | 120 gwei | 30 gwei | 20 gwei | 120 gwei | The priority fee is the maximum (total) fee minus the base fee |
| D | 200 gwei | 200 gwei | 100 gwei | 200 gwei | Transactions that specify gas price are charged the full amount |

Miners and validators are expected to choose the transactions that will pay them the highest priority fees.

This mechanism is more complicated than the simple gas price auction, but it has the advantage of making gas fees more predictable, as well as making ETH more
valuable by removing some of it from circulation. The maximum fee per gas functions as a [second price auction](https://oko.uk/blog/first-price-vs-second-price-auctions),
which is more efficient than the previous mechanism that is a first price auction. Users can submit transactions with a much higher maximum fee per gas, corresponding
to how much they need the transaction to happen, without having to worry that they will be overcharged.

If you are interested you can read the exact
[EIP-1559 specifications](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md).

Continue down the rabbit hole with these [EIP-1559 Resources](https://hackmd.io/@timbeiko/1559-resources).

## Why can gas fees get so high? {#why-can-gas-fees-get-so-high}

Expand Down
21 changes: 10 additions & 11 deletions src/content/developers/docs/nodes-and-clients/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,13 @@ The Ethereum community maintains multiple open-source clients, developed by diff

This table summarizes the different clients. All of them are actively worked on and pass [client tests](https://github.com/ethereum/tests).

| Client | Language | Operating systems | Networks | Sync strategies | State pruning |
| ------------------------------------------------------------ | -------- | --------------------- | ------------------------------------------ | ----------------------- | --------------- |
| [Geth](https://geth.ethereum.org/) | Go | Linux, Windows, macOS | Mainnet, Görli, Rinkeby, Ropsten | Fast, Full, Snap | Archive, Pruned |
| [OpenEthereum](https://github.com/openethereum/openethereum) | Rust | Linux, Windows, macOS | Mainnet, Kovan, Ropsten, and more | Warp, Full | Archive, Pruned |
| [Nethermind](http://nethermind.io/) | C#, .NET | Linux, Windows, macOS | Mainnet, Görli, Ropsten, Rinkeby, and more | Fast, Full | Archive, Pruned |
| [Besu](https://pegasys.tech/solutions/hyperledger-besu/) | Java | Linux, Windows, macOS | Mainnet, Rinkeby, Ropsten, and Görli | Fast, Full | Archive, Pruned |
| [Erigon](https://github.com/ledgerwatch/erigon) | Go / Multi | Linux, Windows, macOS | Mainnet, Görli, Rinkeby, Ropsten | Full | Archive, Pruned |

| Client | Language | Operating systems | Networks | Sync strategies | State pruning |
| ------------------------------------------------------------ | ---------- | --------------------- | ------------------------------------------ | ---------------- | --------------- |
| [Geth](https://geth.ethereum.org/) | Go | Linux, Windows, macOS | Mainnet, Görli, Rinkeby, Ropsten | Fast, Full, Snap | Archive, Pruned |
| [OpenEthereum](https://github.com/openethereum/openethereum) | Rust | Linux, Windows, macOS | Mainnet, Kovan, Ropsten, and more | Warp, Full | Archive, Pruned |
| [Nethermind](http://nethermind.io/) | C#, .NET | Linux, Windows, macOS | Mainnet, Görli, Ropsten, Rinkeby, and more | Fast, Full | Archive, Pruned |
| [Besu](https://pegasys.tech/solutions/hyperledger-besu/) | Java | Linux, Windows, macOS | Mainnet, Rinkeby, Ropsten, and Görli | Fast, Full | Archive, Pruned |
| [Erigon](https://github.com/ledgerwatch/erigon) | Go / Multi | Linux, Windows, macOS | Mainnet, Görli, Rinkeby, Ropsten | Full | Archive, Pruned |

For more on supported networks, read up on [Ethereum networks](/developers/docs/networks/).

Expand Down Expand Up @@ -169,13 +168,13 @@ You define the type of sync when you get set up, like so:

`geth --syncmode "light"`

For further details check the tutorial on [running Geth light node](/developers/tutorials/run-light-node-geth/).
For further details check the tutorial on [running Geth light node](/developers/tutorials/run-light-node-geth/).

**Setting up full sync with archive in [Besu](https://besu.hyperledger.org/)**

`besu --sync-mode=FULL`

Like any other configuration, it can be defined with the startup flag or in the config file. Another example is [Nethermind](https://docs.nethermind.io/nethermind/) which prompts you to choose sync mode during first initialization and creates config.
Like any other configuration, it can be defined with the startup flag or in the config file. Another example is [Nethermind](https://docs.nethermind.io/nethermind/) which prompts you to choose sync mode during first initialization and creates config.

## Hardware {#hardware}

Expand Down Expand Up @@ -210,7 +209,7 @@ The sync mode you choose will affect space requirements but we've estimated the
| Besu | 750GB+ | 5TB+ |
| Erigon | N/A | 1TB+ |

* Note: Erigon does not Fast Sync, but Full Pruning is possible (~500GB)
- Note: Erigon does not Fast Sync, but Full Pruning is possible (~500GB)

![A chart showing that GB needed for a full sync is trending up](./full-sync.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ incomplete: true
## Tutorials {#tutorials}

- [Flutter and Blockchain – Hello World Dapp](https://www.geeksforgeeks.org/flutter-and-blockchain-hello-world-dapp/) takes you through all the steps to get started:
1. Installing the [Truffle development suite](https://www.trufflesuite.com/)
2. Writing a smart contract in [Solidity](https://soliditylang.org/)
3. Writing a user interface in Dart
1. Installing the [Truffle development suite](https://www.trufflesuite.com/)
2. Writing a smart contract in [Solidity](https://soliditylang.org/)
3. Writing a user interface in Dart
- [Building a Mobile dApp with Flutter](https://medium.com/dash-community/building-a-mobile-dapp-with-flutter-be945c80315a) is a lot shorter, which might be better
if you already know the basics.
if you already know the basics.
- If you prefer the learn by watching a video, you can watch [Build Your First Blockchain Flutter App](https://www.youtube.com/watch?v=3Eeh3pJ6PeA), which is about an hour long
- If you are impatient, you might prefer [Building a Blockchain Decentralized-app with Flutter and Dart on Ethereum](https://www.youtube.com/watch?v=jaMFEOCq_1s), which is only about twenty minutes

## Working with Ethereum clients {#working-with-ethereum-clients}

You can use Ethereum to create decentralized applications (or "dapps") that utilize the benefits of cryptocurrency and blockchain technology.
There are at least two currently maintained libraries for Dart to use the
There are at least two currently maintained libraries for Dart to use the
[JSON RPC API](/developers/docs/apis/json-rpc/) for Ethereum.

1. [Web3dart from simonbutler.eu](https://pub.dev/packages/web3dart)
1. [Ethereum 5.0.0 from darticulate.com](https://pub.dev/packages/ethereum)

There are also additional libraries that allow you to manipulate specific Ethereum addresses,
There are also additional libraries that allow you to manipulate specific Ethereum addresses,
or that let you retrieve prices of various cryptocurrencies.
[You can see the full list here](https://pub.dev/dart/packages?q=ethereum).

1 change: 1 addition & 0 deletions src/content/developers/docs/storage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ PoS based:
- [GitHub](https://github.com/ipfs/ipfs)

**Storj DCS -** **_Secure, private, and S3-compatible decentralized cloud object storage for developers._**

- [Storj](https://storj.io/)
- [Documentation](https://docs.storj.io/)

Expand Down
Loading