Last active
July 14, 2022 16:11
-
-
Save johnshearing/cdf8f282a90bf6f6c29fccdec3b10da8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following is the terminal window history of inputs and outputs for lesson 5 of Marlowe Pioneers. | |
The lesson is found at the following URL: | |
https://github.com/input-output-hk/marlowe-cardano/blob/73ed922f025e494d0060e21cfba4a340b70d12e0/marlowe-cli/lectures/05-marlowe-cli-pab.ipynb | |
[nix-shell:~/marlowe-cardano]$ export CARDANO_NODE_SOCKET_PATH=/tmp/node.socket | |
[nix-shell:~/marlowe-cardano]$ export CARDANO_TESTNET_MAGIC=1567 | |
[nix-shell:~/marlowe-cardano]$ cardano-wallet recovery-phrase generate --size 24 | tee wallet.seed | cardano-wallet key from-recovery-phrase Shelley | cardano-wallet key child 1852H/1815H/0H/0/0 > wallet.prv | |
[nix-shell:~/marlowe-cardano]$ cat << EOI > wallet.restore | |
> { | |
> "name": "Example Wallet", | |
> "mnemonic_sentence": [ | |
> "rebuild", "mutual", "tomato", "reopen", "weather", "company", | |
> "custom", "risk", "cycle", "catch", "hammer", "unaware", | |
> "wedding", "club", "bike", "toilet", "trouble", "exist", | |
> "film", "high", "carpet", "alarm", "cash", "pitch" | |
> ], | |
> "passphrase": "TheRainInSpain" | |
> } | |
> EOI | |
[nix-shell:~/marlowe-cardano]$ | |
[nix-shell:~/marlowe-cardano]$ NOW=$(( $(date -u +%s) * 1000 )) | |
[nix-shell:~/marlowe-cardano]$ HOUR=$(( 60 * 60 * 1000 )) | |
[nix-shell:~/marlowe-cardano]$ cat > contract.json << EOI | |
when":> { | |
> "when": [ | |
> { | |
> "case": { | |
> "party": {"role_token": "PAB"}, "deposits": 15000000, | |
> "of_token": {"currency_symbol": "", "token_name": ""}, | |
> "into_account": {"role_token": "PAB"} | |
> }, | |
> "then": { | |
> "when": [{"case": {"notify_if": true}, "then": "close"}], | |
> "timeout": $(( NOW + 12 * HOUR )), "timeout_continuation": "close" | |
> } | |
> } | |
> ], | |
> "timeout": $(( NOW + 10 * HOUR )), "timeout_continuation": "close" | |
> } | |
> EOI | |
[nix-shell:~/marlowe-cardano]$ | |
[nix-shell:~/marlowe-cardano]$ curl -X POST -H "Content-type: application/json" -d @wallet.restore http://localhost:8090/v2/wallets | |
{"passphrase":{"last_updated_at":"2022-07-14T15:17:05.6277356Z"},"name":"Example Wallet","address_pool_gap":20,"state":{"progress":{"quantity":0,"unit":"percent"},"status":"syncing"},"id":"40785e7f3b1c2e6bd1bd2fa29dd4db0d0b4b8058","delegation":{"active":{"status":"not_delegating"},"next":[]},"assets":{"available":[],"total":[]},"balance":{"available":{"quantity":0,"unit":"lovelace"},"total":{"quantity":0,"unit":"lovelace"},"reward":{"quantity":0,"unit":"lovelace"}},"tip":{"absolute_slot_number":0,"time":"2022-04-14T14:52:01Z","slot_number":0,"epoch_number":0,"height":{"quantity":0,"unit":"block"}}} | |
[nix-shell:~/marlowe-cardano]$ WALLET_ID=40785e7f3b1c2e6bd1bd2fa29dd4db0d0b4b8058 | |
[nix-shell:~/marlowe-cardano]$ WALLET_ADDRESS=$(curl -s http://localhost:8090/v2/wallets/$WALLET_ID/addresses | jq -r '.[0].id') | |
[nix-shell:~/marlowe-cardano]$ echo $WALLET_ADDRESS | |
addr_test1qr8yxsy8csgtqvmf3ax4mgfan339zswu5z768u4lpw52e0863vk84ekxs6yqeg7kuwfyu4m6vyj4jw9uh7tzucppzcmqf3y35j | |
[nix-shell:~/marlowe-cardano]$ | |
[nix-shell:~/marlowe-cardano]$ cardano-cli query utxo --testnet-magic "$CARDANO_TESTNET_MAGIC" --address addr_test1qr8yxsy8csgtqvmf3ax4mgfan339zswu5z768u4lpw52e0863vk84ekxs6yqeg7kuwfyu4m6vyj4jw9uh7tzucppzcmqf3y35j | |
TxHash TxIx Amount | |
-------------------------------------------------------------------------------------- | |
f82737b10227d0e9726746e54d9bc4e01364b0d859e7d91386945c037922b005 0 100000000 lovelace + TxOutDatumNone | |
[nix-shell:~/marlowe-cardano]$ | |
[nix-shell:~/marlowe-cardano]$ marlowe-cli pab app --pab-url http://localhost:9080 \ | |
> --wallet $WALLET_ID \ | |
> --out-params-file app.params \ | |
> --out-instance-file app.instance \ | |
> --loop & | |
[1] 13815 | |
[nix-shell:~/marlowe-cardano]$ New observable state: Nothing | |
New active endpoints: [ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "close"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "redeem"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "auto"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "apply-inputs-nonmerkleized"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "apply-inputs"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "create"}, aeMetadata = Nothing}] | |
Partial transactions that need balancing: [] | |
At this point, the prompt had disappeared. | |
I think because previous process was running in background? | |
Anyway, the following command was entered: | |
marlowe-cli pab create --pab-url http://localhost:9080 \ | |
> --instance-file app.instance \ | |
> --contract-file contract.json \ | |
> --owner PAB=$WALLET_ADDRESS | |
New active endpoints: [] | |
[nix-shell:~/marlowe-cardano]$ New observable state: Just (EndpointException a834410b-a761-4dca-ade7-d999c87008c0 "create" (OtherContractError (OtherContractError "TxOutRef {txOutRefId = f82737b10227d0e9726746e54d9bc4e01364b0d859e7d91386945c037922b005, txOutRefIdx = 0} was not found on the chain index. Please verify that plutus-chain-index is 100% synced."))) | |
New active endpoints: [ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "close"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "redeem"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "auto"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "apply-inputs-nonmerkleized"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "apply-inputs"}, aeMetadata = Nothing},ActiveEndpoint {aeDescription = EndpointDescription {getEndpointDescription = "create"}, aeMetadata = Nothing}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment