0

Having trouble with with the plutus-starter template. The following return null after starting the pab:

export WALLET_ID_1=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`
export WALLET_ID_2=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`

However; if I remove the | jq '.wiWallet.getWalletID' I do get the json returned from create. Any ideas?

1
  • Refreshed from starter repo and it is now working
    – Frank C.
    Sep 19, 2021 at 9:41

2 Answers 2

0

Version 1.0.9 introduced a new way of creating (and activating wallets). Your code snippet shows the way how to create wallets with version 1.0.9.

Previously, you would not rely on manually creating wallets, but instead just pass a number into the activate endpoint for the respective contract:

curl -s -H "Content-Type: application/json" \
  --request POST \
  --data '{"caID": "GameContract", "caWallet":{"getWallet": 1}}' \
  http://localhost:9080/api/contract/activate | jq

In version 1.0.9, you use the getWalletID from your requests to the wallet create endpoint to activate the given contract (e.g. GameContract that is shipped with the plutus-starter):

curl -s -H "Content-Type: application/json" \
  --request POST \
  --data '{"caID": "GameContract", "caWallet":{"getWalletId": '$WALLET_ID_1'}}' \
  http://localhost:9080/api/contract/activate | jq

Looking at the plutus repo, it appears that the Wallet API has gone through some significant changes. Could it be that your JSON Object did not have the wiWallet.getWalletID but wiWallet.getWallet key? If that's the case, then the jq tool would grab a non-existent key from the JSON object, thus returning null. This would happen if you still have an older plutus version installed while trying to follow the directions that apply to the newer API.

The reason I'm suggesting this as a possibility is this commit: https://github.com/input-output-hk/plutus/commit/58c8b4bde7177a18cd6761ba328bc105e5c82a47#diff-c00cadb75428bc7238834d185e1e7e63dde8e3d1313b34e6a046f623abb78322

Solution: Update your local plutus library so it matches the docs.

0

Can you post the exact error code that spits out? By the way, for my docker container I had to change:

export WALLET_ID_1=curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'

to

export WALLET_ID_1=curl -s -d '' http://172.17.0.2:9080/wallet/create | jq '.wiWallet.getWalletId'

If you go to your command prompt, get your container ID through "docker ps". Then run "docker inspect CONTAINERID" (replace CONTAINERID with yours). Then scroll to the bottom to get your host IP for your container. Mine was 172.17.0.2, yours might be different. I don't know if this has any impact to you, but I needed to do this to get mine to work.

1
  • The issue that you are having is a networking / bridging issue related to docker. This is not specific to plutus.
    – Matthias Sieber
    Sep 19, 2021 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.