diff --git a/README.md b/README.md index efd75b0a..b9562265 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The followi #### Ethereum Devnet -1. [Setup Aligned Devnet locally](https://github.com/yetanotherco/aligned_layer/blob/staging/docs/3_guides/6_setup_aligned.md#booting-devnet-with-default-configs) +1. [Setup Aligned (Devnet) infrastructure locally](https://docs.alignedlayer.com/guides/6_setup_aligned) 1. Setup the `.env` file of the Bridge. A template is available in `.env.template`. 1. Set `ETH_CHAIN` to `devnet`. 1. Set `MINA_RPC_URL` to the URL of the Mina node GraphQL API (See [Mina node section](#mina-node)). @@ -34,7 +34,7 @@ You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The followi Because the Bridge uses for now a forked version of Aligned, you may need to setup a local instance of Aligned to verify Mina proofs. -##### Aligned Testnet setup +##### Setup Aligned Testnet infrastructure locally You will need two Ethereum accounts: One to fund the Aligned operator (`operator_account_address`) and another to fund the Aligned batcher (`batcher_account_address`). @@ -90,13 +90,28 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator ``` 1. Setup the `contracts/scripts/.env` file. A template is available in `contracts/scripts/.env.example.holesky`. Set `PRIVATE_KEY` to the private key of the account you chose to fund the operator (the one with address `operator_account_address`). -1. Deploy Aligned contracts: - - ```sh - make deploy_aligned_contracts - ``` - - This will create `contracts/script/output/holesky/alignedlayer_deployment_output.json`. +1. Deploy the contracts with `make deploy_aligned_contracts`. + + `contracts/script/output/holesky/alignedlayer_deployment_output.json` should have been updated or created if it didn't exist before. Set the `permissions` field on that file: + + ```json + { + "addresses": { + // ... + }, + "chainInfo": { + // ... + }, + "permissions": { + "alignedLayerAggregator": "", + "alignedLayerChurner": "", + "alignedLayerEjector": "", + "alignedLayerOwner": "", + "alignedLayerUpgrader": "", + "pauserRegistry": "0x85Ef7299F8311B25642679edBF02B62FA2212F06" + } + } + ``` 1. Create 3 EigenLayer keystores: 1. Aggregator and operator ECDSA: @@ -338,6 +353,120 @@ In the Mina Bridge repo, setup the `.env` file. A template is available in `.env ### Bridge a Mina account +1. In the root folder, deploy the Bridge's contracts with: + + ```sh + make deploy_contract + ``` + + In the `.env` file, set `STATE_SETTLEMENT_ETH_ADDR` and `ACCOUNT_VALIDATION_ETH_ADDR` to the corresponding deployed contract addresses. + +1. Submit a Mina state proof to verify (**NOTE:** Because of the Aligned minimum batch size, you may need to submit two proofs to make Aligned Devnet verify them): + + - Run `make submit_devnet_state` if you are using Mina Devnet or `make submit_mainnet_state` if you are using Mina Mainnet. + +1. Submit an account to verify (**NOTE:** Because of the Aligned minimum batch size, you may need to submit two proofs to make Aligned Devnet verify them): + + ```sh + make submit_account PUBLIC_KEY= STATE_HASH= + ``` + + Where: + - `PUBLIC_KEY` is the public key of the Mina account you want to verify + - `STATE_HASH` is the hash of a Mina state that was verified in Ethereum + +1. Open a new terminal and register the operator: + + ```sh + eigenlayer operator register config-files/holesky/config.yaml + ``` + +1. Whitelist the registered operator: + + ```sh + make operator_whitelist OPERATOR_ADDRESS= + ``` + +1. Deposit Strategy tokens for the operator. Follow [this section from the AlignedLayer docs](https://docs.alignedlayer.com/operators/0_running_an_operator#step-4-deposit-strategy-tokens). + +1. Start operator: + + ```sh + make operator_start CONFIG_FILE=config-files/holesky/config.yaml + ``` + +1. Set `contracts/script/deploy/config/holesky/batcher-payment-service.holesky.config.json` to: + + ```json + { + "address": { + "batcherWallet": "", + "alignedLayerServiceManager": "" + }, + "amounts": { + "gasForAggregator": "300000", + "gasPerProof": "21000" + }, + "permissions": { + "owner": "" + }, + "eip712": { + "noncedVerificationDataTypeHash": "41817b5c5b0c3dcda70ccb43ba175fdcd7e586f9e0484422a2c6bba678fdf4a3" + } + } + ``` + +1. Deploy Batcher payment contract: + + ```sh + make deploy_batcher_payment_service + ``` + + The file `contracts/script/output/holesky/alignedlayer_deployment_output.json` will have two new fields: `addresses.batcherPaymentService` and `addresses.batcherPaymentServiceImplementation`. + +1. Pay the batcher: + + ```sh + cast send --rpc-url --private-key --value 1ether + ``` + +1. Deposit to batcher in the Aligned Service Manager Contract: + + ```sh + cast send --rpc-url --private-key --value 1ether "depositToBatcher(address)" + ``` + +1. Setup local storage for the batcher: + + ```sh + make run_storage + ``` + +1. Start the batcher: + + ```sh + cargo run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/holesky/config-batcher.yaml --env-file ./batcher/aligned-batcher/.env.dev + ``` + +#### Bridge environment setup + +In the Mina Bridge repo, setup the `.env` file. A template is available in `.env.template`. + +1. Set `ETH_CHAIN` to `holesky`. +1. Set `MINA_RPC_URL` to the URL of the Mina node GraphQL API (See [Mina node section](#mina-node)). +1. Set the rest of the env vars to: + + ```sh + BATCHER_ADDR="ws://localhost:8080" + BATCHER_ETH_ADDR= + ETH_RPC_URL= + PROOF_GENERATOR_ADDR=0x66f9664f97F2b50F62D13eA064982f936dE76657 + PRIVATE_KEY= + ALIGNED_SM_HOLESKY_ETH_ADDR= + ``` + +### Bridge a Mina account + 1. In the root folder, deploy the Bridge's contracts with: ```sh