From c5c04cbde4fed058a6c82411af5c412281de8d42 Mon Sep 17 00:00:00 2001 From: MadelineMurray <43356962+MadelineMurray@users.noreply.github.com> Date: Thu, 23 Nov 2023 02:36:30 +1000 Subject: [PATCH 1/4] Removed two tutorials using legacy permissioning contracts (#1453) Signed-off-by: madelinemurray --- .../how-to/use-permissioning/onchain.md | 1 - .../tutorials/permissioning/onchain.md | 350 ------------------ .../permissioning/upgrade-contracts.md | 167 --------- 3 files changed, 518 deletions(-) delete mode 100644 docs/private-networks/tutorials/permissioning/onchain.md delete mode 100644 docs/private-networks/tutorials/permissioning/upgrade-contracts.md diff --git a/docs/private-networks/how-to/use-permissioning/onchain.md b/docs/private-networks/how-to/use-permissioning/onchain.md index 4b177026a20..46d8527db99 100644 --- a/docs/private-networks/how-to/use-permissioning/onchain.md +++ b/docs/private-networks/how-to/use-permissioning/onchain.md @@ -57,4 +57,3 @@ The permissioning contracts in the [`ConsenSys/permissioning-smart-contracts`](h [support domain names]: ../../../public-networks/concepts/node-keys.md#domain-name-support [projects release page]: https://github.com/ConsenSys/permissioning-smart-contracts/releases/latest -[onchain permissioning tutorial]: ../../tutorials/permissioning/onchain.md diff --git a/docs/private-networks/tutorials/permissioning/onchain.md b/docs/private-networks/tutorials/permissioning/onchain.md deleted file mode 100644 index 2d2655b0b3c..00000000000 --- a/docs/private-networks/tutorials/permissioning/onchain.md +++ /dev/null @@ -1,350 +0,0 @@ ---- -title: Get started with onchain permissioning -sidebar_position: 1 -description: Setting up and using Hyperledger Besu onchain permissioning -tags: - - private networks ---- - -# Get started with onchain permissioning - -The following steps describe bootstrapping a permissioned network using a Hyperledger Besu node. - -This tutorial configures permissioning on a [IBFT 2.0 proof of authority (PoA)] network. - -:::caution Please use this as reference material only! - -The [permissioning-contract-repo](https://github.com/ConsenSys/permissioning-smart-contracts) has been archived and is intended as reference material only. -Please update all dependencies in there before proceeding. - -In addition, we also recommend using [Hardhat](https://hardhat.org/hardhat-runner/docs/guides/deploying) instead of [Truffle](https://trufflesuite.com/), -as the development environment. Please refer to the [Quorum Dev Quickstart](../../tutorials/quickstart.md) for an example. - -::: - -## Prerequisites - -- [Node.js](https://nodejs.org/en/) v10.16.0 or later -- [Yarn](https://yarnpkg.com/en/) v1.15 or later -- Browser with [MetaMask installed](https://metamask.io/) - -## Steps - -### 1. Create folders - -Each node requires a data directory for the blockchain data. - -Create directories for your permissioned network and each of the three nodes, and a data directory for each node: - -```bash -Permissioned-Network/ -├── Node-1 -│   ├── data -├── Node-2 -│   ├── data -└── Node-3 -│   ├── data -└── Node-4 - ├── data -``` - -### 2. Create the configuration file - -The configuration file defines the [IBFT 2.0 genesis file](../../how-to/configure/consensus/ibft.md#genesis-file) and the number of node key pairs to generate. - -The configuration file has two nested JSON nodes. The first is the `genesis` property defining the IBFT 2.0 genesis file, except for the `extraData` string, which Besu generates automatically in the resulting genesis file. The second is the `blockchain` property defining the number of key pairs to generate. - -Copy the following configuration file definition to a file called `ibftConfigFile.json` and save it in the `Permissioned-Network` directory: - -```json -{ - "genesis": { - "config": { - "chainId": 1337, - "berlinBlock": 0, - "ibft2": { - "blockperiodseconds": 2, - "epochlength": 30000, - "requesttimeoutseconds": 4 - } - }, - "nonce": "0x0", - "timestamp": "0x58ee40ba", - "gasLimit": "0x47b760", - "difficulty": "0x1", - "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365", - "coinbase": "0x0000000000000000000000000000000000000000", - "alloc": { - "fe3b557e8fb62b89f4916b721be55ceb828dbd73": { - "privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", - "comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", - "balance": "0xad78ebc5ac6200000" - }, - "627306090abaB3A6e1400e9345bC60c78a8BEf57": { - "privateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", - "comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", - "balance": "90000000000000000000000" - }, - "f17f52151EbEF6C7334FAD080c5704D77216b732": { - "privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f", - "comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", - "balance": "90000000000000000000000" - } - } - }, - "blockchain": { - "nodes": { - "generate": true, - "count": 4 - } - } -} -``` - -:::critical Security warning - -Don't use the accounts in the genesis file on Mainnet or any public network except for testing. The private keys display, which means the accounts are not secure. - -::: - -### 3. Generate node keys and a genesis file - -In the `Permissioned-Network` directory, generate the node key and genesis file: - -```bash -besu operator generate-blockchain-config --config-file=ibftConfigFile.json --to=networkFiles --private-key-file-name=key -``` - -Besu creates the following in the `networkFiles` directory: - -- `genesis.json` - The genesis file including the `extraData` property specifying the four nodes are validators. -- A directory for each node named using the node address and containing the public and private key for each node. - -```bash -networkFiles/ -├── genesis.json -└── keys - ├── 0x438821c42b812fecdcea7fe8235806a412712fc0 - │   ├── key - │   └── key.pub - ├── 0xca9c2dfa62f4589827c0dd7dcf48259aa29f22f5 - │   ├── key - │   └── key.pub - ├── 0xcd5629bd37155608a0c9b28c4fd19310d53b3184 - │   ├── key - │   └── key.pub - └── 0xe96825c5ab8d145b9eeca1aba7ea3695e034911a - ├── key - └── key.pub -``` - -### 4. Copy the genesis file to the Permissioned-Network directory - -Copy the `genesis.json` file to the `Permisssioned-Network` directory. - -### 5. Add the Ingress contracts to the genesis file - -:::tip - -If the network is using only account or node permissioning, add only the relevant Ingress contract to the genesis file. - -::: - -Add the Ingress contracts to the genesis file for your network by copying them from [`genesis.json`](https://github.com/ConsenSys/permissioning-smart-contracts/blob/e6c2d4d5a728c11cdb8e97a07ddda3c0bfb57b5d/genesis.json) in the [`permissioning-smart-contracts` repository](https://github.com/ConsenSys/permissioning-smart-contracts) to the `alloc` section of the contract: - -```json -"0x0000000000000000000000000000000000008888": { - "comment": "Account Ingress smart contract", - "balance": "0", - "code": , - "storage": { - - } -} - -"0x0000000000000000000000000000000000009999": { - "comment": "Node Ingress smart contract", - "balance": "0", - "code": , - "storage": { - - } -} -``` - -:::info - -To support the permissioning contracts, ensure your genesis file includes at least the `constantinopleFixBlock` milestone. - -The permissioning contract has multiple interfaces, and each interface maps to a specific version of the [Enterprise Ethereum Alliance Client Specification](https://entethalliance.org/technical-specifications/). Ensure that you specify the [permissioning contract interface](../../how-to/use-permissioning/onchain.md) being used when starting Besu. - -::: - -### 6. Copy the node private keys to the node directories - -For each node, copy the key files to the `data` directory for that node - -```bash -Permissioned-Network/ -├── genesis.json -├── Node-1 -│   ├── data -│ │    ├── key -│ │    ├── key.pub -├── Node-2 -│   ├── data -│ │    ├── key -│ │    ├── key.pub -├── Node-3 -│   ├── data -│ │    ├── key -│ │    ├── key.pub -├── Node-4 -│ ├── data -│ │    ├── key -│ │    ├── key.pub -``` - -### 7. Start Node-1 - -:::info - -The specified node must be producing blocks, that is, be a miner (PoW networks) or validator (PoA networks). - -To allow MetaMask to connect, the node must have JSON-RPC HTTP enabled, and have `--rpc-http-cors-origins` set to allow MetaMask. - -If your network is not a [free gas network](../../how-to/configure/free-gas.md), the account used to interact with the permissioning contracts must have a balance. - -::: - -Start the first node with command line options to enable onchain permissioning and the location of the **data** folder and genesis file: - -```cmd -besu --data-path=data --genesis-file=../genesis.json --permissions-accounts-contract-enabled --permissions-accounts-contract-address "0x0000000000000000000000000000000000008888" --permissions-nodes-contract-enabled --permissions-nodes-contract-address "0x0000000000000000000000000000000000009999" --permissions-nodes-contract-version=2 --rpc-http-enabled --rpc-http-cors-origins="*" --rpc-http-api=ADMIN,ETH,NET,PERM,IBFT --host-allowlist="*" -``` - -On the command line: - -- Enable onchain accounts permissioning using [`--permissions-accounts-contract-enabled`](../../reference/cli/options.md#permissions-accounts-contract-enabled). -- Set the address of the Account Ingress contract in the genesis file using [`--permissions-accounts-contract-address`](../../reference/cli/options.md#permissions-accounts-contract-address). -- Enable onchain nodes permissioning using [`--permissions-nodes-contract-enabled`](../../reference/cli/options.md#permissions-nodes-contract-enabled). -- Set the address of the Node Ingress contract in the genesis file using [`--permissions-nodes-contract-address`](../../reference/cli/options.md#permissions-nodes-contract-address). -- Set the version of the [permissioning contract interface](../../how-to/use-permissioning/onchain.md#specify-the-permissioning-contract-interface-version) using [`--permissions-nodes-contract-version`](../../reference/cli/options.md#permissions-nodes-contract-version). -- Enable the JSON-RPC API using [`--rpc-http-enabled`](../../../public-networks/reference/cli/options.md#rpc-http-enabled). -- Enable the `ADMIN`, `ETH`, `NET`, `PERM`, and `IBFT` APIs using [`--rpc-http-api`](../../../public-networks/reference/cli/options.md#rpc-http-api). -- Allow all-host access to the HTTP JSON-RPC API using [`--host-allowlist`](../../../public-networks/reference/cli/options.md#host-allowlist). -- Allow all-domain access to the node through the HTTP JSON-RPC API using [`--rpc-http-cors-origins`](../../../public-networks/reference/cli/options.md#rpc-http-cors-origins). - -When the node starts, the [enode URL](../../../public-networks/concepts/node-keys.md#enode-url) displays. Copy the enode URL to use when starting Node-2, Node-3, and Node-4. - -### 8. Start Node-2 - -Use the following command to start Node-2: - -```cmd -besu --data-path=data --genesis-file=../genesis.json --bootnodes= --permissions-accounts-contract-enabled --permissions-accounts-contract-address "0x0000000000000000000000000000000000008888" --permissions-nodes-contract-enabled --permissions-nodes-contract-address "0x0000000000000000000000000000000000009999" --permissions-nodes-contract-version=2 --rpc-http-enabled --rpc-http-cors-origins="*" --rpc-http-api=ADMIN,ETH,NET,PERM,IBFT --host-allowlist="*" --p2p-port=30304 --rpc-http-port=8546 -``` - -The command line specifies: - -- A different port to Node-1 for P2P discovery using [`--p2p-port`](../../../public-networks/reference/cli/options.md#p2p-port). -- A different port to Node-1 for HTTP JSON-RPC using [`--rpc-http-port`](../../../public-networks/reference/cli/options.md#rpc-http-port). -- The enode URL of Node-1 using [`--bootnodes`](../../../public-networks/reference/cli/options.md#bootnodes). -- Other options as for [Node-1](#7-start-node-1). - -### 9. Start Node-3 - -Use the following command to start Node-3: - -```cmd -besu --data-path=data --genesis-file=../genesis.json --bootnodes= --permissions-accounts-contract-enabled --permissions-accounts-contract-address "0x0000000000000000000000000000000000008888" --permissions-nodes-contract-enabled --permissions-nodes-contract-address "0x0000000000000000000000000000000000009999" --permissions-nodes-contract-version=2 --rpc-http-enabled --rpc-http-cors-origins="*" --rpc-http-api=ADMIN,ETH,NET,PERM,IBFT --host-allowlist="*" --p2p-port=30305 --rpc-http-port=8547 -``` - -The command line specifies: - -- A different port to Node-1 and Node-2 for P2P discovery using [`--p2p-port`](../../../public-networks/reference/cli/options.md#p2p-port). -- A different port to Node-1 and Node-2 for HTTP JSON-RPC using [`--rpc-http-port`](../../../public-networks/reference/cli/options.md#rpc-http-port). -- The enode URL of Node-1 using [`--bootnodes`](../../../public-networks/reference/cli/options.md#bootnodes). -- Other options as for [Node-1](#7-start-node-1). - -### 10. Start Node-4 - -Use the following command to start Node-4: - -```cmd -besu --data-path=data --genesis-file=../genesis.json --bootnodes= --permissions-accounts-contract-enabled --permissions-accounts-contract-address "0x0000000000000000000000000000000000008888" --permissions-nodes-contract-enabled --permissions-nodes-contract-address "0x0000000000000000000000000000000000009999" --permissions-nodes-contract-version=2 --rpc-http-enabled --rpc-http-cors-origins="*" --rpc-http-api=ADMIN,ETH,NET,PERM,IBFT --host-allowlist="*" --p2p-port=30306 --rpc-http-port=8548 -``` - -The command line specifies: - -- A different port to Node-1, Node-2, and Node-3 for P2P discovery using [`--p2p-port`](../../../public-networks/reference/cli/options.md#p2p-port). -- A different port to Node-1, Node-2, and Node-3 for HTTP JSON-RPC using [`--rpc-http-port`](../../../public-networks/reference/cli/options.md#rpc-http-port). -- The enode URL of Node-1 using [`--bootnodes`](../../../public-networks/reference/cli/options.md#bootnodes). -- Other options as for [Node-1](#7-start-node-1). - -:::tip - -If your nodes are having trouble connecting as peers, update the `--bootnodes` option for each node to include all four enode URLs. - -::: - -### 11. Clone the contracts and install dependencies - -Clone the `permissioning-smart-contracts` repository: - -```bash -git clone https://github.com/ConsenSys/permissioning-smart-contracts.git -``` - -Change into the `permissioning-smart-contracts` directory. - -### 12. Set the environment variables - -Create the following environment variables and set to the specified values: - -- `BESU_NODE_PERM_ACCOUNT` - Account to deploy the permissioning contracts and become the first admin account. -- `BESU_NODE_PERM_KEY` - Private key of the account to deploy the permissioning contracts. -- `ACCOUNT_INGRESS_CONTRACT_ADDRESS` - Address of the Account Ingress contract in the genesis file. -- `NODE_INGRESS_CONTRACT_ADDRESS` - Address of the Node Ingress contract in the genesis file. -- `BESU_NODE_PERM_ENDPOINT` - Required only if your node is not using the default JSON-RPC host and port (`http://127.0.0.1:8545`). Set to JSON-RPC host and port. When bootstrapping the network, Besu uses the specified node to deploy the contracts and is the first node in the network. -- `CHAIN_ID` - The chain ID from the genesis file. -- `INITIAL_ALLOWLISTED_NODES`(optional) - The enode URLs of permitted nodes. Specify multiple nodes (Node-1, Node-2, Node-3) as a comma-separated list. - -:::tip - -A simple way to set multiple environment variables is to create a file called `.env` with the required settings: - -```env -NODE_INGRESS_CONTRACT_ADDRESS=0x0000000000000000000000000000000000009999 -ACCOUNT_INGRESS_CONTRACT_ADDRESS=0x0000000000000000000000000000000000008888 -BESU_NODE_PERM_ACCOUNT=627306090abaB3A6e1400e9345bC60c78a8BEf57 -BESU_NODE_PERM_KEY=c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3 -BESU_NODE_PERM_ENDPOINT=http://127.0.0.1:8545 -CHAIN_ID=1337 -INITIAL_ALLOWLISTED_NODES=enode://c35c3...d615f@1.2.3.4:30303,enode://f42c13...fc456@1.2.3.5:30303 -``` - -If using a `.env` file, save the file to the `permissioning-smart-contracts` directory. - -::: - -### 13. Deploy the contracts - -In the `permissioning-smart-contracts` directory, while your network is running, deploy the Admin and Rules contracts: - -```bash -yarn truffle migrate --reset --network besu -``` - -This also updates the Ingress contract with the name and version of the Admin and Rules contracts. The migration logs the addresses of the Admin and Rules contracts. - -:::important - -The account that deploys the contracts is automatically an admin account. - -::: - - - -[Node-1, Node-2, Node-3, and Node-4 to the allowlist]: ../../how-to/use-permissioning/onchain.md#update-nodes-allowlist -[IBFT 2.0 proof of authority (PoA)]: ../../how-to/configure/consensus/ibft.md diff --git a/docs/private-networks/tutorials/permissioning/upgrade-contracts.md b/docs/private-networks/tutorials/permissioning/upgrade-contracts.md deleted file mode 100644 index 7d44a43b56a..00000000000 --- a/docs/private-networks/tutorials/permissioning/upgrade-contracts.md +++ /dev/null @@ -1,167 +0,0 @@ ---- -title: Upgrade permissioning contracts -sidebar_position: 2 -description: Upgrade the permissioning contracts for onchain permissioning -tags: - - private networks ---- - -# Upgrade permissioning contracts - -The following tutorial describes the steps to upgrade the onchain permissioning contracts to the latest version. - -:::caution Please use this as reference material only! - -The [permissioning-contract-repo](https://github.com/ConsenSys/permissioning-smart-contracts) has been archived and is intended as reference material only. -Please update all dependencies in there before proceeding. - -In addition we also recommend using [Hardhat](https://hardhat.org/hardhat-runner/docs/guides/deploying) instead of [Truffle](https://trufflesuite.com/), -as the development environment. Please refer to the [Quorum Dev Quickstart](../../tutorials/quickstart.md) for an example. - -::: - -## Prerequisites - - - -- [Node.js](https://nodejs.org/en/) v10.16.0 or later - -- [Yarn](https://yarnpkg.com/en/) v1.15 or later -- Browser with [MetaMask installed](https://metamask.io/). - - -## Steps - - -### 1. Get the latest contracts and install dependencies - -:::note - -Pull the latest changes if you already have a cloned repository using the `git pull` command inside the `permissioning-smart-contracts` directory. - -::: - -1. Clone the `permissioning-smart-contracts` repository: - - ```bash - git clone https://github.com/ConsenSys/permissioning-smart-contracts.git - ``` - -### 3. Update environment variables - -If using a `.env` file to configure environment variables, then the file must be in the `permissioning-smart-contracts` directory. - -:::tip - -You can use environment variables to retain existing contracts if required. For example: - -- `RETAIN_ADMIN_CONTRACT=true` to retain the current admin list -- `RETAIN_NODE_RULES_CONTRACT=true` to retain the current Node rules contract -- `RETAIN_ACCOUNT_RULES_CONTRACT=true` to retain the current Account rules contract - -::: - -1. Legacy: If they exist, rename the following environment variables: - - - `PANTHEON_NODE_PERM_ACCOUNT` to `BESU_NODE_PERM_ACCOUNT` - - `PANTHEON_NODE_PERM_KEY` to `BESU_NODE_PERM_KEY` - - `PANTHEON_NODE_PERM_ENDPOINT` to `BESU_NODE_PERM_ENDPOINT` - -2. If updating from v1 to v2, you need to re-deploy the `NodeIngress` contract. In order to do this, first delete the `NODE_INGRESS_CONTRACT_ADDRESS` environment variable. - - :::important - - This step is only required if upgrading from v1 of the node permissioning contract to v2 (because the interface changed, a new `NodeIngress` contract must be deployed). - - ::: - -### 4. Optional: Export current allowlists - -:::note - -This step enables you to export the current allowlists to assist in updating. - -::: - -1. Export the current allowlists by setting the following environment variables: - - ```bash - RETAIN_ADMIN_CONTRACT=true - RETAIN_NODE_RULES_CONTRACT=true - RETAIN_ACCOUNT_RULES_CONTRACT=true - ``` - -2. Log the current allowlists to console: - - ```bash - truffle migrate --reset - ``` - - The migration scripts will log the existing allowlists to the console, but no contracts will be deployed. - -3. Set initial values for updated deployment using the values logged in the previous step: - - ```bash - INITIAL_ADMIN_ACCOUNTS= - INITIAL_ALLOWLISTED_ACCOUNTS= - INITIAL_ALLOWLISTED_NODES= - ``` - -4. Update environment variables for contracts that are to be deployed. For example: - - ```bash - RETAIN_ADMIN_CONTRACT=true - RETAIN_NODE_RULES_CONTRACT=false - RETAIN_ACCOUNT_RULES_CONTRACT=false - ``` - -### 5. Deploy the contracts - -1. In the `permissioning-smart-contracts` directory, deploy the contracts: - - ```bash - truffle migrate --reset - ``` - - :::important - - - If updating from v1 to v2, the new `NodeIngress` contract address must be specified when restarting the Besu nodes. Copy this address from the migration output. For example: - - ```bash - > Deployed NodeIngress contract to address = 0x12B1f953395080A13AeED0dC4d0bb14e787A91cF - ``` - - - If upgrading from v2 (using separate storage contracts) copy the `Storage` contract addresses displayed in the output. For example: - - ``` - > Deployed NodeStorage contract to address = 0x4F3e35A3Be3C1b77Ade39969D175C743ad3484Ee - ... - > Deployed AccountStorage contract to address = 0x2362187023D738034B516438Af187356b31E8Fb8 - ``` - - ::: - -1. Set the storage contract address environment variables to ensure that the storage contracts are not re-deployed. For example: - - ```bash - NODE_STORAGE_CONTRACT_ADDRESS=0xE0bF6021e023a197DBb3fABE64efA880E13D3f4b - ACCOUNT_STORAGE_CONTRACT_ADDRESS=0x7153CCD1a20Bbb2f6dc89c1024de368326EC6b4F - ``` - -1. Deploy the updated contracts: - - ```bash - truffle migrate --reset - ``` - -### 6. Restart Besu nodes - -Restart the Besu nodes with the updated [`NodeIngress`](#5-deploy-the-contracts) contract address and [permissioning contract interface](../../how-to/use-permissioning/onchain.md#specify-the-permissioning-contract-interface-version) version 2. - -```besu -cmd besu --data-path=data --genesis-file=../genesis.json --permissions-accounts-contract-enabled --permissions-accounts-contract-address "0x0000000000000000000000000000000000008888" --permissions-nodes-contract-enabled --permissions-nodes-contract-address "0x4E72770760c011647D4873f60A3CF6cDeA896CD8" --permissions-nodes-contract-version=2 --rpc-http-enabled --rpc-http-cors-origins="*" --rpc-http-api=ADMIN,ETH,NET,PERM,IBFT --host-allowlist="*" -``` - - - -[nodes to the allowlist]: ../../how-to/use-permissioning/onchain.md#update-nodes-allowlist From ae3abdfdc366ec5e946cca957161dd937defde9e Mon Sep 17 00:00:00 2001 From: MadelineMurray <43356962+MadelineMurray@users.noreply.github.com> Date: Thu, 23 Nov 2023 03:01:26 +1000 Subject: [PATCH 2/4] Fixed formatting issue (#1455) Signed-off-by: madelinemurray Co-authored-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> --- docs/public-networks/reference/api/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/public-networks/reference/api/index.md b/docs/public-networks/reference/api/index.md index 1a6500e75c6..263a241c11b 100644 --- a/docs/public-networks/reference/api/index.md +++ b/docs/public-networks/reference/api/index.md @@ -1485,7 +1485,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"debug_storageRangeAt","params":[ } ``` -::: + ### `debug_traceTransaction` From 08b830e366dfdfeab7b7d8009c56697c41dce774 Mon Sep 17 00:00:00 2001 From: MadelineMurray <43356962+MadelineMurray@users.noreply.github.com> Date: Thu, 23 Nov 2023 05:44:30 +1000 Subject: [PATCH 3/4] Added CLI option and API methods for min priority fee (#1452) * Added CLI option and API methods for min priority fee Signed-off-by: madelinemurray * Apply suggestions from code review Signed-off-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> --------- Signed-off-by: madelinemurray Signed-off-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> Co-authored-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> --- docs/public-networks/reference/api/index.md | 93 ++++++++++++++++++- docs/public-networks/reference/cli/options.md | 35 +++++++ 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/docs/public-networks/reference/api/index.md b/docs/public-networks/reference/api/index.md index 263a241c11b..545efc00d21 100644 --- a/docs/public-networks/reference/api/index.md +++ b/docs/public-networks/reference/api/index.md @@ -5408,7 +5408,11 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_uninstallFilter","params":[" ## `MINER` methods -The `MINER` API methods allow you to control the node’s mining operation. +The `MINER` API methods allow you to control: + +* The node’s mining operation. +* Settings related to block creation. + :::note @@ -5459,6 +5463,49 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_changeTargetGasLimit","par +### `miner_getMinPriorityFee` + +Gets the minimum priority fee per gas (in Wei) offered by a transaction to be included in a block. The initial value is set using the [`--min-priority-fee`](../cli/options.md#min-priority-fee) command line option, or is set to `0` if the command line option is not specified. +Use [`miner_setMinPriorityFee`](#minersetminpriorityfee) to change the current value of the fee. + +#### Parameters + +None + +#### Returns + +`result`: _string_ - Minimum priority fee per gas (in Wei) as a hexadecimal string + + + +# curl HTTP request + +```bash +curl -X POST --data '{"jsonrpc":"2.0","method":"miner_getMinPriorityFee","params":[],"id":1}' http://127.0.0.1:8545 +``` + +# wscat WS request + +```json +{ + "jsonrpc": "2.0", + "method": "miner_getMinPriorityFee", + "params": [], + "id": 1 +} +``` + +# JSON result + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": 0x1 +} +``` + + ### `miner_setCoinbase` Sets the coinbase, the address for the mining rewards. @@ -5508,6 +5555,50 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setCoinbase","params":["0x +### `miner_setMinPriorityFee` + +Sets the minimum priority fee per gas (in Wei) offered by a transaction to be included in a block. The initial value is set using the [`--min-priority-fee`](../cli/options.md#min-priority-fee) command line option, or is set to `0` if the command line option is not specified. +Use [`miner_getMinPriorityFee`](#minergetminpriorityfee) to get the current value of the fee. + +#### Parameters + +`minPriorityFeePerGas`: _integer_ - Minimum priority fee per gas + +#### Returns + +`result`: _boolean_ - `true` when fee is set + + + +# curl HTTP request + +```bash +curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setMinPriorityFee","params":[1],"id":1}' http://127.0.0.1:8545 +``` + +# wscat WS request + +```json +{ + "jsonrpc": "2.0", + "method": "miner_setMinPriorityFee", + "params": [1], + "id": 1 +} +``` + +# JSON result + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": true +} +``` + + + ### `miner_start` Starts the mining process. To start mining, you must first specify a miner coinbase using the [`--miner-coinbase`](../cli/options.md#miner-coinbase) command line option or using [`miner_setCoinbase`](#miner_setcoinbase). diff --git a/docs/public-networks/reference/cli/options.md b/docs/public-networks/reference/cli/options.md index efff24dc2fe..ea7b80e70b8 100644 --- a/docs/public-networks/reference/cli/options.md +++ b/docs/public-networks/reference/cli/options.md @@ -1873,6 +1873,41 @@ In a [free gas network](../../../private-networks/how-to/configure/free-gas.md), ::: +### `min-priority-fee` + + + +# Syntax + +```bash +--min-priority-fee= +``` + +# Example + +```bash +--min-gas-price=7 +``` + +# Environment variable + +```bash +BESU_MIN_PRIORITY_FEE=7 +``` + +# Configuration file + +```bash +min-priority-fee=7 +``` + + + +The minimum priority fee per gas (in Wei) offered by a transaction to be included in a block. The default is `0`. +For a running node, use: +* [`miner_getMinPriorityFee`](../api/index.md#minergetminpriorityfee) to get the value. +* [`miner_setMinPriorityFee`](../api/index.md#minersetminpriorityfee) to change the value. + ### `nat-method` From e9a401692e48ebbc68e6252ce570aa6b1385741c Mon Sep 17 00:00:00 2001 From: MadelineMurray <43356962+MadelineMurray@users.noreply.github.com> Date: Thu, 23 Nov 2023 05:44:52 +1000 Subject: [PATCH 4/4] Clarified behaviour of eth_call strict parameter (#1454) Signed-off-by: madelinemurray Co-authored-by: Sally MacFarlane Co-authored-by: Alexandra Tran Carrillo <12214231+alexandratran@users.noreply.github.com> --- docs/public-networks/reference/api/index.md | 7 ++++++- docs/public-networks/reference/api/objects.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/public-networks/reference/api/index.md b/docs/public-networks/reference/api/index.md index 545efc00d21..f76d372d9c4 100644 --- a/docs/public-networks/reference/api/index.md +++ b/docs/public-networks/reference/api/index.md @@ -1980,7 +1980,12 @@ By default, the `eth_call` error response includes the [revert reason](../../../ :::note -By default, `eth_call` does not fail if the sender account has an insufficient balance. This is done by setting the balance of the account to a large amount of ether. To enforce balance rules, set the [`strict` parameter](objects.md#transaction-call-object) in the transaction call object to `true`. +The [`strict` parameter](objects.md#transaction-call-object) determines if the sender account balance is checked: +* If `strict:true`, the balance is checked and `eth_call` fails if the sender account has an insufficient balance to send the transaction with the specified gas parameters. +* If `strict:false`, the balance is not checked and `eth_call` can succeed even if the sender account has an insufficient balance. +* If `strict` is not specified, the balance is checked against the gas parameters if supplied. + +If you do not want the sender account balance checked, send zero gas or specify `strict:false`. ::: diff --git a/docs/public-networks/reference/api/objects.md b/docs/public-networks/reference/api/objects.md index 2cabb18326b..ec349df0b73 100644 --- a/docs/public-networks/reference/api/objects.md +++ b/docs/public-networks/reference/api/objects.md @@ -217,7 +217,7 @@ All transaction call object parameters are optional. | `value` | Quantity, Integer | Value transferred, in Wei. | | `data` or `input` | Data | Hash of the method signature and encoded parameters. For details, see [Ethereum Contract ABI](https://solidity.readthedocs.io/en/develop/abi-spec.html). | | `accessList` | Array | List of addresses and storage keys that the transaction plans to access. Used only in non-[`FRONTIER`](../../concepts/transactions/types.md#frontier-transactions) transactions. | -| `strict` | Tag | If `true`, checks that the `from` account’s ether balance is sufficient to cover the transaction and gas fee. If `false`, the `gasPrice` and `baseFee` are set to zero, in order to simulate a transaction without enforcing a balance check. The default is `false`. | +| `strict` | Tag | Determines if the sender account balance is checked. If `true`, the balance is checked. If `false`, the balance is not checked. If not specified, the balance is checked against the gas parameters if supplied.| ## Transaction receipt object