|
1 | | -Prereqs |
2 | | -In order to use the optimal vectorized poseidon hashing for the Sparse Merkle Tree, on x86 the following packages are required (for Apple silicon it will fall back to the iden3 library and as such these dependencies are not required in that case. |
| 1 | +## Prerequisites |
3 | 2 |
|
4 | | -Please install: |
| 3 | +1. The installation requires [Go 1.19](https://go.dev/doc/manage-install). |
5 | 4 |
|
6 | | -Linux: libgtest-dev libomp-dev libgmp-dev |
7 | | -MacOS: brew install libomp brew install gmp |
8 | | -Using the Makefile command: make build-libs will install these for the relevant architecture. |
| 5 | +2. Install the relevant libraries for your architecture by running: |
9 | 6 |
|
10 | | -Due to dependency requirements Go 1.19 is required to build. |
| 7 | + ```sh |
| 8 | + make build-libs |
| 9 | + ``` |
11 | 10 |
|
12 | | -Sequencer (WIP) |
13 | | -Enable Sequencer: CDK_ERIGON_SEQUENCER=1 ./build/bin/cdk-erigon <flags> |
| 11 | +!!! tip "Hardware specifics" |
| 12 | + - On x86, the following packages are used by the optimal, vectorized, Poseidon hashing for the sparse Merkle tree: |
| 13 | + |
| 14 | + - Linux: `libgtest-dev libomp-dev libgmp-dev` |
| 15 | + - MacOS: `libomp brew install gmp` |
| 16 | + |
| 17 | + - For Apple silicon, the `iden3` library is used instead. |
| 18 | + |
| 19 | +## Set up sequencer (WIP) |
| 20 | + |
| 21 | +Run the following to enable the sequencer: |
| 22 | + |
| 23 | +```sh |
| 24 | +CDK_ERIGON_SEQUENCER=1 ./build/bin/cdk-erigon <flags> |
| 25 | +``` |
| 26 | + |
| 27 | +### Special mode - L1 recovery |
14 | 28 |
|
15 | | -Special mode - L1 recovery |
16 | 29 | The sequencer supports a special recovery mode which allows it to continue the chain using data from the L1. To enable this add the flag zkevm.l1-sync-start-block: [first l1 block with sequencer data]. It is important to find the first block on the L1 from the sequencer contract that contains the sequenceBatches event. When the node starts up it will pull of the L1 data into the cdk-erigon database and use this during execution rather than waiting for transactions from the txpool, effectively rebuilding the chain from the L1 data. This can be used in tandem with unwinding the chain, or using the zkevm.sync-limit flag to limit the chain to a certain block height before starting the L1 recovery (useful if you have an RPC node available to speed up the process). |
17 | 30 |
|
18 | 31 | Important Note: If using the zkevm.sync-limit flag you need to go to the boundary of a batch+1 block so if batch 41 ends at block 99 then set the sync limit flag to 100. |
19 | 32 |
|
20 | | -zkEVM-specific API Support |
21 | | -In order to enable the zkevm_ namespace, please add 'zkevm' to the http.api flag (see the example config below). |
22 | | - |
23 | | -Supported |
24 | | -zkevm_batchNumber |
25 | | -zkevm_batchNumberByBlockNumber |
26 | | -zkevm_consolidatedBlockNumber |
27 | | -zkevm_isBlockConsolidated |
28 | | -zkevm_verifiedBatchNumber |
29 | | -zkevm_isBlockVirtualized |
30 | | -zkevm_virtualBatchNumber |
31 | | -zkevm_getFullBlockByHash |
32 | | -zkevm_getFullBlockByNumber |
33 | | -Supported (remote) |
34 | | -zkevm_getBatchByNumber |
35 | | -Not yet supported |
36 | | -zkevm_getNativeBlockHashesInRange |
37 | | -Deprecated |
38 | | -zkevm_getBroadcastURI - it was removed by zkEvm |
39 | | -Limitations/Warnings |
| 33 | +## Enable zkEVM APIs |
| 34 | + |
| 35 | +In order to enable the `zkevm_ namespace`, add `zkevm` to the `http.api` flag (see the example config below??). |
| 36 | + |
| 37 | +### Supported functions |
| 38 | + |
| 39 | +`zkevm_batchNumber` |
| 40 | +`zkevm_batchNumberByBlockNumber` |
| 41 | +`zkevm_consolidatedBlockNumber` |
| 42 | +`zkevm_isBlockConsolidated` |
| 43 | +`zkevm_verifiedBatchNumber` |
| 44 | +`zkevm_isBlockVirtualized` |
| 45 | +`zkevm_virtualBatchNumber` |
| 46 | +`zkevm_getFullBlockByHash` |
| 47 | +`zkevm_getFullBlockByNumber` |
| 48 | + |
| 49 | +### Supported (remote) |
| 50 | + |
| 51 | +`zkevm_getBatchByNumber` |
| 52 | + |
| 53 | +### Not yet supported |
| 54 | + |
| 55 | +`zkevm_getNativeBlockHashesInRange` |
| 56 | + |
| 57 | +### Deprecated |
| 58 | + |
| 59 | +`zkevm_getBroadcastURI` - removed by zkEVM |
| 60 | + |
| 61 | +## Limitations/warnings |
| 62 | + |
40 | 63 | The golden poseidon hashing will be much faster on x86, so developers on Mac may experience slowness on Apple silicone |
41 | 64 | Falling behind the network significantly will cause a SMT rebuild - which will take some time for longer chains |
42 | | -Configuration Files |
| 65 | + |
| 66 | +### Configuration files |
| 67 | + |
43 | 68 | Config files are the easiest way to configure cdk-erigon, there are examples in the repository for each network e.g. hermezconfig-mainnet.yaml.example. |
44 | 69 |
|
45 | 70 | Depending on the RPC provider you are using, you may wish to alter zkevm.rpc-ratelimit. |
46 | 71 |
|
47 | | -Running CDK-Erigon |
| 72 | +## Running CDK-Erigon |
48 | 73 | Build using make cdk-erigon |
49 | 74 | Set up your config file (copy one of the examples found in the repository root directory, and edit as required) |
50 | 75 | run ./build/bin/cdk-erigon --config="./hermezconfig-{network}.yaml" (complete the name of your config file as required) |
51 | 76 | NB: --externalcl flag is removed in upstream erigon so beware of re-using commands/config |
52 | 77 |
|
53 | | -Run modes |
| 78 | +### Run modes |
54 | 79 | cdk-erigon can be run as an RPC node which will use the data stream to fetch new block/batch information and track a remote sequencer (the default behaviour). It can also run as a sequencer. To enable the sequencer, set the CDK_ERIGON_SEQUENCER environment variable to 1 and start the node. cdk-erigon supports migrating a node from being an RPC node to a sequencer and vice versa. To do this, stop the node, set the CDK_ERIGON_SEQUENCER environment variable to the desired value and restart the node. Please ensure that you do include the sequencer specific flags found below when running as a sequencer. You can include these flags when running as an RPC to keep a consistent configuration between the two run modes. |
55 | 80 |
|
56 | 81 | Docker (DockerHub) |
|
0 commit comments