- T1 - cardano-node running and in sync.
- T2 - chain-index running and in sync.
- T3 - cardano-wallet (1) running on port 8090 (default)
- T4 - cardano-wallet (2) running on port 8092 (add --port 8092 to cardano-wallet serve)
You'll need 9 terminals (T0 .. T8)
- T0 - run scripts + run the game
- T1 - cardano-node
- T2 - chain-index
- T3 - cardano-wallet-1
- T4 - cardano-wallet-2
- T5 - pab-1
- T6 - pab-2
- T7 - monitor-1
- T8 - monitor-2
-
T0 -
./create-wallet.sh w1 <passphrase_1> testnet/restore-wallet-1.json
-
T0 -
./load-wallet.sh testnet/restore-wallet-1.json 8090
-
T0 - Take id
... "id":"<wid1>" ...
from previous load-wallet terminal result. -
T0 -
./get-address.sh <wid1> 8090
-
T0 - Pick one from previous get-address terminal result:
<address_1>
-
Modify ADDRESS1 value in env.sh:
export ADDRESS1=<address_1>
-
Modify WALLETID1 value in env.sh:
export export WALLETID1=<wid1>
-
T0 - Source env.sh:
. env.sh
-
Fund address_1 (faucet for example)
-
T3 - Wait for cardano-wallet-1 getting synced ("In sync!")
-
T0 -
./create-wallet.sh w2 <passphrase_2> testnet/restore-wallet-2.json
-
T0 -
./load-wallet.sh testnet/restore-wallet-2.json 8092
-
T0 - Take id
... "id":"<wid2>" ...
from previous load-wallet terminal result. -
T0 -
./get-address.sh <wid2> 8092
-
T0 - Pick one from previous get-address terminal result:
<address_2>
-
Modify ADDRESS2 value in env.sh:
export ADDRESS1=<address_2>
-
Modify WALLETID2 value in env.sh:
export export WALLETID2=<wid2>
-
T0 - Source env.sh:
. env.sh
-
Fund address_2 (Yoroi Nightly or using ./send_from_1_to_2.sh )
-
T4 - Wait for cardano-wallet-2 getting synced ("In sync!")
-
T5 -
./migrate-pab.sh testnet/pab-config-1.yml
-
T5 -
./start-testnet-pab.sh testnet/pab-config-1.yml <passphrase_1>
-
T6 -
./migrate-pab.sh testnet/pab-config-2.yml
-
T6 -
./start-testnet-pab.sh testnet/pab-config-2.yml <passphrase_2>
-
T7 - Source env.sh:
. env.sh
-
T7 - Monitor ADDRESS1:
./monitor-1.sh
-
T8 - Source env.sh:
. env.sh
-
T8 - Monitor ADDRESS1:
./monitor-2.sh
- T0 - Play the game:
./game.sh <playDeadlinePOSIXTIME> <revealDeadlinePOSIXTIME> <Choice1> <Choice2> <stake_in_lovelaces> <skipPlayer2>
Example:./game.sh 1647002125000 1647002365000 Paper Paper 5000000 False
- In order to mint the threadToken at "initializing time" on PAB/Testnet, the stateMachine needs some help from us. The thing is that if we run
runInitialise client (GameDatum bs Nothing) v
, firstGame Contract fails with TxOutRefNotFound error. I checked that the utxo obtained fromgetThreadToken
really exists and keeps unspent. However, for some reason, at the time of minting fails because PAB can't find it. Solution: UserunInitialiseWith
and add a lookup with the utxo ref. (Please, check codebase). Notice that this lookup is NOT needed when the contract runs on EmulatorTrace.
- In order to run the contract on PAB/Testnet we need to modify
scSlotZeroTime
in pab-config-1.yml and pab-config-2.yml. ThescSlotZeroTime
value in file pab-config.yml (week06) seems not to work when when deadlines comes into play. I found unexpected results, concretely time doesn't match with Testnet time. Solution: ReplacescSlotZeroTime
as follows:
pscSlotConfig:
# scSlotZeroTime: 1596059091000 # Wednesday, July 29, 2020 21:44:51 - shelley launch time in milliseconds
scSlotZeroTime: 1594369216000 # (timeWhenSlotChangedTo1Sec (1595967616) - slotWhenSlotChangedTo1Sec (1598400)) * 1000
# Check https://cardano.stackexchange.com/questions/7034/how-to-convert-posixtime-to-slot-number-on-cardano-testnet/7035#7035