How to Customize Your App Chain
This guide will walk you through the process of customizing a Madara client for your specific App Chain needs.
Quick Start Tutorial
As an introduction to the following section, we have created a video tutorial to give you more context on how to customize your Madara App Chain.
-- Video goes here --
We recommend continuing with the Next Section, which will help you better understand the different components of Madara customization.
Step-by-Step Tutorial
This tutorial assumes that you already know how to launch a Madara App Chain. For more information about how to launch a Madara App Chain, please refer to this tutorial.
Configure Your Madara Client
Now that you have your client installed and running smoothly in sequencer mode, you may want to configure it further to match your desired setup or network. There are two types of configuration for your node:
- Node Configuration: the configuration of your node itself as a sequencer engine.
- Chain Configuration: the configuration of the chain you are currently running your node on.
In this tutorial, we'll focus on a simple configuration of your App Chain by manipulating only the Chain Configuration (for advanced Node configuration, please visit the Configuration section of the Node Operator guide).
Here, we will imagine that our node wants to launch a Starknet clone App Chain with the following configuration:
chain_name: "Starklone"
chain_id: "SN_KLONE"
native_fee_token_address: "0x012345a0fc34fa1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"
parent_fee_token_address: "0x012346570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
latest_protocol_version: "0.13.2"
block_time: "30s"
pending_block_update_time: "2s"
execution_batch_size: 16
bouncer_config:
block_max_capacity:
builtin_count:
add_mod: 18446744073709551615
bitwise: 18446744073709551615
ecdsa: 18446744073709551615
ec_op: 18446744073709551615
keccak: 18446744073709551615
mul_mod: 18446744073709551615
pedersen: 18446744073709551615
poseidon: 18446744073709551615
range_check: 18446744073709551615
range_check96: 18446744073709551615
gas: 5000000
n_steps: 40000000
message_segment_length: 18446744073709551615
n_events: 18446744073709551615
state_diff_size: 131072
sequencer_address: "0x01234a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8"
eth_core_contract_address: "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4"
eth_gps_statement_verifier: "0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60"
You simply need to save this configuration as a .yml
file somewhere on your machine and call it via:
--chain-config-path <CHAIN CONFIG FILE PATH>
: Specifies the chain configuration file path.
In our case, the command would be:
cargo run --release -- \
--name Madara \
--sequencer \
--base-path /var/lib/madara \
--l1-endpoint ${ETHEREUM_API_URL} \
--chain-config-path "/path/to/your/config.yml"
Another way to run this configuration would be to override the elements that differ from the original Starknet mainnet configuration using:
-
--preset <PRESET NAME>
: Uses a preset as the chain configuration.- Possible values:
mainnet
,sepolia
,integration
,devnet
- Possible values:
-
--chain-config-override <OVERRIDES>
: Overrides specific chain configuration parameters.
This would give the following command:
cargo run --release -- \
--name Madara \
--sequencer \
--preset mainnet \
--base-path /var/lib/madara \
--l1-endpoint ${ETHEREUM_API_URL} \
--rpc-port 9945 \
--rpc-cors '*' \
--rpc-external \
--chain-config-override chain_name="Starklone" chain_id="SN_KLONE" native_fee_token_address="0x012345a0fc34fa1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" parent_fee_token_address="0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" sequencer_address="0x01234a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8"
You now know how to customize your App Chain! To learn more about customizing your client, visit the Node Configuration and Chain Configuration sections.