Skip to content

Commit 638fe2e

Browse files
authored
Merge pull request #910 from onflow/mpeter/update-mainnet-evm-genesis-block
Update `MainnetInitCadenceHeight` to the first height of `mainnet25`
2 parents 64ff062 + dfc216b commit 638fe2e

File tree

3 files changed

+42
-32
lines changed

3 files changed

+42
-32
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ OS :=
1919
COMPILER_FLAGS := CGO_ENABLED=1
2020

2121
EMULATOR_ARGS := --flow-network-id=flow-emulator \
22+
--access-node-grpc-host=localhost:3569 \
2223
--coinbase=$(EMULATOR_COINBASE) \
23-
--coa-address=$(EMULATOR_COA_ADDRESS) \
24-
--coa-key=$(EMULATOR_COA_KEY) \
24+
--coa-address=$(EMULATOR_COA_ADDRESS) \
25+
--coa-key=$(EMULATOR_COA_KEY) \
2526
--wallet-api-key=2619878f0e2ff438d17835c2a4561cb87b4d24d72d12ec34569acd0dd4af7c21 \
2627
--gas-price=0 \
2728
--log-writer=console \
2829
--tx-state-validation=local-index \
2930
--profiler-enabled=true \
3031
--profiler-port=6060 \
31-
--ws-enabled=true
32+
--ws-enabled=true \
33+
--coa-tx-lookup-enabled=true
3234

3335
# Set VERSION from command line, environment, or default to SHORT_COMMIT
3436
VERSION ?= $(SHORT_COMMIT)
@@ -168,7 +170,6 @@ docker-pull-version:
168170
# Requires the following ENV variables:
169171
# - ACCESS_NODE_GRPC_HOST: [access.devnet.nodes.onflow.org:9000 | access.mainnet.nodes.onflow.org:9000]
170172
# - FLOW_NETWORK_ID: [flow-testnet, flow-mainnet]
171-
# - INIT_CADENCE_HEIGHT: [testnet: 211176670, mainnet: 85981135]
172173
# - COINBASE: To be set by the operator. This is an EVM EOA or COA address which is set as the receiver of GW transaction fees (remove 0x prefix)
173174
# - COA_ADDRESS: To be set by the operator. This is a Cadence address which funds gateway operations (remove 0x prefix)
174175
# - COA_KEY: A full weight, private key belonging to operator COA_ADDRESS (remove 0x prefix). NB: For development use only. We recommend using cloud KMS configuration on mainnet
@@ -215,7 +216,6 @@ endif
215216

216217
$(call check_and_append,access-node-grpc-host,ACCESS_NODE_GRPC_HOST)
217218
$(call check_and_append,flow-network-id,FLOW_NETWORK_ID)
218-
$(call check_and_append,init-cadence-height,INIT_CADENCE_HEIGHT)
219219
$(call check_and_append,coinbase,COINBASE)
220220
$(call check_and_append,coa-address,COA_ADDRESS)
221221
$(call check_and_append,coa-key,COA_KEY)

README.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# EVM Gateway
44

5-
**EVM Gateway enables seamless interaction with EVM on Flow, mirroring the experience of engaging with any other EVM blockchain.**
5+
## EVM Gateway enables seamless interaction with EVM on Flow, mirroring the experience of engaging with any other EVM blockchain
66

77
EVM Gateway implements the Ethereum JSON-RPC API for [EVM on Flow](https://developers.flow.com/evm/about) which conforms to the Ethereum [JSON-RPC specification](https://ethereum.github.io/execution-apis/api-documentation/). The EVM Gateway is tailored for integration with the EVM environment on the Flow blockchain. Rather than implementing the full `geth` stack, the JSON-RPC API available in EVM Gateway is a lightweight implementation that uses Flow's underlying consensus and smart contract language, [Cadence](https://cadence-lang.org/docs/), to handle calls received by the EVM Gateway. For those interested in the underlying implementation details, please refer to the [FLIP #243](https://github.com/onflow/flips/issues/243) (EVM Gateway) and [FLIP #223](https://github.com/onflow/flips/issues/223) (EVM on Flow Core) improvement proposals.
88

@@ -23,7 +23,7 @@ The basic design of the EVM Gateway is as follows:
2323

2424
# Building
2525

26-
**Build from source**
26+
## Build from source
2727

2828
```bash
2929
# Make sure you pull the latest changes before running `make build`
@@ -76,7 +76,7 @@ It is acceptable to create a single Cadence account for the COA and use the EVM
7676

7777
For local development, first install [Flow CLI](https://developers.flow.com/tools/flow-cli/install). The examples below require no configuration and are intended for local development.
7878

79-
**Run from CLI**
79+
### Run from CLI
8080

8181
Before running the gateway locally you need to start the Flow Emulator:
8282

@@ -96,7 +96,7 @@ make start-local
9696
Note that the gateway will be starting from the latest emulator block, so if the emulator is run before any transactions happen in the meantime, the gateway will not fetch those historical blocks & transactions.
9797
This will be improved soon.
9898

99-
**Run with Docker**
99+
### Run with Docker
100100

101101
Using Docker for local development is also supported. The following target builds the current source directory into a docker image
102102

@@ -108,7 +108,7 @@ This target starts the flow emulator and then runs the EVM Gateway using the ima
108108
make docker-run-local
109109
```
110110

111-
**Verify**
111+
## Verify
112112

113113
To verify the service is up and running:
114114

@@ -131,7 +131,7 @@ it should return:
131131
Running against the testnet with a local build can be done by pointing the gateway to the testnet ANs and providing the correct configuration.
132132
Please refer to the configuration section and read through all the configuration flags before proceeding.
133133

134-
**Create Flow account to use for COA**
134+
### Create Flow account to use for COA
135135

136136
If you don't already have a Flow account you will need to create account keys using the following command.
137137

@@ -153,27 +153,23 @@ Signature Algorithm ECDSA_P256
153153
Then visit https://faucet.flow.com/, and use the generated `Public Key`, to create and fund your Flow testnet account.
154154
Make sure to use the Flow address and the `Private Key` for the `--coa-address` & `--coa-key` flags.
155155

156-
**Run local EVM Gateway connected to Testnet**
156+
### Run EVM Gateway connected to Testnet
157157

158158
Below is an example configuration for running against testnet, with a preconfigured testnet account.
159159

160160
```bash
161161
./flow-evm-gateway run \
162+
--access-node-spork-hosts="access-001.devnet51.nodes.onflow.org:9000,access-001.devnet52.nodes.onflow.org:9000" \
162163
--access-node-grpc-host=access.devnet.nodes.onflow.org:9000 \
163-
--access-node-spork-hosts=access-001.devnet51.nodes.onflow.org:9000 \
164164
--flow-network-id=flow-testnet \
165-
--init-cadence-height=211176670 \
166165
--ws-enabled=true \
167166
--coinbase=FACF71692421039876a5BB4F10EF7A439D8ef61E \
168-
--coa-address=62631c28c9fc5a91 \
169-
--coa-key=2892fba444f1d5787739708874e3b01160671924610411ac787ac1379d420f49 \
167+
--coa-address=<16-character hexadecimal address> \
168+
--coa-key=<64-character hexadecimal private key> \
170169
--gas-price=100
171170
```
172171

173-
The `--init-cadence-height` is the Flow block height to start indexing from. To index the full EVM state, from its beginning, the proper value for this flag for testnet is `211176670`. This is the height where the `EVM` contract was first deployed on testnet, and this is where the EVM state starts from.
174-
175172
If you wish to test this out with your own Access Node, simply set `--access-node-grpc-host` to the DNS or IP where it is hosted.
176-
**Note:** You need to make sure that the testnet Access Node which the gateway is connected to has indexed at least up to Flow block height `211176670`.
177173

178174
For the `--gas-price`, feel free to experiment with different values.
179175

@@ -195,16 +191,15 @@ Should return a response similar to:
195191
}
196192
```
197193

198-
**Run local EVM GW docker container connected to Testnet**
194+
### Run local EVM GW docker container connected to Testnet
199195

200-
To use the `make` target to connect a container based gateway instance to testnet requires the following environment variables to be set.
196+
To use the `make` target to connect a container-based gateway instance to testnet requires the following environment variables to be set.
201197

202198
* `ACCESS_NODE_GRPC_HOST`: access.devnet.nodes.onflow.org:9000
203199
* `FLOW_NETWORK_ID`: flow-testnet
204-
* `INIT_CADENCE_HEIGHT`: 211176670
205200
* `COINBASE`: FACF71692421039876a5BB4F10EF7A439D8ef61E
206-
* `COA_ADDRESS`: 62631c28c9fc5a91
207-
* `COA_KEY`: 2892fba444f1d5787739708874e3b01160671924610411ac787ac1379d420f49
201+
* `COA_ADDRESS`: <16-character hexadecimal address>
202+
* `COA_KEY`: <64-character hexadecimal private key>
208203
* `VERSION`: [_repo commit hash or tag version used when building with docker_]
209204

210205
Once set, this target starts the EVM Gateway for the specified image version and connects it to testnet
@@ -217,6 +212,20 @@ make docker-run
217212
Guidance for EVM Gateway node operations including considerations for mainnet, hardware specs, monitoring setup and troubleshooting
218213
can be found in the EVM Gateway [node operations docs](https://developers.flow.com/networks/node-ops/evm-gateway/evm-gateway-setup).
219214

215+
Below is an example configuration for running against mainnet, with a preconfigured mainnet account.
216+
217+
```bash
218+
./flow-evm-gateway run \
219+
--access-node-spork-hosts="access-001.mainnet25.nodes.onflow.org:9000,access-001.mainnet26.nodes.onflow.org:9000" \
220+
--access-node-grpc-host=access.mainnet.nodes.onflow.org:9000 \
221+
--flow-network-id=flow-mainnet \
222+
--ws-enabled=true \
223+
--coinbase=FACF71692421039876a5BB4F10EF7A439D8ef61E \
224+
--coa-address=<16-character hexadecimal address> \
225+
--coa-key=<64-character hexadecimal private key> \
226+
--gas-price=100000000
227+
```
228+
220229
## Configuration Flags
221230

222231
The application can be configured using the following flags at runtime:
@@ -231,7 +240,6 @@ The application can be configured using the following flags at runtime:
231240
| `access-node-spork-hosts` | `""` | Previous spork AN hosts, defined as a comma-separated list (e.g. `"host-1.com,host2.com"`) |
232241
| `flow-network-id` | `flow-emulator` | Flow network ID (options: `flow-emulator`, `flow-testnet`, `flow-mainnet`) |
233242
| `coinbase` | `""` | Coinbase address to use for fee collection |
234-
| `init-cadence-height` | `0` | Cadence block height to start indexing; avoid using on a new network |
235243
| `gas-price` | `1` | Static gas price for EVM transactions |
236244
| `enforce-gas-price` | `true` | Enable enforcing minimum gas price for EVM transactions. When true (default), transactions must specify a gas price greater than or equal to the configured gas price. |
237245
| `coa-address` | `""` | Flow address holding COA account for submitting transactions |
@@ -286,14 +294,15 @@ To connect using Websockets you can use the same DNS names as above but change `
286294
# JSON-RPC API
287295
The EVM Gateway implements APIs according to the Ethereum specification: https://ethereum.org/en/developers/docs/apis/json-rpc/#json-rpc-methods.
288296

289-
**Additional APIs**
290-
- Tracing APIs allows you to fetch execution traces
291-
* `debug_traceTransaction`
292-
* `debug_traceBlockByNumber`
293-
* `debug_traceBlockByHash`
297+
## Additional APIs
298+
- Tracing APIs allow fetching execution traces
299+
* `debug_traceTransaction`
300+
* `debug_traceBlockByNumber`
301+
* `debug_traceBlockByHash`
302+
* `debug_traceCall`
294303
- `debug_flowHeightByBlock` - returns the flow block height for the given EVM block (id or height)
295304

296-
**Unsupported APIs**
305+
## Unsupported APIs
297306
- Wallet APIs: we don't officially support wallet APIs (`eth_accounts`, `eth_sign`, `eth_signTransaction`, `eth_sendTransaction`) due to security
298307
concerns that come with managing the keys on production environments, however, it is possible to configure the gateway to allow these
299308
methods for local development by using a special flag `--wallet-api-key`.

config/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const (
3030

3131
// Mainnet height at which the `EVM` system contract was first deployed.
3232
// This is the first height at which the EVM state starts.
33-
MainnetInitCadenceHeight = uint64(85981134)
33+
// reference: https://github.com/onflow/flow/blob/9203b57a04d422360de257bcd92c522a2f51d3b0/sporks.json#L91
34+
MainnetInitCadenceHeight = uint64(85981135)
3435
)
3536

3637
type TxStateValidation string

0 commit comments

Comments
 (0)