The tokamak rollup hub SDK allows anyone to quickly deploy customized and autonomous Layer 2 Rollups on the Ethereum network.
-
You must have go(1.20+ < 1.23) installed on your machine and
1.22.6
would be highly recommended. (Install go from here) -
Clone the repository
git clone https://github.com/tokamak-network/trh-sdk.git
-
Build the SDK
go build
-
Or you can install the SDK by using
go install
go install github.com/tokamak-network/trh-sdk@latest
Then check the installation
trh-sdk version
Note: After building, all SDK commands will be available in the
trh-sdk
directory. Make sure you are in this directory when running commands.
-
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.
We only need to run this script on the testnet and mainnet network
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.
→ We will create the settings.json
file after deploying successfully to reuse in the deploy infra step.
settings.json
file looks like:
{
"admin_private_key": "012347185fc76118346627e44f8a7e9318dad70544711001...",
"sequencer_private_key": "eb845bb0aba96394a99bd44163471ea0305cd4880280e0f...",
"batcher_private_key": "12399af5811bf105f8731d848874d5b7c4be3f69...",
"proposer_private_key": "9461b46f763b2e68077ea87e76c537bc7488432...",
"deployment_path": "/home/user/tokamak/trh-sdk/tokamak-thanos/packages/tokamak/contracts-bedrock/deployments/11155111-deploy.json",
"l1_rpc_url": "https://sepolia.rpc.tokamak.network",
"l1_rpc_provider": "",
"stack": "thanos",
"network": "testnet",
"enable_fraud_proof": false,
"k8s_namespace": "",
"helm_release_name": "",
"l2_rpc_url": ""
}
./trh-sdk deploy-contracts --network [] --stack []
Example:
./trh-sdk deploy-contracts --network testnet --stack thanos
./trh-sdk deploy
→ If the `settings.json file exists, we will deploy the stack by the network and stack written on the config file. And if the settings.json file doesn't exist. We will deploy the local-devnet network and the stack is Thanos by default.
To terminate the network, we can run the command looks like:
./trh-sdk destroy
Same as the deploy infra command, this command looks the config files located at the current directory to choose the network and stack
./trh-sdk install bridge