The tokamak rollup hub SDK allows anyone to quickly deploy customized and autonomous Layer 2 Rollups on the Ethereum network.
-
Download the setup.sh file
wget https://raw.githubusercontent.com/tokamak-network/trh-sdk/main/setup.sh
-
Run the setup.sh file
chmod +x setup.sh ./setup.sh
-
Source the shell config
First, get your current shell by:
echo $SHELL
- if the output is
/bin/zsh
source ~/.zshrc
- if the output is
/bin/bash
source ~/.bashrc
- if the output is
-
Verify the installation
trh-sdk version
-
Deploy
trh-sdk deploy
If you successfully deploy the local-devnet, you will get the following output:
... Container ops-bedrock-l1-1 Running Container ops-bedrock-l2-1 Running Container ops-bedrock-op-node-1 Running Container ops-bedrock-op-challenger-1 Recreate Container ops-bedrock-op-challenger-1 Recreated Container ops-bedrock-op-challenger-1 Starting Container ops-bedrock-op-challenger-1 Started ✅ Devnet up! -
Destroy
trh-sdk destroy
If you successfully destroy the local-devnet, you will get the following output:
Destroying the devnet network... ✅ Destroyed the devnet network successfully!
- L1 PRC URL (You can can get it from Alchemy, Infura, QuickNode, etc.)
- Beacon Chain RPC URL (You can can get it from QuickNode)
- Prepare AWS credentials & configuration to access AWS EKS.
- What is IAM? (*Note: This IAM user has to have the following policies)
arn:aws:iam::aws:policy/aws-service-role/AmazonEKSServiceRolePolicy
- How to create aws access key and secret key for a IAM user.
- What is IAM? (*Note: This IAM user has to have the following policies)
- Prepare seed phrase for the L1 account.
To deploy the testnet and mainnet network, we must deploy the L1 contracts first
The first step is to deploy the L1 contracts to the L1 network. The output of this step is we generate the rollup, genesis file, and deployment file.
trh-sdk deploy-contracts --network [testnet|mainnet] --stack [thanos] [options]Basic Deployment (with Candidate Registration)
trh-sdk deploy-contracts --network testnet --stack thanosDeployment without Candidate Registration
trh-sdk deploy-contracts --network testnet --stack thanos --no-candidate--reuse-deployment: Reuse existing deployment artifacts (default: true)
- Skips repository cloning, smart contract building, and contract deployment steps.
- Enabled by default. To perform a full deployment, disable it with
--reuse-deployment=false.
# Default behavior (Reuse artifacts)
trh-sdk deploy-contracts --network testnet --stack thanos
# Full deployment (Regenerate artifacts)
trh-sdk deploy-contracts --network testnet --stack thanos --reuse-deployment=falseFor detailed usage and verification methods, refer to the Deploy Contracts Guide.
To deploy the testnet/mainnet network, we must deploy the L1 contracts successfully first.
trh-sdk deployThe deployment config file is located at the deployment folder. settings.json file looks like:
{
"admin_private_key": "your admin private key",
"sequencer_private_key": "your sequencer private key",
"batcher_private_key": "your batcher private key",
"proposer_private_key": "your proposer private key",
"deployment_path": "./tokamak-thanos/packages/tokamak/contracts-bedrock/deployments/11155111-deploy.json",
"l1_rpc_url": "your_l1_rpc",
"l1_beacon_url": "your_l1_beacon_rpc",
"l1_rpc_provider": "debug_geth",
"l1_chain_id": 11155111,
"l2_chain_id": <your_l2_chain_id>,
"stack": "thanos",
"network": "testnet",
"enable_fraud_proof": false,
"l2_rpc_url": "your_l2_rpc",
"aws": {
"secret_key": "your_secret_key",
"access_key": "your_access_key",
"region": "your aws region",
"default_format": "json"
},
"k8s": {
"namespace": "your namespace"
},
"chain_name": "your chain name"
}To terminate the network, we can run the command looks like:
trh-sdk destroySame as the deploy infra command, this command looks the config files located at the current directory to choose the network and stack
# Install bridge (Installed by default when deploying L2)
trh-sdk install bridge
# Install block explorer
trh-sdk install block-explorer
# Install monitoring plugin
trh-sdk install monitoring# Uninstall bridge
trh-sdk uninstall bridge
# Uninstall block explorer
trh-sdk uninstall block-explorer
# Uninstall monitoring plugin
trh-sdk uninstall monitoringAfter deploying the chain successfully, we can get the chain information by:
trh-sdk infoThe Monitoring plugin provides comprehensive monitoring, alerting and log collection capabilities for the Thanos Stack. For detailed documentation on monitoring features, including alert customization and log collection management, see the Monitoring Plugin Documentation.
# Install monitoring plugin
trh-sdk install monitoring
# Configure alerts
trh-sdk alert-config --${flag}
# Manage log collection
trh-sdk log-collection --${flag}
# Uninstall monitoring plugin
trh-sdk uninstall monitoring