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

Commit f28c29b

Browse files
committed
Fix tutorial.md
- Using hex for '_offset' parameter of BMV deploy - Add 'sleep' command before extract score address - Move 'Register Relayer and Relay' step to end of 'Configuration' phase, because that step includes change of rpc key
1 parent 64c90db commit f28c29b

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

doc/tutorial.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ rpcks() {
8585
fi
8686
echo $GOLOOP_RPC_KEY_STORE
8787
}
88-
89-
export GOLOOP_CHAINSCORE=cx0000000000000000000000000000000000000000
9088
````
9189

9290
### BMC
@@ -114,7 +112,8 @@ rpcch dst
114112
echo "$GOLOOP_RPC_NID.icon" > net.btp.$(rpcch)
115113
goloop rpc sendtx deploy pyscore/bmc.zip \
116114
--param _net=$(cat net.btp.$(rpcch)) | jq -r . > tx.bmc.$(rpcch)
117-
goloop rpc txresult $(cat tx.bmc.dst) | jq -r .scoreAddress > bmc.$(rpcch)
115+
sleep 2
116+
goloop rpc txresult $(cat tx.bmc.$(rpcch)) | jq -r .scoreAddress > bmc.$(rpcch)
118117
echo "btp://$(cat net.btp.$(rpcch))/$(cat bmc.$(rpcch))" > btp.$(rpcch)
119118
````
120119

@@ -123,10 +122,10 @@ To create parameters for deploy BMV contract
123122
````shell
124123
rpcch dst
125124
goloop rpc call --to $GOLOOP_CHAINSCORE --method getValidators| jq -r 'map(.)|join(",")' > validators.$(rpcch)
126-
goloop chain inspect $(rpcch) --format {{.Height}} > offset.$(rpcch)
125+
echo "0x$(printf %x $(goloop chain inspect $(rpcch) --format {{.Height}}))" > offset.$(rpcch)
127126
````
128127

129-
Deploy BMV contract to 'src' chain and check deploy result
128+
Deploy BMV contract to 'src' chain
130129
````shell
131130
rpcch src
132131
goloop rpc sendtx deploy pyscore/bmv.zip \
@@ -135,21 +134,26 @@ goloop rpc sendtx deploy pyscore/bmv.zip \
135134
--param _validators=$(cat validators.dst) \
136135
--param _offset=$(cat offset.dst) \
137136
| jq -r . > tx.bmv.$(rpcch)
137+
````
138+
139+
Extract BMV contract address from deploy result
140+
````shell
138141
goloop rpc txresult $(cat tx.bmv.$(rpcch)) | jq -r .scoreAddress > bmv.$(rpcch)
139142
````
140143

141144
For 'dst' chain, same flows with replace 'src' to 'dst' and 'dst' to 'src'.
142145
````shell
143146
rpcch src
144147
goloop rpc call --to $GOLOOP_CHAINSCORE --method getValidators| jq -r 'map(.)|join(",")' > validators.$(rpcch)
145-
goloop chain inspect $(rpcch) --format {{.Height}} > offset.$(rpcch)
148+
echo "0x$(printf %x $(goloop chain inspect $(rpcch) --format {{.Height}}))" > offset.$(rpcch)
146149
rpcch dst
147150
goloop rpc sendtx deploy pyscore/bmv.zip \
148151
--param _bmc=$(cat bmc.$(rpcch)) \
149152
--param _net=$(cat net.btp.src) \
150153
--param _validators=$(cat validators.src) \
151154
--param _offset=$(cat offset.src) \
152155
| jq -r . > tx.bmv.$(rpcch)
156+
sleep 2
153157
goloop rpc txresult $(cat tx.bmv.$(rpcch)) | jq -r .scoreAddress > bmv.$(rpcch)
154158
````
155159

@@ -259,6 +263,24 @@ goloop rpc sendtx call --to $(cat bmc.$(rpcch)) \
259263
> `goloop rpc call --to $(cat bmc.src) --method getStatus --param _link=$(cat btp.dst)`
260264
> `goloop rpc call --to $(cat bmc.dst) --method getStatus --param _link=$(cat btp.src)`
261265
266+
### Register Token
267+
Register IRC 2.0 Token contract to Token-BSH
268+
````shell
269+
rpcch src
270+
goloop rpc sendtx call --to $(cat token_bsh.src) \
271+
--method register \
272+
--param _name=IRC2Token \
273+
--param _addr=$(cat irc2_token.src)
274+
rpcch dst
275+
goloop rpc sendtx call --to $(cat token_bsh.dst) \
276+
--method register \
277+
--param _name=IRC2Token \
278+
--param _addr=$(cat irc2_token.dst)
279+
````
280+
281+
> To retrieve list of registered token, use `tokenNames` method of Token-BSH.
282+
> `goloop rpc call --to $(cat token_bsh.$(rpcch)) --method tokenNames`
283+
262284
### Register Relayer and Relay
263285
Create key store for relay of 'src' chain
264286
````shell
@@ -303,24 +325,6 @@ goloop rpc sendtx call --to $(cat bmc.$(rpcch)) \
303325
> `goloop rpc call --to $(cat bmc.src) --method getRelays --param _link=$(cat btp.dst)`
304326
> `goloop rpc call --to $(cat bmc.dst) --method getRelays --param _link=$(cat btp.src)`
305327
306-
### Register Token
307-
Register IRC 2.0 Token contract to Token-BSH
308-
````shell
309-
rpcch src
310-
goloop rpc sendtx call --to $(cat token_bsh.src) \
311-
--method register \
312-
--param _name=IRC2Token \
313-
--param _addr=$(cat irc2_token.src)
314-
rpcch dst
315-
goloop rpc sendtx call --to $(cat token_bsh.dst) \
316-
--method register \
317-
--param _name=IRC2Token \
318-
--param _addr=$(cat irc2_token.dst)
319-
````
320-
321-
> To retrieve list of registered token, use `tokenNames` method of Token-BSH.
322-
> `goloop rpc call --to $(cat token_bsh.$(rpcch)) --method tokenNames`
323-
324328
## Start relay
325329

326330
Prepare 'btpsimple' docker image via `make btpsimple-image`
@@ -351,7 +355,7 @@ docker run -d --name btpsimple_dst --link goloop \
351355
-e BTPSIMPLE_DST_ENDPOINT=http://goloop:9080/api/v3/src \
352356
-e BTPSIMPLE_OFFSET=$(cat ${CONFIG_DIR}/offset.dst) \
353357
-e BTPSIMPLE_KEY_STORE=/btpsimple/config/dst.ks.json \
354-
-e BTPSIMPLE_KEY_SECRET=/btpsimple/config/dst.secret) \
358+
-e BTPSIMPLE_KEY_SECRET=/btpsimple/config/dst.secret \
355359
btpsimple
356360
````
357361

0 commit comments

Comments
 (0)