@@ -65,31 +65,31 @@ linera_spawn linera net up --with-faucet --faucet-port $FAUCET_PORT
6565Create the user wallets and add chains to them:
6666
6767``` bash
68- export LINERA_WALLET_0=" $LINERA_TMP_DIR /wallet_0.json"
69- export LINERA_STORAGE_0=" rocksdb:$LINERA_TMP_DIR /client_0.db"
7068export LINERA_WALLET_1=" $LINERA_TMP_DIR /wallet_1.json"
7169export LINERA_STORAGE_1=" rocksdb:$LINERA_TMP_DIR /client_1.db"
70+ export LINERA_WALLET_2=" $LINERA_TMP_DIR /wallet_2.json"
71+ export LINERA_STORAGE_2=" rocksdb:$LINERA_TMP_DIR /client_2.db"
7272
73- linera --with-wallet 0 wallet init --faucet $FAUCET_URL
7473linera --with-wallet 1 wallet init --faucet $FAUCET_URL
74+ linera --with-wallet 2 wallet init --faucet $FAUCET_URL
7575
76- INFO_0=($( linera --with-wallet 0 wallet request-chain --faucet $FAUCET_URL ) )
7776INFO_1=($( linera --with-wallet 1 wallet request-chain --faucet $FAUCET_URL ) )
78- CHAIN_0= " ${INFO_0[0]} "
77+ INFO_2=( $( linera --with-wallet 2 wallet request-chain --faucet $FAUCET_URL ) )
7978CHAIN_1=" ${INFO_1[0]} "
80- OWNER_0 =" ${INFO_0[3 ]} "
79+ CHAIN_2 =" ${INFO_2[0 ]} "
8180OWNER_1=" ${INFO_1[3]} "
81+ OWNER_2=" ${INFO_2[3]} "
8282```
8383
84- Note that ` linera --with-wallet 0 ` is equivalent to `linera --wallet "$LINERA_WALLET_0 "
85- --storage "$LINERA_STORAGE_0 "`.
84+ Note that ` linera --with-wallet 1 ` is equivalent to `linera --wallet "$LINERA_WALLET_1 "
85+ --storage "$LINERA_STORAGE_1 "`.
8686
8787The command below can be used to list the chains created for the test as known by each
8888wallet:
8989
9090``` bash
91- linera --with-wallet 0 wallet show
9291linera --with-wallet 1 wallet show
92+ linera --with-wallet 2 wallet show
9393```
9494
9595A table will be shown with the chains registered in the wallet and their meta-data:
@@ -108,8 +108,8 @@ A table will be shown with the chains registered in the wallet and their meta-da
108108
109109The default chain of each wallet should be highlighted in green. Each chain has an
110110` Owner ` field, and that is what is used for the account. Let's pick the owners of the
111- default chain of each wallet and call them ` $OWNER_0 ` and ` $OWNER_1 ` . Remember the corresponding
112- chain IDs as ` $CHAIN_0 ` (the chain where we just published the application) and ` $CHAIN_1 `
111+ default chain of each wallet and call them ` $OWNER_1 ` and ` $OWNER_2 ` . Remember the corresponding
112+ chain IDs as ` $CHAIN_1 ` (the chain where we just published the application) and ` $CHAIN_2 `
113113(some user chain in wallet 2).
114114
115115### Creating tokens
@@ -124,9 +124,9 @@ Create a fungible token application where two accounts start with the minted tok
124124with 100 of them and another with 200 of them:
125125
126126``` bash
127- APP_ID_0=$( linera --with-wallet 0 project publish-and-create \
127+ APP_ID_0=$( linera --with-wallet 1 project publish-and-create \
128128 examples/fungible \
129- --json-argument ' { "accounts": { "' $OWNER_0 ' ": "100", "' $OWNER_1 ' ": "200" } }' \
129+ --json-argument ' { "accounts": { "' $OWNER_1 ' ": "100", "' $OWNER_2 ' ": "200" } }' \
130130 --json-parameters " { \" ticker_symbol\" : \" FUN\" }" )
131131
132132# Wait for it to fully complete
@@ -141,12 +141,12 @@ Similarly, we're going to create a crowd-funding campaign on the default chain.
141141to specify our fungible application as a dependency and a parameter:
142142
143143``` bash
144- APP_ID_1=$( linera --with-wallet 0 \
144+ APP_ID_1=$( linera --with-wallet 1 \
145145 project publish-and-create \
146146 examples/crowd-funding \
147147 crowd_funding \
148148 --required-application-ids $APP_ID_0 \
149- --json-argument ' { "owner": "' $OWNER_0 ' ", "deadline": 4102473600000000, "target": "100." }' \
149+ --json-argument ' { "owner": "' $OWNER_1 ' ", "deadline": 4102473600000000, "target": "100." }' \
150150 --json-parameters ' "' " $APP_ID_0 " ' "' )
151151
152152# Wait for it to fully complete
@@ -158,12 +158,12 @@ sleep 5
158158First, a node service has to be started for each wallet, using two different ports:
159159
160160``` bash
161- linera --with-wallet 0 service --port 8080 &
161+ linera --with-wallet 1 service --port 8080 &
162162
163163# Wait for it to fully complete
164164sleep 2
165165
166- linera --with-wallet 1 service --port 8081 &
166+ linera --with-wallet 2 service --port 8081 &
167167
168168# Wait for it to fully complete
169169sleep 2
@@ -175,7 +175,7 @@ Point your browser to http://localhost:8080, and enter the query:
175175
176176``` gql,uri=http://localhost:8080
177177query { applications(
178- chainId: "$CHAIN_0 "
178+ chainId: "$CHAIN_1 "
179179) { id link } }
180180```
181181
@@ -186,74 +186,74 @@ application by its ID. The entry also has a field `link`. If you open that in a
186186see the GraphQL API for that application on that chain.
187187
188188Let's pledge 30 tokens by the campaign creator themselves.
189- For ` $OWNER_0 ` on 8080, run ` echo "http://localhost:8080/chains/$CHAIN_0 /applications/$APP_ID_1" ` to get the URL, open it
189+ For ` $OWNER_1 ` on 8080, run ` echo "http://localhost:8080/chains/$CHAIN_1 /applications/$APP_ID_1" ` to get the URL, open it
190190and run the following query:
191191
192- ``` gql,uri=http://localhost:8080/chains/$CHAIN_0 /applications/$APP_ID_1
192+ ``` gql,uri=http://localhost:8080/chains/$CHAIN_1 /applications/$APP_ID_1
193193mutation { pledge(
194- owner:"$OWNER_0 ",
194+ owner:"$OWNER_1 ",
195195 amount:"30."
196196) }
197197```
198198
199199This will make the owner show up if we list everyone who has made a pledge so far:
200200
201- ``` gql,uri=http://localhost:8080/chains/$CHAIN_0 /applications/$APP_ID_1
201+ ``` gql,uri=http://localhost:8080/chains/$CHAIN_1 /applications/$APP_ID_1
202202query { pledges { keys } }
203203```
204204
205- To also have ` $OWNER_1 ` make a pledge, they first need to claim their tokens. Those are still
205+ To also have ` $OWNER_2 ` make a pledge, they first need to claim their tokens. Those are still
206206on the other chain, where the application was created. To get the link on 8081
207- for the fungible application, run ` echo "http://localhost:8081/chains/$CHAIN_1 /applications/$APP_ID_0" ` ,
207+ for the fungible application, run ` echo "http://localhost:8081/chains/$CHAIN_2 /applications/$APP_ID_0" ` ,
208208open it and run the following query:
209209
210- ``` gql,uri=http://localhost:8081/chains/$CHAIN_1 /applications/$APP_ID_0
210+ ``` gql,uri=http://localhost:8081/chains/$CHAIN_2 /applications/$APP_ID_0
211211mutation { claim(
212212 sourceAccount: {
213- owner: "$OWNER_1 ",
214- chainId: "$CHAIN_0 "
213+ owner: "$OWNER_2 ",
214+ chainId: "$CHAIN_1 "
215215 },
216216 amount: "200.",
217217 targetAccount: {
218- owner: "$OWNER_1 ",
219- chainId: "$CHAIN_1 "
218+ owner: "$OWNER_2 ",
219+ chainId: "$CHAIN_2 "
220220 }
221221) }
222222```
223223
224224You can check that the 200 tokens have arrived:
225225
226- ``` gql,uri=http://localhost:8081/chains/$CHAIN_1 /applications/$APP_ID_0
226+ ``` gql,uri=http://localhost:8081/chains/$CHAIN_2 /applications/$APP_ID_0
227227query {
228- accounts { entry(key: "$OWNER_1 ") { value } }
228+ accounts { entry(key: "$OWNER_2 ") { value } }
229229}
230230```
231231
232232Now, also on 8081, you can open the link for the crowd-funding
233- application you get when you run ` echo "http://localhost:8081/chains/$CHAIN_1 /applications/$APP_ID_1" `
233+ application you get when you run ` echo "http://localhost:8081/chains/$CHAIN_2 /applications/$APP_ID_1" `
234234and run:
235235
236- ``` gql,uri=http://localhost:8081/chains/$CHAIN_1 /applications/$APP_ID_1
236+ ``` gql,uri=http://localhost:8081/chains/$CHAIN_2 /applications/$APP_ID_1
237237mutation { pledge(
238- owner:"$OWNER_1 ",
238+ owner:"$OWNER_2 ",
239239 amount:"80."
240240) }
241241```
242242
243243This pledges another 80 tokens. With 110 pledged in total, we have now reached the campaign
244244goal. Now the campaign owner (on 8080) can collect the funds:
245245
246- ``` gql,uri=http://localhost:8080/chains/$CHAIN_0 /applications/$APP_ID_1
246+ ``` gql,uri=http://localhost:8080/chains/$CHAIN_1 /applications/$APP_ID_1
247247mutation { collect }
248248```
249249
250250Get the fungible application on
251- 8080 URL by running ` echo "http://localhost:8080/chains/$CHAIN_0 /applications/$APP_ID_0" ` ,
251+ 8080 URL by running ` echo "http://localhost:8080/chains/$CHAIN_1 /applications/$APP_ID_0" ` ,
252252then check that we have received 110 tokens, in addition to the
25325370 that we had left after pledging 30 by running the following query:
254254
255- ``` gql,uri=http://localhost:8080/chains/$CHAIN_0 /applications/$APP_ID_0
255+ ``` gql,uri=http://localhost:8080/chains/$CHAIN_1 /applications/$APP_ID_0
256256query {
257- accounts { entry(key: "$OWNER_0 ") { value } }
257+ accounts { entry(key: "$OWNER_1 ") { value } }
258258}
259259```
0 commit comments