Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 066c60e

Browse files
committed
final pass
1 parent b84123e commit 066c60e

File tree

2 files changed

+66
-34
lines changed

2 files changed

+66
-34
lines changed

guides/hyperlane-use-tia-for-gas.md

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cd wasmd
2727
#### Add token factory to app.go:
2828

2929
```bash
30-
curl -sSL https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/add-tokenfactory.diff | git apply
30+
curl -sSL https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/add-tokenfactory.diff | git apply
3131
```
3232

3333
#### Update packages to use rollkit and accommodate x/tokenfactory:
@@ -62,6 +62,9 @@ wasmd config set client node tcp://127.0.0.1:36657
6262
wasmd config set client output json
6363
wasmd config set client keyring-backend test
6464

65+
git clone --branch v24.0.0 --depth 1 https://github.com/Stride-Labs/stride
66+
cd stride
67+
make install
6568
strided config chain-id stride-internal-1
6669
strided config node https://stride-testnet-rpc.polkachu.com:443
6770
strided config keyring-backend test
@@ -78,7 +81,7 @@ echo "join always addict position jungle jeans bus govern crack huge photo purse
7881
```
7982

8083
:::tip
81-
In this guide, we're using a predefined seep phrase for simplicity. Alternatively you can generate and use your own:
84+
In this guide, we're using a predefined seed phrase for simplicity. Alternatively you can generate and use your own:
8285

8386
```bash
8487
wasmd keys add my-key
@@ -105,7 +108,7 @@ wasmd keys export --unsafe --unarmored-hex my-key
105108
Create a Dockerfile in the `wasmd` repo that will be used to run the rollup.
106109

107110
```bash
108-
wget -O Dockerfile https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/wasmd.Dockerfile
111+
wget -O Dockerfile https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/wasmd.Dockerfile
109112
```
110113

111114
Fork the cw-hyperlane repo
@@ -119,10 +122,10 @@ cd cw-hyperlane
119122
git checkout 4f5656d4704178ac54d10467ca7edc3df2312c4b
120123
```
121124

122-
Create the docker compose file that will be used for the data availability service, the localwasm chain, and the hyperlane validators and relayers.
125+
Create the docker compose file that will be used for the data availability service, the localwasm chain, and the Hyperlane validators and relayers.
123126

124127
```bash
125-
wget -O example/docker-compose.yml https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/docker-compose.yml
128+
wget -O example/docker-compose.yml https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/docker-compose.yml
126129
```
127130

128131
To start the data availability service, run:
@@ -151,7 +154,7 @@ If you're using a new account, you can fund it from the faucet at [Stride testne
151154

152155
#### Rollup Account
153156

154-
We can fund the rollup account through one of the genesis account's in the docker container
157+
We can fund the rollup account through one of the genesis accounts in the docker container
155158

156159
```bash
157160
docker exec -it localwasm \
@@ -183,7 +186,7 @@ The transaction was successful if the `code` field is 0 (success).
183186
<!-- TODO: Update the fee to be denominated in the tokenfactory TIA -->
184187

185188
```bash
186-
wget -O config.yaml https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/hyperlane-config.yaml
189+
wget -O config.yaml https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/hyperlane-config.yaml
187190
```
188191

189192
:::tip
@@ -199,12 +202,12 @@ However, you can pick any number as your domain ID.
199202
:::tip
200203
The fee for each transfer is calculated by:
201204

202-
= `protocol_fee` + (`default_gas_usage` _ `gas_price` _ `exchange_rate` / `10000000000`)
205+
= `protocol_fee + (default_gas_usage * gas_price * exchange_rate / 10000000000)`
203206

204207
So in our config, it will be: `1 + [(1000 * 10000 * 100000) / 10000000000] = 101uwasm`
205208
:::
206209

207-
#### Inside the cw-hyperlane directory, install the hyperlane cw-cli:
210+
#### Inside the cw-hyperlane directory, install the Hyperlane cw-cli:
208211

209212
```bash
210213
yarn install
@@ -229,7 +232,7 @@ yarn cw-hpl deploy -n localwasm
229232
<!-- TODO: Change the config.yaml layout to support multiple networks -->
230233

231234
```bash
232-
wget -O config.yaml https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/hyperlane-config-2.yaml
235+
wget -O config.yaml https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/hyperlane-config-2.yaml
233236
```
234237

235238
#### Deploy the contracts on the Stride testnet:
@@ -240,7 +243,7 @@ wget -O config.yaml https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/gui
240243
# Stride has permissioned CosmWasm, meaning only certain addresses can upload contracts.
241244
# The Hyperlane contracts have already been uploaded, so all that's left is to instantiate them.
242245
# This command will initialize the config for stride-testnet-1 with the code IDs of the Hyperlane contracts.
243-
wget -O context/stride-internal-1.json https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/stride-internal-1.json
246+
wget -O context/stride-internal-1.json https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/stride-internal-1.json
244247

245248
# This command will output two results.
246249
# - context + deployment (default path: {cw-hyperlane-root}/context/stride-internal-1.json)
@@ -253,19 +256,19 @@ yarn cw-hpl deploy -n stride-internal-1
253256
#### Setup the relayer config:
254257

255258
```bash
256-
wget -O example/hyperlane/relayer.json https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/relayer.json
259+
wget -O example/hyperlane/relayer.json https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/relayer.json
257260
```
258261

259262
#### Setup the validator config on the Stride side:
260263

261264
```bash
262-
wget -O example/hyperlane/validator.strideinternal1.json https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/validator.strideinternal1.json
265+
wget -O example/hyperlane/validator.strideinternal1.json https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/validator.strideinternal1.json
263266
```
264267

265268
#### Setup the validator config on the localwasm rollup side:
266269

267270
```bash
268-
wget -O example/hyperlane/validator.localwasm.json https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/validator.localwasm.json
271+
wget -O example/hyperlane/validator.localwasm.json https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/validator.localwasm.json
269272
```
270273

271274
#### Prepare the validators and relayer config:
@@ -294,7 +297,7 @@ docker compose -f example/docker-compose.yml up -d validator-localwasm validator
294297
#### Deploy a warp contract with TIA as collateral on Stride
295298

296299
```bash
297-
wget -O example/warp/utia-stride.json https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/utia-stride.json
300+
wget -O example/warp/utia-stride.json https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/utia-stride.json
298301

299302
yarn cw-hpl warp create ./example/warp/utia-stride.json -n stride-internal-1
300303
```
@@ -311,7 +314,7 @@ The output should look like:
311314
<!-- TODO: Add metadata -->
312315

313316
```bash
314-
wget -O example/warp/utia-localwasm.json https://raw.githubusercontent.com/rollkit/docs/blob/HEAD/guides/assets/hyperlane-use-tia-for-gas/utia-localwasm.json
317+
wget -O example/warp/utia-localwasm.json https://raw.githubusercontent.com/Stride-Labs/Rollkit-docs/hyperlane-v2/guides/assets/hyperlane-use-tia-for-gas/utia-localwasm.json
315318

316319
yarn cw-hpl warp create ./example/warp/utia-localwasm.json -n localwasm
317320
```
@@ -350,19 +353,18 @@ yarn cw-hpl warp link \
350353
-n localwasm
351354
```
352355

353-
## Transfer TIA
356+
## Transfer Tokens
354357

355-
### Test transferring from Stride to Localwasm
358+
### Transfer STRD from Stride to localwasm
356359

357360
Initiate transfer
358361

359362
```bash
360-
# Template
361363
warp_contract_address=$(jq -r '.deployments.warp.native[0].address' context/stride-internal-1.json)
362364
recipient=$(yarn cw-hpl wallet convert-cosmos-to-eth -n localwasm $(wasmd keys show my-key -a) | perl -pe 's/0x0x//g')
363365
strided tx wasm execute $warp_contract_address \
364-
'{"transfer_remote":{"dest_domain":963,"recipient":"'"$recipient"'","amount":"10000"}}' \
365-
--amount 10101ibc/1A7653323C1A9E267FF7BEBF40B3EEA8065E8F069F47F2493ABC3E0B621BF793 \
366+
'{"transfer_remote":{"dest_domain":963,"recipient":"'"$recipient"'","amount":"1"}}' \
367+
--amount 1ustrd \
366368
--from my-key -y \
367369
--gas 2000000 --fees 1000ustrd
368370
```
@@ -373,17 +375,14 @@ Observe logs in the validator and relayer to witness the transfer. Confirm the t
373375
wasmd q bank balances $(wasmd keys show my-key -a)
374376
```
375377

376-
### Transfer from Localwasm back to Stride
377-
378-
<!-- TODO: Update fee to be only the tokenfactory tia -->
378+
### Transfer STRD from localwasm back to Stride
379379

380380
```bash
381-
# Template
382381
warp_contract_address=$(jq -r '.deployments.warp.native[0].address' context/localwasm.json)
383382
recipient=$(yarn cw-hpl wallet convert-cosmos-to-eth -n stride-internal-1 $(strided keys show my-key -a) | perl -pe 's/0x0x//g')
384383
wasmd tx wasm execute $warp_contract_address \
385-
'{"transfer_remote":{"dest_domain":1651,"recipient":"'"$recipient"'","amount":"10000"}}' \
386-
--amount 10000factory/${warp_contract_address}/utia,101uwasm \
384+
'{"transfer_remote":{"dest_domain":1651,"recipient":"'"$recipient"'","amount":"1"}}' \
385+
--amount 1factory/${warp_contract_address}/ustrd,101uwasm \
387386
--from my-key -y \
388387
--gas 2000000 --fees 50000uwasm
389388
```
@@ -414,30 +413,63 @@ celestia-appd config node https://celestia-testnet-rpc.polkachu.com:443
414413
celestia-appd config keyring-backend test
415414

416415
echo "join always addict position jungle jeans bus govern crack huge photo purse famous live velvet virtual weekend hire cricket media dignity wait load mercy" | \
417-
celestia-appd keys add my-key --recover
416+
celestia-appd keys add my-key --recover # celestia133xh839fjn9wxzg6vhc0370lcem8939zc3uexj
418417
```
419418

420-
Fund the relayer with the [Celestia Mocha Testnet Faucet](https://docs.celestia.org/nodes/mocha-testnet#mocha-testnet-faucet).
419+
Fund you account with the [Celestia Mocha Testnet Faucet](https://docs.celestia.org/nodes/mocha-testnet#mocha-testnet-faucet).
421420

422-
Transfer from celestia through Stride, to the rollup:
421+
Transfer TIA from Celestia through Stride to the localwasm rollup:
423422

424423
```bash
425424
warp_contract_address=$(jq -r '.deployments.warp.native[0].address' context/stride-internal-1.json)
426425
recipient=$(yarn cw-hpl wallet convert-cosmos-to-eth -n localwasm $(wasmd keys show my-key -a) | perl -pe 's/0x0x//g')
427426

428427
forward_msg='{"transfer_remote":{"dest_domain":963,"recipient":"'"$recipient"'","amount":"10000"}}'
429-
funds='[{"amount":10101,"denom":"ibc/1A7653323C1A9E267FF7BEBF40B3EEA8065E8F069F47F2493ABC3E0B621BF793"}]'
428+
funds='[{"amount":1,"denom":"ibc/1A7653323C1A9E267FF7BEBF40B3EEA8065E8F069F47F2493ABC3E0B621BF793"}]'
430429
memo='{"wasm":{"contract":"'"$warp_contract_address"'","msg":'"$forward_msg"',"funds":'"$funds"'}}'
431430

432-
celestia-appd tx ibc-transfer transfer transfer channel-78 $warp_contract_address 10101utia \
431+
celestia-appd tx ibc-transfer transfer transfer channel-78 $warp_contract_address 1utia \
433432
--from my-key -y --fees 420utia --memo "$memo"
434433
```
435434

436435
:::tip
437436
Stride has IBC middleware installed that automatically forwards and routes transfers directly to the rollup, therefore we only need to sign one transaction on Celestia!
437+
438+
See the `memo` field in the above command to see how we can encode a message for the Wasm contract and send it along with the funds.
438439
:::
439440

440-
<!-- TODO: Add transfer from celestia through ibc hook -->
441+
Confirm the tokens landed in the wasm account with:
442+
443+
```bash
444+
wasmd q bank balances $(wasmd keys show my-key -a)
445+
```
446+
447+
### Update localwasm to use Hyperlane bridged TIA as a gas token
448+
449+
Update the `restart-wasmd.sh` script to include the new minimum gas prices:
450+
451+
```bash
452+
warp_contract_address="$(jq -r '.deployments.warp.native[0].address' context/localwasm.json)"
453+
localwasm_container_id="$(docker compose -f example/docker-compose.yml ps | awk '$1~/^localwasm$/{print $1}')"
454+
455+
docker exec "$localwasm_container_id" perl -i -pe "s;--minimum-gas-prices=0.025uwasm;--minimum-gas-prices=0.025uwasm,0.025factory/$warp_contract_address/utia;" restart-wasmd.sh
456+
```
457+
458+
Restart the wasmd container:
459+
460+
```bash
461+
docker compose -f example/docker-compose.yml restart localwasm
462+
```
463+
464+
### Send a transaction on the localwasm using TIA to pay for gas
465+
466+
```bash
467+
wasmd tx bank send my-key wasm133xh839fjn9wxzg6vhc0370lcem8939zr8uu45 1uwasm -y --gas auto --gas-adjustment 1.5 --gas-prices "0.025factory/$warp_contract_address/utia"
468+
```
469+
470+
## 🎉
471+
472+
Congratulations! You've built a local rollup that uses Hyperlane bridged TIA as the gas token!
441473

442474
## Resources
443475

guides/use-tia-for-gas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,6 @@ TX_HASH=$(gmd tx bank send "$ACCOUNT_ON_ROLLUP" "$ACCOUNT_ON_ROLLUP" 1stake --ke
289289
gmd q tx "$TX_HASH" --output json | jq .code # => 0
290290
```
291291

292-
## 🎉 Next steps
292+
## 🎉
293293

294294
Congratulations! You've built a local rollup that posts to a local DA network and uses TIA as the gas token!

0 commit comments

Comments
 (0)