Dymension Rollapp
Rollappd - A template RollApp chain
This repository hosts rollappd
, a template implementation of a dymension rollapp.
rollappd
is an example of a working RollApp using dymension-RDK
and dymint
.
It uses Cosmos-SDK's simapp as a reference, but with the following changes:
- minimal app setup
- wired IBC for ICS 20 Fungible Token Transfers
- Uses
dymint
for block sequencing and replacing tendermint
- Uses modules from
dymension-RDK
to sync with dymint
and provide RollApp custom logic
Overview
Note: Requires Go 1.21
Quick guide
Get started with building RollApps
Installing / Getting started
Build and install the rollappd
binary:
make install
Initial configuration
export the following variables:
export ROLLAPP_CHAIN_ID="rollappwasm_1234-1"
export KEY_NAME_ROLLAPP="rol-user"
export DENOM="urax"
export MONIKER="$ROLLAPP_CHAIN_ID-sequencer"
And initialize the rollapp:
sh scripts/init.sh
You can find out in https://github.com/CosmWasm/wasmd#compile-time-parameters that:
There are a few variables was allow blockchains to customize at compile time. If you build your own chain and import x/wasm, you can adjust a few items via module parameters, but a few others did not fit in that, as they need to be used by stateless ValidateBasic(). Thus, we made them as flags and set them in start.go so that they can be overridden on your custom chain.
rollappd start --max-label-size 64 --max-wasm-size 2048000 --max-wasm-proposal-size 2048000
Those flags are optional, the default value was set as:
wasmtypes.MaxLabelSize = 128
wasmtypes.MaxWasmSize = 819200
wasmtypes.MaxProposalWasmSize = 3145728
Download cw20-ics20 smartcontract
Download cw20-ics20 smartcontract with a specific version:
sh scripts/download_release.sh v1.0.0
Run rollapp
rollappd start
You should have a running local rollapp!
Run a rollapp with local settlement node
Run local dymension hub node
Follow the instructions on Dymension Hub docs to run local dymension hub node
Create sequencer keys
create sequencer key using dymd
dymd keys add sequencer --keyring-dir ~/.rollapp/sequencer_keys --keyring-backend test
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 10000000000000000000000adym --keyring-backend test --broadcast-mode block --fees 20000000000000adym -y
Register rollapp on settlement
sh scripts/settlement/register_rollapp_to_hub.sh
Register sequencer for rollapp on settlement
sh scripts/settlement/register_sequencer_to_hub.sh
Modify dymint.toml
in the chain directory (~/.rollapp/config
)
set:
settlement_layer = "dymension"
gas_prices = "0.025adym"
Run rollapp locally
rollappd start
Setup IBC between rollapp and local dymension hub node
Install dymension relayer
git clone https://github.com/dymensionxyz/go-relayer.git --branch v0.2.0-v2.3.1-relayer
cd go-relayer && make install
Establish IBC channel
while the rollapp and the local dymension hub node running, run:
sh scripts/ibc/setup_ibc.sh
After successful run, the new established channels will be shown
run the relayer
rly start hub-rollapp
Deploy the installed contract
sh scripts/wasm/deploy_contract.sh
Make the ibc transfer
sh scripts/wasm/ibc_transfer.sh
Developers guide
TODO