bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 8쪽 중 4쪽
files, the databases have the correct host / user / password value. You can test connectivity using the command line before proceeding with the installation.
## Commercial RPC nodes
For reference, you can also subscribe to the following third-party RPC vendors.
* **BlockPI**: <https://blockpi.io/>
* .......
# Deploy a validator node
# Mainnet fork9 upgrade guideline
## Upgrade time window
Upgrade time window: 2025-01-24 02:00-14:00 UTC time.
## Release notes
* cdk-validium-node
* version: v2.1.1 upgrade to v3.1.0
* github: <https://github.com/MerlinLayer2/merlin-cdk-validium-node/releases/v3.1.0>
* zkevm-prover
* version: v5.0.9 upgrade to v6.0.2
* github: <https://github.com/0xPolygonHermez/zkevm-prover/releases/tag/v6.0.2>
## Latest block confirmation
fork8 last block halt number is "0x1d8e1d", you will need to ensure that your local node has synchronized to this height first.
```bash
curl http://127.0.0.1:8123/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"zkevm_batchNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```
## Version upgrade
* After you confirm that your local node has synchronized to the halt number, stop and remove cdk-validium-sync / cdk-validium-json-rpc / cdk-validium-prover.
```
docker compose down cdk-validium-sync cdk-validium-json-rpc cdk-validium-prover
```
* Add addtional index for db migration
```sql
CREATE INDEX IF NOT EXISTS idx_virtual_batch_block_num ON state.virtual_batch(block_num);
CREATE INDEX IF NOT EXISTS idx_verified_batch_block_num ON state.verified_batch(block_num);
CREATE INDEX IF NOT EXISTS idx_forced_batch_block_num ON state.forced_batch(block_num);
CREATE INDEX IF NOT EXISTS idx_exit_root_block_num ON state.exit_root(block_num);
CREATE INDEX IF NOT EXISTS idx_monitored_txs_block_num ON state.monitored_txs(block_num);
CREATE INDEX IF NOT EXISTS idx_fork_id_block_num ON state.fork_id(block_num);
```
* Change "SyncOnlyTrusted" to "true" in node.config.toml
```toml
SyncOnlyTrusted = true
```
* Upgrade the image version in your docker-compose.yml:
* cdk-validium-sync: `image: merlinadmin/zkevm-node:v2.1.1` change to `image: merlinadmin/zkevm-node:v3.1.0`
* cdk-validium-json-rpc: `image: merlinadmin/zkevm-node:v2.1.1` change to `image: merlinadmin/zkevm-node:v3.1.0`
* cdk-validium-prover: `image: merlinadmin/zkprover:v5.0.9` change to `image: hermeznetwork/zkevm-prover:v6.0.2`
* Launch the new version of services by below steps
* Launch prover first:
```sh
docker compose up -d cdk-validium-prover
```
* Launch synchronizer and then wait migrations completed:
```sh
docker compose up -d cdk-validium-sync
```
* Launch json-rpc:
```sh
docker compose up -d cdk-validium-json-rpc
```
* Update forkId and then restart cdk-validium-sync / json-rpc
{% code overflow="wrap" %}
```sql
UPDATE state.fork_id SET from_batch_num = 1642245,to_batch_num = 1936925,version = '', block_num = 2017235 WHERE fork_id = 8;
INSERT INTO state.fork_id (fork_id, from_batch_num, to_batch_num, version, block_num) VALUES (9, 1936926, 18446744073709551615, '', 6249456);
```
{% endcode %}
## Upgrade result verification
Make sure the new synchronizer can get the new fork9 block data. 
# Deploy an erigon rpc for mainnet
## Deployment Overview
* Recommend using a dedicated server to separate from the fork9 JSON-RPC server.
* Recommended configuration: CPU: 4 vCores, RAM: 32GB, Disk: 1TB, NVMe SSD. Higher IOPS and throughput performance will yield better results. It is recommended to have 250,000 IOPS and 1000 MiB/s throughput.
## Deployment Steps
### Prepare configuration files
#### docker compose file
```yaml
version: "3.5"
networks:
default:
name: cdk-erigon
services:
cdk-erigon-rpc:
container_name: cdk-erigon-rpc
image: merlinadmin/cdk-erigon:v2.0.3
stop_grace_period: 600s
restart: always
environment:
- CDK_ERIGON_SEQUENCER=0
ports:
- 9123:8123
- 7990:6990
- 9124:8124
volumes:
- ./erigon_config/config-rpc.yaml:/usr/src/app/config.yaml
- ./erigon_config/dynamic-merlinmainnet-allocs.json:/usr/src/app/dynamic-merlinmainnet-allocs.json
- ./erigon_config/dynamic-merlinmainnet-chainspec.json:/usr/src/app/dynamic-merlinmainnet-chainspec.json
- ./erigon_config/dynamic-merlinmainnet-conf.json:/usr/src/app/dynamic-merlinmainnet-conf.json
- ./erigon_data:/usr/src/app/data
command: >
--http.vhosts=* --http.corsdomain=* --ws --config=/usr/src/app/config.yaml
logging:
options:
max-size: "1g"
max-file: "3"
```
#### config-rpc.yaml
```yaml
datadir: /usr/src/app/data/
chain: dynamic-merlinmainnet
http: true
private.api.addr: localhost:9098
torrent.port: 42070
authrpc.port: 8552
zkevm.l2-chain-id: 4200
zkevm.l2-sequencer-rpc-url: http://mainnet-public-datastreamer.merlinchain.io:2081
zkevm.l2-datastreamer-url: mainnet-public-datastreamer.merlinchain.io:2080
zkevm.l1-chain-id: 202401
zkevm.l1-rpc-url: https://mainnet-l1.merlinchain.io
zkevm.address-sequencer: "0x1B46c54ebE88F22cBFf2Bd4eB4545C47Bb2f3017"
zkevm.address-zkevm: "0xBf4B031eb29fc34E2bCb4327F9304BED3600cc46"
zkevm.address-admin: "0x6229976bf881Ee0e2499e8bDbDFd44E396b2aE7d"
zkevm.address-rollup: "0x68DdbE6638d7514a9Ed0B9B2980B65970e532cdB"
zkevm.address-ger-manager: "0x8b97BF5C42739C375a2db080813E9b4C9A4a2c9A"
zkevm.l1-rollup-id: 1
zkevm.l1-first-block: 85544
zkevm.l1-block-range: 20000
zkevm.l1-query-delay: 6000
zkevm.l1-highest-block-type: latest
zkevm.rpc-ratelimit: 300
zkevm.datastream-version: 2
zkevm.increment-tree-always: false
zkevm.rebuild-tree-after: 500000
log.console.verbosity: 3
zkevm.executor-urls: ""
zkevm.executor-strict: false
zkevm.witness-full: true
zkevm.sequencer-block-seal-time: "3s"
zkevm.sequencer-batch-seal-time: "10s"
zkevm.data-stream-host: "localhost"
zkevm.data-stream-port: 6990
zkevm.data-stream-writeTimeout: "100s"
zkevm.default-gas-price: 1000000000
zkevm.max-gas-price: 0
zkevm.gas-price-factor: 0.000001
externalcl: true
http.api: [eth, debug, net, trace, web3, erigon, txpool, zkevm]
http.addr: 0.0.0.0
http.port: 8123
http.vhosts: any
http.corsdomain: any
http.trace: false
rpc.evmtimeout: "30s"
ws: true
ws.addr: 0.0.0.0
ws.port: 8124
db.read.concurrency: 20000
txpool.globalslots: 100000
networkid: 4200
```
#### Static configurations
```shell
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlinmainnet-allocs.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlinmainnet-chainspec.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlinmainnet-conf.json
```
### Snapshot
#### Download erigon data snapshot
```shell
wget https://rpc-snapshot.merlinchain.io/erigon/erigon_data.tar.gz
```
#### Launch erigon
* Ensure that the erigon-config and erigon-data directories are consistent with the volumes configuration in docker-compose.yml.
```shell
docker compose up -d cdk-erigon-rpc
```
# Mainnet fork12 upgrade guideline
## Upgrade time window
Upgrade time window: 2025-06-26 02:00-14:00 UTC time.
## Release notes
* <https://github.com/MerlinLayer2/cdk-erigon/releases/tag/v2.0.0>
* <https://github.com/MerlinLayer2/cdk-erigon/releases/tag/v2.0.2>
## Deployment Overview
* Recommend using a dedicated server to separate from the fork9 JSON-RPC server.
* Recommended configuration: CPU: 4 vCores, RAM: 32GB, Disk: 1TB, NVMe SSD. Higher IOPS and throughput performance will yield better results. It is recommended to have 250,000 IOPS and 1000 MiB/s throughput.
## Deployment Steps
### Prepare configuration files
#### docker compose file
```yaml
version: "3.5"
networks:
default:
name: cdk-erigon
services:
cdk-erigon-rpc:
container_name: cdk-erigon-rpc
image: merlinadmin/cdk-erigon:v2.0.2
stop_grace_period: 600s
restart: always
environment:
- CDK_ERIGON_SEQUENCER=0
ports:
- 9123:8123
- 7990:6990
- 9124:8124
volumes:
- ./erigon_config/config-rpc.yaml:/usr/src/app/config.yaml
- ./erigon_config/dynamic-merlinmainnet-allocs.json:/usr/src/app/dynamic-merlinmainnet-allocs.json
- ./erigon_config/dynamic-merlinmainnet-chainspec.json:/usr/src/app/dynamic-merlinmainnet-chainspec.json
- ./erigon_config/dynamic-merlinmainnet-conf.json:/usr/src/app/dynamic-merlinmainnet-conf.json
- ./erigon_data:/usr/src/app/data
command: >
--http.vhosts=* --http.corsdomain=* --ws --config=/usr/src/app/config.yaml
logging:
options:
max-size: "1g"
max-file: "3"
```
#### config-rpc.yaml
```yaml
datadir: /usr/src/app/data/
chain: dynamic-merlinmainnet
http: true
private.api.addr: localhost:9098
torrent.port: 42070
authrpc.port: 8552
zkevm.l2-chain-id: 4200
zkevm.l2-sequencer-rpc-url: http://mainnet-public-datastreamer.merlinchain.io:2081
zkevm.l2-datastreamer-url: mainnet-public-datastreamer.merlinchain.io:2080
zkevm.l1-chain-id: 202401
zkevm.l1-rpc-url: https://mainnet-l1.merlinchain.io
zkevm.address-sequencer: "0x1B46c54ebE88F22cBFf2Bd4eB4545C47Bb2f3017"
zkevm.address-zkevm: "0xBf4B031eb29fc34E2bCb4327F9304BED3600cc46"
zkevm.address-admin: "0x6229976bf881Ee0e2499e8bDbDFd44E396b2aE7d"
zkevm.address-rollup: "0x68DdbE6638d7514a9Ed0B9B2980B65970e532cdB"
zkevm.address-ger-manager: "0x8b97BF5C42739C375a2db080813E9b4C9A4a2c9A"
zkevm.l1-rollup-id: 1
zkevm.l1-first-block: 85544
zkevm.l1-block-range: 20000
zkevm.l1-query-delay: 6000
zkevm.l1-highest-block-type: latest
zkevm.rpc-ratelimit: 300
zkevm.datastream-version: 2
zkevm.increment-tree-always: false
zkevm.rebuild-tree-after: 500000
log.console.verbosity: 3
zkevm.executor-urls: ""
zkevm.executor-strict: false
zkevm.witness-full: true
zkevm.sequencer-block-seal-time: "3s"
zkevm.sequencer-batch-seal-time: "10s"
zkevm.data-stream-host: "localhost"
zkevm.data-stream-port: 6990
zkevm.data-stream-writeTimeout: "100s"
zkevm.default-gas-price: 1000000000
zkevm.max-gas-price: 0
zkevm.gas-price-factor: 0.000001
externalcl: true
http.api: [eth, debug, net, trace, web3, erigon, txpool, zkevm]
http.addr: 0.0.0.0
http.port: 8123
http.vhosts: any
http.corsdomain: any
http.trace: false
rpc.evmtimeout: "30s"
ws: true
ws.addr: 0.0.0.0
ws.port: 8124
db.read.concurrency: 20000
txpool.globalslots: 100000
networkid: 4200
```
#### Static configurations
```shell
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlinmainnet-allocs.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlinmainnet-chainspec.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlinmainnet-conf.json
```
### Snapshot
#### Download erigon data snapshot
```shell
wget https://rpc-snapshot.merlinchain.io/erigon/erigon_data.tar.gz
```
#### Launch erigon
* Ensure that the erigon-config and erigon-data directories are consistent with the volumes configuration in docker-compose.yml.
```shell
docker compose up -d cdk-erigon-rpc
```
# Deploy an erigon rpc for testnet
## Deployment Overview
* Erigon RPC can be deployed independently without relying on other testnet RPC components (CDK / Prover / Database). You can choose to deploy it together with JSON-RPC or separately.
* Erigon RPC depends on a JSON-RPC and an upstream DataStreamer.
* Recommended configuration: CPU: 4 vCores, RAM: 32GB, Disk: 1TB, NVMe SSD. Higher IOPS and throughput performance will yield better results. It is recommended to have 250,000 IOPS and 1000 MiB/s throughput.
## Deployment Steps
### Prepare configuration files
#### docker compose file
```yaml
version: "3.5"
networks:
default:
name: cdk-erigon
services:
cdk-erigon-rpc:
container_name: cdk-erigon-rpc
image: merlinadmin/cdk-erigon:v2.0.3
stop_grace_period: 600s
restart: always
environment:
- CDK_ERIGON_SEQUENCER=0
ports:
- 9123:8123
- 7990:6990
volumes:
- ./erigon_config/config-rpc.yaml:/usr/src/app/config.yaml
- ./erigon_config/dynamic-merlintestnet-allocs.json:/usr/src/app/dynamic-merlintestnet-allocs.json
- ./erigon_config/dynamic-merlintestnet-chainspec.json:/usr/src/app/dynamic-merlintestnet-chainspec.json
- ./erigon_config/dynamic-merlintestnet-conf.json:/usr/src/app/dynamic-merlintestnet-conf.json
- ./erigon_config/dynamic-merlintestnet-block.json:/usr/src/app/dynamic-merlintestnet-block.json
- ./erigon_data/data:/usr/src/app/data/
command: >
--http.vhosts=* --http.corsdomain=* --ws --config=/usr/src/app/config.yaml
logging:
options:
max-size: "1g"
max-file: "3"
```
#### config-rpc.yaml
```yaml
datadir: /usr/src/app/data/
chain: dynamic-merlintestnet
http: true
private.api.addr: localhost:9098
torrent.port: 42070
authrpc.port: 8552
zkevm.l2-chain-id: 686868
zkevm.l2-sequencer-rpc-url: http://testnet-datastreamer.merlinchain.io:2081
zkevm.l2-datastreamer-url: testnet-datastreamer.merlinchain.io:2080
zkevm.l1-chain-id: 55555
zkevm.l1-rpc-url: https://testnet-l1.merlinchain.io
zkevm.address-sequencer: "0xDCdB53f6633c9D290971Af961689c96B73B79c75"
zkevm.address-zkevm: "0x8173da1A9d41287158E9b6E38Ca9CDabBAE6bb6B"
zkevm.address-admin: "0x74c4A7265Ac6B8a8AD3Ab99071B63c007616Fb33"
zkevm.address-rollup: "0xAefb2f4db0766F0D76c47d0dbc0A712D653cace6"
zkevm.address-ger-manager: "0x07eb659bd996Ac74c154dfe86Ea875570647961C"
zkevm.l1-rollup-id: 1
zkevm.l1-first-block: 24925
zkevm.l1-block-range: 20000
zkevm.l1-query-delay: 6000
zkevm.l1-highest-block-type: latest
zkevm.rpc-ratelimit: 300
zkevm.datastream-version: 2
zkevm.rebuild-tree-after: 100000
log.console.verbosity: 3
zkevm.executor-urls: ""
zkevm.executor-strict: false
zkevm.witness-full: true
zkevm.sequencer-block-seal-time: "3s"
zkevm.sequencer-batch-seal-time: "10s"
zkevm.data-stream-host: "localhost"
zkevm.data-stream-port: 6990
zkevm.data-stream-writeTimeout: "100s"
zkevm.default-gas-price: 1000000000
zkevm.max-gas-price: 0
zkevm.gas-price-factor: 0.000001
externalcl: true
http.api: [eth, debug, net, trace, web3, erigon, txpool, zkevm]
http.addr: 0.0.0.0
http.port: 8123
http.vhosts: any
http.corsdomain: any
ws: true
ws.addr: 0.0.0.0
ws.port: 8124
db.read.concurrency: 20000
txpool.globalslots: 100000
networkid: 686868
```
#### Static configurations
```shell
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlintestnet-allocs.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlintestnet-chainspec.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlintestnet-conf.json
wget https://rpc-snapshot.merlinchain.io/erigon/dynamic-merlintestnet-block.json
```
### Snapshot
#### Download erigon data snapshot
```shell
wget https://rpc-snapshot.merlinchain.io/erigon/testnet_erigon_data.tar.gz
```
#### Launch erigon
* Ensure that the erigon-config and erigon-data directories are consistent with the volumes configuration in docker-compose.yml.
```shell
docker compose up -d cdk-erigon-rpc
```
# Validator (Coming Soon)
# Ethereum & Merlin Differences
A number of technical details differ between Ethereum mainnet's EVM and Merlin's zkEVM. 
For the average Solidity developer, these details won't affect your development experience.
### EVM Opcodes
| Opcode | Status | Merlin Behavior |
| --------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SELFDESTRUCT` | Supported | Replaced by SENDALL. It sends remaining value to address, without any other status change. |
| `EXTCODEHASH` | Supported | It returns the hash of the contract bytecode from the zkEVM state tree without checking if the account is empty. |
| `DIFFICULTY` / `PREVRANDAO` | Supported | It returns "0" instead of a random number as in the EVM. |
| `NUMBER` | Supported | It returns the number of processable transactions, which is actually the number of transactions processed on the rollup, instead of current block's number. |
| `BLOCKHASH` | Supported | It is the state root at the end of a processable transaction and is stored on the system smart contract. It returns all previous block hashes instead of just the last 256 blocks. |
| `JUMPDEST` | Supported | It is allowed in PUSH bytes to avoid runtime bytecode analysis. |
| `BASEFEE` | Invalid | Disabled. If the opcode is encountered, the transaction will be reverted. |
| `BLOBHASH` | Invalid | Disabled. If the opcode is encountered, the transaction will be reverted. |
| `BLOBBASEFEE` | Invalid | Disabled. If the opcode is encountered, the transaction will be reverted. |
| `TLOAD` | Invalid | Disabled. If the opcode is encountered, the transaction will be reverted. |
| `TSTORE` | Invalid | Disabled. If the opcode is encountered, the transaction will be reverted. |
| `MCOPY` | Invalid | Disabled. If the opcode is encountered, the transaction will be reverted. |
`MCOPY`, `TSTORE`, `TLOAD`, `BLOBHASH` and `BLOBBASEFEE` are Opcodes from the Cancun upgrade. We recommend using `shanghai` as your EVM target and avoiding using a Solidity version higher than `0.8.23`. Otherwise make sure you're not using those invalid opcodes.
`BASEFEE` is invalid because EIP-1559 is not supported. Make sure you're not using `BASEFEE` or `block.basefee` in solidity.
### EVM Precompiles
The `RIPEMD-160` (address `0x3`), `blake2f` (address `0x9`) are currently not supported. Calls to unsupported precompiled contracts will revert. These precompiles are rarely used—`RIPEMD-160`, for example, has been [called a total of \~2,600 times](https://etherscan.io/txsInternal?a=0x0000000000000000000000000000000000000003\&m=advanced) *since the inception of Ethereum.*
The other EVM precompiles are well supported.
### zkEVM State Trie <a href="#zkevm-state-trie" id="zkevm-state-trie"></a>
There are some differences between the Merlin zkEVM Merkle tree and EVM Merkle tree.
A zkEVM state is stored in the form of a Sparse Merkle Tree (SMT), which is a binary tree. Instead of *Keccak-256*, the `POSEIDON` Hash Function is used to build the SMTs, mainly due to its STARK-friendliness.
It is important to note that unlike the EVM tree, the zkEVM SMT does not add all the parameters in one leaf of the Merkle tree.
For convenience and achieving faster computations, each of the parameters (the nonce, balance, storage root and code hash) is stored in its respective leaf.
An additional parameter called `codeHashLen` is used to store the length of the Code hash. A fifth leaf-type is used for this zkEVM-specific parameter.
Also, each value in a leaf is an array of eight values, \[V0,V1,V2,…,V7], where each Vi is a 32-bit element. That field is the Goldilocks prime field 𝐹𝑝 where 𝑝=2^64−2^32+1.
The 32-bit field elements are 8 in number, so as to be compatible with the 256-bit EVM words.
So although in the EVM context computation work with 256-bit words, internally the zkEVM uses 8 times 32-bit field elements.
Each of the values; V0,V1,V2,…,V7; is composed of the 32 less significant bits of the 63.99-bit Goldilocks prime field elements.
The figure below depicts the 5 leaf-types together with the corresponding keys:

### Block Interval
Merlin aims for a constant block interval of 3 seconds. While it's 12 seconds in Ethereum under ideal conditions. Having a faster, constant block interval results in quicker feedback and a better user experience.
When the load is high, the block interval may slightly exceed 3 seconds, for example, 4 seconds.
When the last block of the previous batch contains fewer transactions, the timestamp of the next block may be the same, resulting in a block interval of 0 seconds.
Otherwise, a constant block interval of 3 seconds is ensured.
### Transaction Fees
The fee structure in Merlin doesn't support EIP-1559.
In Merlin, developers had to specify a **gasPrice** value to send a transaction. After EIP-1559, the **gasPrice** parameter is replaced by **maxFeePerGas** and **maxPriorityFeePerGas**.
* **maxFeePerGas** is the maximum amount of gas fee a user is willing to pay per unit of gas for a transaction.
* **maxPriorityFeePerGas** is an optional fee that is set by the user. Using this variable, users may pay a premium for a high-priority transaction. Whenever a blo프로젝트로 돌아가기