Madara Bootstrapper is a tool that helps to deploy the Token Bridge & Eth Bridge contract between a madara/katana Appchain and another L2 or L1 network. It will also declare wallet contracts from OpenZappelin, Argent and Braavos. You can find the full list of contracts in the Information section.
Currently Supported:
- Madara App Chain <----> Ethereum / EVM based chains
- More coming soon...
There are three test in the repository:
- bridge deployment e2e
- eth bridge deposit and claim
- erc20 token bridge deposit and claim
-
You need to comment/remove the #[ignore] tags in src/tests/mod.rs file
-
Only one test can be run at one time as all the tests are e2e tests.
-
You also would need to restart both the chains after running each test.
-
You would need to clone Madara repo by running :
git clone --branch d188aa91efa78bcc54f92aa1035295fd50e068d2 https://github.com/madara-alliance/madara.git
# 1. Run madara instance with eth as settlement layer :
./target/release/madara --dev --da-layer=ethereum --da-conf=examples/da-confs/ethereum.json --settlement=Ethereum --settlement-conf=examples/da-confs/ethereum.json
# 2. Run anvil instance
~/.foundry/bin/anvil
# 3. Run tests
RUST_LOG=debug cargo test -- --nocapture
You can provide the env variables as arguments also, or you can also provide them in .env file.
Refer .env.example file for setup
cp .env.example .env
cargo build --release
RUST_LOG=info cargo run -- --help
# If you have provided env vars in .env
RUST_LOG=info cargo run
# To run in dev mode (uses unsafe proxy and minimal setup)
RUST_LOG=info cargo run -- --dev
IMP 🚨 : It will store all the addresses in data/addresses.json
-
You need to set up the .env file first. Fill all the variables in .env file
cp .env.example .env
-
You need to run docker compose command to build the image
docker compose build
-
Run the image
# If both the networks are running locally docker compose -f docker-compose-local.yml up # If you are hosting on already deployed networks docker compose up
IMP 🚨 : It will store all the addresses in data/addresses.json
To run the Madara Bootstrapper on an Ubuntu machine with AMD architecture, please follow these steps:
-
Clone the Repository: Start by cloning the Madara Bootstrapper repository.
git clone https://github.com/madara-alliance/madara-bootstrapper.git cd madara-bootstrapper
-
Install Build Essentials: Ensure you have the necessary build tools.
sudo apt update sudo apt install build-essential
-
Install Docker: Docker should be installed and running.
sudo apt install docker.io sudo systemctl start docker sudo systemctl enable docker
-
Install Python: Python3 and its virtual environment package are required.
sudo apt install python3 python3-venv
-
Install Node.js and npm: These are required for JavaScript dependencies.
sudo apt install nodejs npm
-
Install asdf: Use asdf for managing runtime versions.
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
-
Install Rust: Use rustup to install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup show
-
Create a Python Virtual Environment: Set up a virtual environment for Python dependencies.
python3 -m venv venv source venv/bin/activate
-
Build Artifacts: Use the
make
command to build the necessary artifacts within the Madara Bootstrapper repository.make artifacts-linux # For Linux make artifacts # For macOS
Note: In case you get an error related to permission, try running the command with
sudo
-
Build the Rust Binary: Compile the Rust project.
cargo build --release
-
Run the Setup Command for L1: Execute the following command to set up the L1 environment. Make sure to update the
devnet.json
file as per your needs.RUST_LOG=debug cargo run --release -- --mode setup-l1 --config src/configs/devnet.json
Note: The default configuration file is located at
src/configs/devnet.json
. Please update it according to your requirements. -
Update Configuration: After running the
setup-l1
command, you will receive a response similar to the following:{ "starknet_contract_address": "STARKNET_CONTRACT_ADDRESS", "starknet_contract_implementation_address": "STARKNET_CONTRACT_IMPLEMENTATION_ADDRESS" }
Update these values in your
devnet.json
or your specific configuration file before proceeding. -
Run the Setup Command for L2: Now, execute the following command to set up the L2 environment.
RUST_LOG=debug cargo run --release -- --mode setup-l2 --config src/configs/devnet.json
Contract | Source Link | Local Path |
---|---|---|
OpenZeppelinAccount (legacy : starknet) | https://sepolia.starkscan.co/class/0x05c478ee27f2112411f86f207605b2e2c58cdb647bac0df27f660ef2252359c6 | src/contracts/OpenZeppelinAccount.json |
OpenZeppelinAccount (modified : openzeppelin) | src/contracts/account.cairo | src/contracts/OpenZeppelinAccountCairoOne.sierra.json |
UDC (Universal Deployer Contract) | https://sepolia.starkscan.co/class/0x07b3e05f48f0c69e4a65ce5e076a66271a527aff2c34ce1083ec6e1526997a69 | src/contracts/udc.json |
Here are some contract descriptions on why they are used in our context.
OpenZeppelinAccount (legacy : starknet)
: Contract used for declaring a temp account for declaring V1 contract that will be used to deploy the user account with provided private key in env.OpenZeppelinAccount (modified : openzeppelin)
: OZ account contract modified to includedeploy_contract
function as we deploy the UDC towards the end of the bootstrapper setup.
Important
For testing in Github CI we are using the madara binary build with
--disable-fee-flag
. The source for madara code :
https://github.com/karnotxyz/madara/tree/madara-ci-build