Dymension RDK, which stands for RollApp Development Kit is based on the Cosmos SDK framework, modified and enhanced for building autonomous RollApps (app-specific-rollups) on top of the Dymension Hub.
The RDK provides the following capabilities on top of the Cosmos SDK framework:
- The RDK is coupled with the Dymint client to form RollApp's blazing speed consensus and networking layer, while the Dymension Hub is securing the rollapp
- Custom modules that convert a cosmos based PoS (proof-of-stake) chain to a rollapp
- EVM support (based on Ethermint)
For more information about Dymension RollApps please visit the documentation center
To learn how the Cosmos SDK works from a high-level perspective, see the Cosmos SDK High-Level Intro.
If you want to get started quickly and learn how to build on top of Cosmos SDK, visit Cosmos SDK Tutorials. You can also fork the tutorial's repository to get started building your own Cosmos SDK application.
This repository hosts rollappd
, the first implementation of a dymension rollapp.
Note: Requires Go 1.19
Get started with building RollApps
Build and install the rollappd
binary:
make install
Set custom configuration params at scripts/shared.sh
This will initialize the rollapp:
sh scripts/init_rollapp.sh
sh scripts/run_rollapp.sh
Follow the instructions on Dymension Hub docs to run local dymension hub node
create sequencer key using dymd
dymd keys add sequencer --keyring-dir ~/.rollapp/sequencer_keys --keyring-backend test --algo secp256k1
SEQUENCER_ADDR=`dymd keys show sequencer --address --keyring-backend test --keyring-dir ~/.rollapp/sequencer_keys`
fund the sequencer account
dymd tx bank send local-user $SEQUENCER_ADDR 10000000000udym --keyring-backend test
sh scripts/settlement/register_rollapp_to_hub.sh
sh scripts/settlement/register_sequencer_to_hub.sh
Modify dymint.toml
in the chain directory (~/.rollapp/config
)
set:
settlement_layer = "dymension"
sh scripts/run_rollapp.sh
🚧 To run an EVM-based rollapp, one should:
-
Build and EVM binary instead of default binary:
make install_evm
This will build and install the
rollapp_evm
binary -
EVM-based configuration:
Uncomment the EVM section in
scripts/shared.sh
, then initializing the rollappsh scripts/init_rollapp.sh
The following script will create all the dependencies for IBC channel between the hub and the rollapp. It will create dedicated accounts for the relayer on both the hub and the rollapp, and transfer some funds to them from the genesis accounts.
sh scripts/ibc/setup_ibc.sh
after it finishes (it might take few mins), run the relayer:
sh scripts/run_relayer.sh
To run ibc-transfers between rollapp and the hub, first check and set the connection name:
//check the connectionID of the rollapp and the hub on the active path
rly paths show hub-rollapp --json | jq '.chains.src'
rly paths show hub-rollapp --json | jq '.chains.dst'
//check the channel_ID based on the connectionID
rollappd q ibc channel connections <connectionID from rly command> -o json | jq '.channels[0].channel_id'
dymd q ibc channel connections <connectionID from rly command> -o json | jq '.channels[0].channel_id'
//Use the above result
export ROLLAPP_CHANNEL_NAME=<channel_id>
export HUB_CHANNEL_NAME=<channel_id>
Now you can do ibc transfers
sh scripts/ibc/ibc_transfer.sh [arg]
Available:
-q: query balances of local-user on hub and rol-user on rollapp
rol2hub: ibc-transfer of 5555urap to local-user from rol-user
hub_back: transfer back the tokens from the hub to the rollapp
hub2rol: ibc-transfer of 5555dym to rol-user from local-user
hub_back: transfer back the tokens from the hub to the rollapp
To run a rollapp based on foreign IBC token, set the following when initializing the rollapp:
DENOM=IBC/<denom trace>
TOKEN_AMOUNT = 0$DENOM
Run the first rollapp as described above.
For the 2nd rollapp, run the following in a new tab:
export CHAIN_ID=rollapp2
export CHAIN_DIR="$HOME/.rollapp2"
export ROLLAPP_CHAIN_ID=rollapp2
export RPC_PORT="0.0.0.0:27667"
export P2P_PORT="0.0.0.0:27668"
export GRPC_PORT="0.0.0.0:9180"
export GRPC_WEB_PORT="0.0.0.0:9181"
Then run the scripts as described in the readme
TODO