Skip to content

Demo 1, a run

The tutorial's steps as they ran on a private chain, with the result under each command. The target release is v1.1.0, kit v1.1.0-2. Commands and results come from the supplied transcript. Local filesystem paths are shown as ; transaction IDs, tokens and addresses are unchanged.

Before you start: three wallets and a private chain

. ../stepper.sh
. ../stepper.sh
. ../stepper.sh
. ./stepper.sh
alice
alice_addr=$(singular wallet create --vault alice.vault --network-magic 42 | tee alice.address)
bob
bob_addr=$(singular wallet create --vault bob.vault --network-magic 42 | tee bob.address)
carol
carol_addr=$(singular wallet create --vault carol.vault --network-magic 42 | tee carol.address)
chain
devnet --fund-address "$(cat alice/alice.address):6:2000000000" --fund-address "$(cat bob/bob.address):6:2000000000" --fund-address "$(cat carol/carol.address):6:2000000000" > devnet.out 2> devnet.err &
devnet_pid=$!
trap 'kill -TERM -- -"$devnet_pid" 2>/dev/null' EXIT

Result:

[1] 193386
devnet_gone=0
until jq -e .providerUrl devnet.out >/dev/null 2>&1; do
  kill -0 "$devnet_pid" 2>/dev/null || { devnet_gone=1; break; }
  sleep 1
done
if [ "$devnet_gone" = 1 ]; then echo "the devnet died before its settings line appeared; its messages:"; cat devnet.err; false; else jq . devnet.out; fi

Result:

{
  "independentSourceDirectory": "<local>",
  "networkMagic": 42,
  "networkTimeDirectory": "<local>",
  "privateProbeSocket": "<local>",
  "providerUrl": "http://127.0.0.1:43561/api/v1"
}

Step 1: Carol creates the registry

carol
jq --arg blueprint "$blueprint" '{"koios-url": .providerUrl, "network-time": .networkTimeDirectory, "network-magic": 42, "blueprint": $blueprint, "state-dir": "carol-journal"}' ../devnet.out > carol.json
process_ms=${PROCESS_TIME_MS:-180000}; retract_ms=${RETRACT_TIME_MS:-60000}
open-datum create --process-time "$process_ms" --reclaim-time "$retract_ms" --booking-width 60000 --vault carol.vault > receipts/01-create.json

Result:

create success ......................................................... 15.1s
jq '{outcome, registry, stateToken, root, submissions}' receipts/01-create.json
jq -er .stateToken receipts/01-create.json > ../registry.token

Result:

{
  "outcome": "success",
  "registry": "singular_devnet1fxffrk7807uykkgwfukh9pug4grpj9385tzujkmtcnt8n96t2g03e7vn0mxjywfcfz8uzqxnu5zcwt5t74mjuqupfd4ffjwk48j9zl",
  "stateToken": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679.974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6",
  "root": "0000000000000000000000000000000000000000000000000000000000000000",
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "a95c4c1fa774f1f608c5392ac6c751e221a99f78b53e7af37316b33fc7fd8d03",
        "slot": 136
      },
      "claims": [
        "the first output is live carrying its reference script"
      ],
      "confirmations": 35,
      "how": "sent",
      "identity": "3287ec5864e399a3351ff12293caabe147ff7c8b82615b78f815fde069283dd3",
      "outputs": [
        {
          "address": "addr_test1vqz9jwamg483r075h4skrudpmcfsdvq85r4zzavrwdps5ugxsdr83",
          "assets": [],
          "lovelace": 34454140,
          "output": "3287ec5864e399a3351ff12293caabe147ff7c8b82615b78f815fde069283dd3#0",
          "unspent": true
        },
        {
          "address": "addr_test1vqz9jwamg483r075h4skrudpmcfsdvq85r4zzavrwdps5ugxsdr83",
          "assets": [],
          "lovelace": 1965036983,
          "output": "3287ec5864e399a3351ff12293caabe147ff7c8b82615b78f815fde069283dd3#1",
          "unspent": true
        }
      ]
    },
    {
      "chainPoint": {
        "blockHash": "79e1acec3321f74cf6052b6f36120a65790813e75ca219abd931b0e8a64fdb05",
        "slot": 148
      },
      "claims": [
        "the first output is live carrying its reference script"
      ],
      "confirmations": 23,
      "how": "sent",
      "identity": "4a2171e00752049161989e130215c2e795d16155a08a9a187a6d71b3da38693b",
      "outputs": [
        {
          "address": "addr_test1vqz9jwamg483r075h4skrudpmcfsdvq85r4zzavrwdps5ugxsdr83",
          "assets": [],
          "lovelace": 43319810,
          "output": "4a2171e00752049161989e130215c2e795d16155a08a9a187a6d71b3da38693b#0",
          "unspent": true
        },
        {
          "address": "addr_test1vqz9jwamg483r075h4skrudpmcfsdvq85r4zzavrwdps5ugxsdr83",
          "assets": [],
          "lovelace": 1956080805,
          "output": "4a2171e00752049161989e130215c2e795d16155a08a9a187a6d71b3da38693b#1",
          "unspent": true
        }
      ]
    },
    {
      "chainPoint": {
        "blockHash": "e34b7f13d3eb266019ddeacefc29674a4f23f6e163b178b30d49fedce28da5df",
        "slot": 159
      },
      "claims": [
        "the first output is live holding the token alone"
      ],
      "confirmations": 12,
      "how": "sent",
      "identity": "15213be31274d1197d41ca511bb3c78e68ce4285d9c68f6475e9607c92fd9a62",
      "outputs": [
        {
          "address": "addr_test1wpye9ywmcalmsj6epe8j6u583z4qvxgky73vtj2md0zdv7gcmvhhn",
          "assets": [
            {
              "name": "974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6",
              "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
              "quantity": 1
            }
          ],
          "lovelace": 1344720,
          "output": "15213be31274d1197d41ca511bb3c78e68ce4285d9c68f6475e9607c92fd9a62#0",
          "unspent": true
        },
        {
          "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
          "assets": [
            {
              "name": "8361397268518921168b02a1253373aa22fa3d1e488bcdf77a0dc7c36f30d60b",
              "policy": "67bb50e5aab678b9955e1d8981050a14e0f93da912b3a8b4a7161ca7",
              "quantity": 1
            }
          ],
          "lovelace": 1267140,
          "output": "15213be31274d1197d41ca511bb3c78e68ce4285d9c68f6475e9607c92fd9a62#1",
          "unspent": true
        },
        {
          "address": "addr_test1vqz9jwamg483r075h4skrudpmcfsdvq85r4zzavrwdps5ugxsdr83",
          "assets": [],
          "lovelace": 1996359409,
          "output": "15213be31274d1197d41ca511bb3c78e68ce4285d9c68f6475e9607c92fd9a62#2",
          "unspent": true
        }
      ]
    }
  ]
}

Step 2: join using the public token

alice
jq --arg blueprint "$blueprint" --arg token "$(cat ../registry.token)" '{"koios-url": .providerUrl, "network-time": .networkTimeDirectory, "network-magic": 42, "blueprint": $blueprint, "state-dir": "alice-journal", "state-token": $token}' ../devnet.out > alice.json
jq . alice.json

Result:

{
  "koios-url": "http://127.0.0.1:43561/api/v1",
  "network-time": "<local>",
  "network-magic": 42,
  "blueprint": "<local>",
  "state-dir": "alice-journal",
  "state-token": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679.974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6"
}
bob
jq --arg blueprint "$blueprint" --arg token "$(cat ../registry.token)" '{"koios-url": .providerUrl, "network-time": .networkTimeDirectory, "network-magic": 42, "blueprint": $blueprint, "state-dir": "bob-journal", "state-token": $token}' ../devnet.out > bob.json
jq . bob.json

Result:

{
  "koios-url": "http://127.0.0.1:43561/api/v1",
  "network-time": "<local>",
  "network-magic": 42,
  "blueprint": "<local>",
  "state-dir": "bob-journal",
  "state-token": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679.974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6"
}

Step 3: Alice books her key

alice
printf '{"answer":42}\n' > payload.json
open-datum insert --key alice --payload payload.json --deposit 3000000 --vault alice.vault > receipts/03-insert-alice.json

Result:

insert success .......................................................... 5.4s
jq '{outcome, pending, deposit, processDeadline, reclaimEnd}' receipts/03-insert-alice.json

Result:

{
  "outcome": "success",
  "pending": "902f615c16fce9b562c4033b9bd23df12292b609e9f42b513d6f7f2f8b98b971#0",
  "deposit": 3000000,
  "processDeadline": 1794049742200,
  "reclaimEnd": 1794049802200
}

Step 4: Bob folds Alice's booking

bob
open-datum fold --vault bob.vault > receipts/04-fold-insert.json

Result:

fold success ............................................................ 5.6s
jq '{outcome, folded, skipped, left, root, stateOutput}' receipts/04-fold-insert.json

Result:

{
  "outcome": "success",
  "folded": [
    {
      "key": "616c696365",
      "kind": "registration",
      "pending": "902f615c16fce9b562c4033b9bd23df12292b609e9f42b513d6f7f2f8b98b971#0"
    }
  ],
  "skipped": [],
  "left": 0,
  "root": "c35baac1ae86c6a791e4de21d571b5eddedd2cc9cf6ac4a34cefe807a13b088f",
  "stateOutput": "46aa68223dd20e55c4beb3cdb7bdb7a07f52da38b549aaf496f74c0579291886#0"
}

Step 5: Alice reads her key

alice
open-datum inspect --key alice --json > receipts/05-read-alice.json
jq '{answer, payload, deposit, holding: .outputRef}' receipts/05-read-alice.json
jq -er .outputRef receipts/05-read-alice.json > holding.ref

Result:

inspect live ............................................................ 0.0s
{
  "answer": "live",
  "payload": {
    "answer": 42
  },
  "deposit": 3000000,
  "holding": "46aa68223dd20e55c4beb3cdb7bdb7a07f52da38b549aaf496f74c0579291886#1"
}

Step 6: Alice changes the payload

alice
printf '{"answer":43}\n' > payload-new.json
open-datum update --holding "$(cat holding.ref)" --payload payload-new.json --vault alice.vault > receipts/06-update.json

Result:

update success .......................................................... 4.8s
jq '{outcome, holding, treasuryDonation, submissions}' receipts/06-update.json
jq -er .holding receipts/06-update.json > holding.new && mv holding.new holding.ref

Result:

{
  "outcome": "success",
  "holding": "c0b6757ccab89a858195b8a455a1d62d07d859ac01bd11b64c9d8c6b6fbdc01b#0",
  "treasuryDonation": 0,
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "f014ad665f56a54891713b5016ea5141a07dba3ef9cfa53c4e0bcf70dad35b5f",
        "slot": 328
      },
      "claims": [
        "the first output matches the complete output prepared by the command"
      ],
      "confirmations": 12,
      "how": "sent",
      "identity": "c0b6757ccab89a858195b8a455a1d62d07d859ac01bd11b64c9d8c6b6fbdc01b",
      "outputs": [
        {
          "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
          "assets": [
            {
              "name": "bd29bbbd73c3cbb987561de82b3792415af35be2adb084f33b841b4a5d9f3664",
              "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
              "quantity": 1
            }
          ],
          "lovelace": 3000000,
          "output": "c0b6757ccab89a858195b8a455a1d62d07d859ac01bd11b64c9d8c6b6fbdc01b#0",
          "unspent": true
        },
        {
          "address": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg",
          "assets": [],
          "lovelace": 1999345957,
          "output": "c0b6757ccab89a858195b8a455a1d62d07d859ac01bd11b64c9d8c6b6fbdc01b#1",
          "unspent": true
        }
      ]
    }
  ]
}

Step 7: read the key again

alice
open-datum inspect --key alice --json > receipts/07-read-alice.json
jq '{answer, payload, deposit, holding: .outputRef}' receipts/07-read-alice.json

Result:

inspect live ............................................................ 0.0s
{
  "answer": "live",
  "payload": {
    "answer": 43
  },
  "deposit": 3000000,
  "holding": "c0b6757ccab89a858195b8a455a1d62d07d859ac01bd11b64c9d8c6b6fbdc01b#0"
}

Step 8: Alice books permanent termination

alice
open-datum terminate --holding "$(cat holding.ref)" --vault alice.vault > receipts/08-terminate.json

Result:

terminate success ....................................................... 5.0s
jq '{outcome, pending, treasuryDonation, submissions}' receipts/08-terminate.json

Result:

{
  "outcome": "success",
  "pending": "993221e8358b3d2932b00e553b134c9805edf2ec006b4356b5730214b1195742#0",
  "treasuryDonation": 3000000,
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "82a0dc490640401fd86c5030a86762164c776c4b6c425fa360561c1e35bae854",
        "slot": 382
      },
      "claims": [
        "the first output matches the complete output prepared by the command"
      ],
      "confirmations": 11,
      "how": "sent",
      "identity": "993221e8358b3d2932b00e553b134c9805edf2ec006b4356b5730214b1195742",
      "outputs": [
        {
          "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
          "assets": [
            {
              "name": "bd29bbbd73c3cbb987561de82b3792415af35be2adb084f33b841b4a5d9f3664",
              "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
              "quantity": 1
            },
            {
              "name": "00920a5a7f018bf535ceb513f9802ba536b73942ba6615f6c26c4360083f9d4c",
              "policy": "67bb50e5aab678b9955e1d8981050a14e0f93da912b3a8b4a7161ca7",
              "quantity": 1
            }
          ],
          "lovelace": 1426610,
          "output": "993221e8358b3d2932b00e553b134c9805edf2ec006b4356b5730214b1195742#0",
          "unspent": true
        },
        {
          "address": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg",
          "assets": [],
          "lovelace": 1997851455,
          "output": "993221e8358b3d2932b00e553b134c9805edf2ec006b4356b5730214b1195742#1",
          "unspent": true
        }
      ]
    }
  ]
}

Step 9: Bob folds the termination

bob
open-datum inspect --key alice --json > receipts/09-read-alice.json
jq '{answer, request: .outputRef}' receipts/09-read-alice.json

Result:

inspect pending-termination ............................................. 0.0s
{
  "answer": "pending-termination",
  "request": "993221e8358b3d2932b00e553b134c9805edf2ec006b4356b5730214b1195742#0"
}
open-datum fold --vault bob.vault > receipts/09-fold-terminate.json

Result:

fold success ............................................................ 5.9s
jq '{outcome, folded, skipped, left, root, stateOutput}' receipts/09-fold-terminate.json

Result:

{
  "outcome": "success",
  "folded": [
    {
      "key": "616c696365",
      "kind": "termination",
      "pending": "993221e8358b3d2932b00e553b134c9805edf2ec006b4356b5730214b1195742#0"
    }
  ],
  "skipped": [],
  "left": 0,
  "root": "8aa350349a4964fe0ee54c03cac2d5b33db04e0c98a302cf21861dcdaa7f4452",
  "stateOutput": "1b2eca3c422c20c0194727cbf05adbf24e47cc928cdf93eb4851d938dfdc0549#0"
}

Step 10: read the terminated key

alice
singular registry inspect --key alice --json > receipts/10-read-alice.json
jq '{answer, stateOutput, root}' receipts/10-read-alice.json

Result:

registry inspect terminal ............................................... 0.2s
{
  "answer": "terminal",
  "stateOutput": "1b2eca3c422c20c0194727cbf05adbf24e47cc928cdf93eb4851d938dfdc0549#0",
  "root": "8aa350349a4964fe0ee54c03cac2d5b33db04e0c98a302cf21861dcdaa7f4452"
}
singular registry inspect --key nobody --json > receipts/10-read-nobody.json
jq '{answer, stateOutput, root}' receipts/10-read-nobody.json

Result:

registry inspect never-registered ....................................... 0.2s
{
  "answer": "never-registered",
  "stateOutput": "1b2eca3c422c20c0194727cbf05adbf24e47cc928cdf93eb4851d938dfdc0549#0",
  "root": "8aa350349a4964fe0ee54c03cac2d5b33db04e0c98a302cf21861dcdaa7f4452"
}

Step 11: clean up an expired registration

alice
open-datum insert --deposit 3000000 --key late --payload payload.json --vault alice.vault > receipts/11a-insert-late.json

Result:

insert success .......................................................... 5.6s
jq -er .pending receipts/11a-insert-late.json > ../late.pending
jq -er .reclaimEnd receipts/11a-insert-late.json > ../late.expires
bob
wait_until_ms "$(cat ../late.expires)"
open-datum cleanup --pending "$(cat ../late.pending)" --vault bob.vault > receipts/11d-cleanup.json

Result:

cleanup success ......................................................... 5.2s
jq '{outcome, pending, returned, locked, submissions}' receipts/11d-cleanup.json

Result:

{
  "outcome": "success",
  "pending": "5bbebbe36d27ece4a574a230016035706db5dfdef52bb4f6dd13bb1c98b89b18#0",
  "returned": {
    "lovelace": 3000000,
    "output": "324032ab04e36abe09da849481c00c20f9405169f375df9dd77c54ce93cc72df#0",
    "recipient": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg"
  },
  "locked": 3000000,
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "85dd872955a0586d3c82985665288d0cc7b25faa7155788096c1a0c649b02ec6",
        "slot": 3575
      },
      "claims": [
        "the first output is live, ada only, at the address it was paid to"
      ],
      "confirmations": 12,
      "how": "sent",
      "identity": "324032ab04e36abe09da849481c00c20f9405169f375df9dd77c54ce93cc72df",
      "outputs": [
        {
          "address": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg",
          "assets": [],
          "lovelace": 3000000,
          "output": "324032ab04e36abe09da849481c00c20f9405169f375df9dd77c54ce93cc72df#0",
          "unspent": true
        },
        {
          "address": "addr_test1vqqqkvg6v3klww72msu3mg76vwg8fcnrqn90v0sm04n99kgzj3fce",
          "assets": [],
          "lovelace": 1999637594,
          "output": "324032ab04e36abe09da849481c00c20f9405169f375df9dd77c54ce93cc72df#1",
          "unspent": true
        }
      ]
    }
  ]
}

Step 12: Bob books his own key with external signing

bob
printf '{"answer":42}\n' > payload.json
jq 'del(.["state-token"])' bob.json > wallet.json
open-datum insert --deposit 3000000 --key bob --payload payload.json --wallet-address "$bob_addr" --bundle bundles/insert-bob.bundle > receipts/12-insert-bob.json

Result:

insert waiting-for-signatures ........................................... 3.3s
singular wallet sign --config wallet.json --vault bob.vault --out witnesses/insert-bob bundles/insert-bob.bundle

Result:

witnesses/insert-bob/f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e.witness
signed f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e, deadline 4202, among 1 signer addresses
  effect: the first output is live holding the token alone
singular submit --config wallet.json --witnesses witnesses/insert-bob --receipt receipts/12-insert-bob.submitted.json bundles/insert-bob.bundle

Result:

submit success .......................................................... 1.8s
{
    "bundleHash": "c0a95b16b2bd24fa2f654a71595b5c2f0f6202ca7c0a39a98464d880d813de64",
    "command": "submit",
    "outcome": "success",
    "submissions": [
        {
            "chainPoint": {
                "blockHash": "6b26c2082c64f6e8497e9bd1f9cebd05c8977bdc1f1cf115728824583afa0716",
                "slot": 3641
            },
            "claims": [
                "the first output is live holding the token alone"
            ],
            "confirmations": 11,
            "how": "sent",
            "identity": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e",
            "outputs": [
                {
                    "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
                    "assets": [
                        {
                            "name": "b93129b439030317f0b335f623f664ba0ba205ea05224b562ca708e2d5c86195",
                            "policy": "67bb50e5aab678b9955e1d8981050a14e0f93da912b3a8b4a7161ca7",
                            "quantity": 1
                        }
                    ],
                    "lovelace": 3000000,
                    "output": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e#0",
                    "unspent": true
                },
                {
                    "address": "addr_test1vqqqkvg6v3klww72msu3mg76vwg8fcnrqn90v0sm04n99kgzj3fce",
                    "assets": [],
                    "lovelace": 1996293309,
                    "output": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e#1",
                    "unspent": true
                }
            ]
        }
    ]
}
jq '{outcome, submissions}' receipts/12-insert-bob.submitted.json

Result:

{
  "outcome": "success",
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "6b26c2082c64f6e8497e9bd1f9cebd05c8977bdc1f1cf115728824583afa0716",
        "slot": 3641
      },
      "claims": [
        "the first output is live holding the token alone"
      ],
      "confirmations": 11,
      "how": "sent",
      "identity": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e",
      "outputs": [
        {
          "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
          "assets": [
            {
              "name": "b93129b439030317f0b335f623f664ba0ba205ea05224b562ca708e2d5c86195",
              "policy": "67bb50e5aab678b9955e1d8981050a14e0f93da912b3a8b4a7161ca7",
              "quantity": 1
            }
          ],
          "lovelace": 3000000,
          "output": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e#0",
          "unspent": true
        },
        {
          "address": "addr_test1vqqqkvg6v3klww72msu3mg76vwg8fcnrqn90v0sm04n99kgzj3fce",
          "assets": [],
          "lovelace": 1996293309,
          "output": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e#1",
          "unspent": true
        }
      ]
    }
  ]
}

Step 13: Alice folds Bob's booking

alice
open-datum fold --vault alice.vault > receipts/13-fold-bob.json

Result:

fold success ............................................................ 6.3s
jq '{outcome, folded, skipped, left, root}' receipts/13-fold-bob.json

Result:

{
  "outcome": "success",
  "folded": [
    {
      "key": "626f62",
      "kind": "registration",
      "pending": "f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e#0"
    }
  ],
  "skipped": [],
  "left": 0,
  "root": "028af26f1990bee3ac3cd34cfc42e21d7d37356a8e0cdf5e368e9fbaa3a68375"
}

Step 14: Alice takes back an unprocessed registration

alice
open-datum insert --deposit 3000000 --key unfolded --payload payload.json --vault alice.vault > receipts/14a-insert-unfolded.json

Result:

insert success .......................................................... 6.0s
wait_until_ms "$(jq -er .processDeadline receipts/14a-insert-unfolded.json)"
open-datum reclaim --pending "$(jq -er .pending receipts/14a-insert-unfolded.json)" --vault alice.vault > receipts/14c-reclaim.json

Result:

reclaim success ......................................................... 5.2s
jq '{outcome, pending, returned, locked, submissions}' receipts/14c-reclaim.json

Result:

{
  "outcome": "success",
  "pending": "39c953a906678cdd183e488a1b0c62055e5ea00ad7f197d6988cc731fdf6854a#0",
  "returned": {
    "lovelace": 3025620,
    "output": "a4a0852c727ec0460bfa69dedbb5f05eabf35a615ebf6a31fe73fe1da53058fb#0",
    "recipient": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg"
  },
  "locked": 3025620,
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "5e785943cbd2718d8f2a8d2a817e3029c92b0e3af6b2f62c0e162c6377de0c6c",
        "slot": 6224
      },
      "claims": [
        "the first output is live, ada only, at the address it was paid to"
      ],
      "confirmations": 12,
      "how": "sent",
      "identity": "a4a0852c727ec0460bfa69dedbb5f05eabf35a615ebf6a31fe73fe1da53058fb",
      "outputs": [
        {
          "address": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg",
          "assets": [],
          "lovelace": 3025620,
          "output": "a4a0852c727ec0460bfa69dedbb5f05eabf35a615ebf6a31fe73fe1da53058fb#0",
          "unspent": true
        },
        {
          "address": "addr_test1vpnjz2lpycscpps0wnfmx4evr5snlx7q3lncys5jss6lrrqnt3cxg",
          "assets": [],
          "lovelace": 1998658813,
          "output": "a4a0852c727ec0460bfa69dedbb5f05eabf35a615ebf6a31fe73fe1da53058fb#1",
          "unspent": true
        }
      ]
    }
  ]
}

Step 15: book one more key

alice
open-datum insert --deposit 3000000 --key dave --payload payload.json --vault alice.vault > receipts/15-insert-dave.json

Result:

insert success .......................................................... 5.8s

Step 16: Bob folds the final registration with external signing

bob
open-datum fold --wallet-address "$bob_addr" --bundle bundles/fold-dave.bundle > receipts/16a-fold-dave.json

Result:

fold waiting-for-signatures ............................................. 3.5s
singular wallet sign --config wallet.json --vault bob.vault --out witnesses/fold-dave bundles/fold-dave.bundle

Result:

witnesses/fold-dave/5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704.witness
signed 5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704, deadline 8658, among 1 signer addresses
  effect: the first output is live holding the token alone
singular submit --config wallet.json --witnesses witnesses/fold-dave --receipt receipts/16a-fold-dave.submitted.json bundles/fold-dave.bundle

Result:

submit success .......................................................... 1.9s
{
    "bundleHash": "974aa039f3c825e91df676a3cd2ce624355bba7de4d7d8a5821cb1e71b34cdf5",
    "command": "submit",
    "outcome": "success",
    "submissions": [
        {
            "chainPoint": {
                "blockHash": "270764ee7ce67282958f23d70356b6192f3454f14291b5c16d610392059270fd",
                "slot": 6353
            },
            "claims": [
                "the first output is live holding the token alone"
            ],
            "confirmations": 11,
            "how": "sent",
            "identity": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704",
            "outputs": [
                {
                    "address": "addr_test1wpye9ywmcalmsj6epe8j6u583z4qvxgky73vtj2md0zdv7gcmvhhn",
                    "assets": [
                        {
                            "name": "974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6",
                            "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
                            "quantity": 1
                        }
                    ],
                    "lovelace": 1344720,
                    "output": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#0",
                    "unspent": true
                },
                {
                    "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
                    "assets": [
                        {
                            "name": "dafb3d3d9278fa0828512756c3068efb2d0a3af95217defec68e3265d28010e7",
                            "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
                            "quantity": 1
                        }
                    ],
                    "lovelace": 3000000,
                    "output": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#1",
                    "unspent": true
                },
                {
                    "address": "addr_test1vqqqkvg6v3klww72msu3mg76vwg8fcnrqn90v0sm04n99kgzj3fce",
                    "assets": [],
                    "lovelace": 1998804843,
                    "output": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#2",
                    "unspent": true
                }
            ]
        }
    ]
}
jq '{outcome, expected}' receipts/16a-fold-dave.json
jq '{outcome, submissions}' receipts/16a-fold-dave.submitted.json

Result:

{
  "outcome": "waiting-for-signatures",
  "expected": {
    "fingerprint": "asset13t04d4yacw3086klka609sl7wwtzllym0w2xzl",
    "folded": [
      {
        "key": "64617665",
        "kind": "registration",
        "pending": "87242299f3ed4378c91393c69e6b75bff2ac641bab83a1028c4941192c5aab0a#0"
      }
    ],
    "left": 0,
    "lovelace": 1344720,
    "registry": "singular_devnet1fxffrk7807uykkgwfukh9pug4grpj9385tzujkmtcnt8n96t2g03e7vn0mxjywfcfz8uzqxnu5zcwt5t74mjuqupfd4ffjwk48j9zl",
    "root": "568be7f1d7af2e9762a534f2de825417e6810feba46b6041dc32045c409f15ea",
    "skipped": [],
    "stateOutput": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#0",
    "stateToken": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679.974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6"
  }
}
{
  "outcome": "success",
  "submissions": [
    {
      "chainPoint": {
        "blockHash": "270764ee7ce67282958f23d70356b6192f3454f14291b5c16d610392059270fd",
        "slot": 6353
      },
      "claims": [
        "the first output is live holding the token alone"
      ],
      "confirmations": 11,
      "how": "sent",
      "identity": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704",
      "outputs": [
        {
          "address": "addr_test1wpye9ywmcalmsj6epe8j6u583z4qvxgky73vtj2md0zdv7gcmvhhn",
          "assets": [
            {
              "name": "974b521f1cf9937ecd223938488fc100d3e505872e8bf5772e03814b6a94c9d6",
              "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
              "quantity": 1
            }
          ],
          "lovelace": 1344720,
          "output": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#0",
          "unspent": true
        },
        {
          "address": "addr_test1wpnmk58942m83wv4tcwcnqg9pg2wp7fa4yft82955utpefcck6tk9",
          "assets": [
            {
              "name": "dafb3d3d9278fa0828512756c3068efb2d0a3af95217defec68e3265d28010e7",
              "policy": "499291dbc77fb84b590e4f2d728788aa06191627a2c5c95b6bc4d679",
              "quantity": 1
            }
          ],
          "lovelace": 3000000,
          "output": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#1",
          "unspent": true
        },
        {
          "address": "addr_test1vqqqkvg6v3klww72msu3mg76vwg8fcnrqn90v0sm04n99kgzj3fce",
          "assets": [],
          "lovelace": 1998804843,
          "output": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704#2",
          "unspent": true
        }
      ]
    }
  ]
}

Extra: look at the wallets

alice_addr=$(cat ../alice/alice.address); bob_addr=$(cat ../bob/bob.address)
wallet_show "$alice_addr"

Result:

{
  "outputs": 8,
  "total_ada": 11986.494149,
  "utxos": [
    {
      "tx": "324032ab04e3",
      "ix": 0,
      "ada": 3,
      "tokens": []
    },
    {
      "tx": "39c953a90667",
      "ix": 1,
      "ada": 1996.267247,
      "tokens": []
    },
    {
      "tx": "5bbebbe36d27",
      "ix": 1,
      "ada": 1996.293221,
      "tokens": []
    },
    {
      "tx": "87242299f3ed",
      "ix": 1,
      "ada": 1995.104616,
      "tokens": []
    },
    {
      "tx": "902f615c16fc",
      "ix": 1,
      "ada": 1996.293177,
      "tokens": []
    },
    {
      "tx": "993221e8358b",
      "ix": 1,
      "ada": 1997.851455,
      "tokens": []
    },
    {
      "tx": "a4a0852c727e",
      "ix": 0,
      "ada": 3.02562,
      "tokens": []
    },
    {
      "tx": "a4a0852c727e",
      "ix": 1,
      "ada": 1998.658813,
      "tokens": []
    }
  ]
}
wallet_show "$bob_addr"

Result:

{
  "outputs": 6,
  "total_ada": 11993.558311,
  "utxos": [
    {
      "tx": "324032ab04e3",
      "ix": 1,
      "ada": 1999.637594,
      "tokens": []
    },
    {
      "tx": "46aa68223dd2",
      "ix": 2,
      "ada": 1998.822565,
      "tokens": []
    },
    {
      "tx": "5b4e0b56b222",
      "ix": 2,
      "ada": 1998.804843,
      "tokens": []
    },
    {
      "tx": "72818fb4dc42",
      "ix": 4,
      "ada": 2000,
      "tokens": []
    },
    {
      "tx": "72818fb4dc42",
      "ix": 5,
      "ada": 2000,
      "tokens": []
    },
    {
      "tx": "f4442a45f79c",
      "ix": 1,
      "ada": 1996.293309,
      "tokens": []
    }
  ]
}
curl -fsS "$(koios_url)/tip" | jq '.[0] | {abs_slot, block_no}'

Result:

{
  "abs_slot": 6367,
  "block_no": null
}

Extra: look inside the transactions

bob
jq '.transactions[] | {effects, deadline}' bundles/fold-dave.bundle

Result:

{
  "effects": [
    "the first output is live holding the token alone"
  ],
  "deadline": 8658
}
jq '.submissions[]? | {transaction: .identity, chainPoint, confirmations, claims}' receipts/16a-fold-dave.submitted.json

Result:

{
  "transaction": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704",
  "chainPoint": {
    "blockHash": "270764ee7ce67282958f23d70356b6192f3454f14291b5c16d610392059270fd",
    "slot": 6353
  },
  "confirmations": 11,
  "claims": [
    "the first output is live holding the token alone"
  ]
}
for f in receipts/*.json; do [ "$f" = receipts/tx-info.json ] && continue; jq -r --arg f "$f" '.submissions[]? | "\($f)  \(.identity)  confirmations \(.confirmations)"' "$f"; done

Result:

receipts/04-fold-insert.json  46aa68223dd20e55c4beb3cdb7bdb7a07f52da38b549aaf496f74c0579291886  confirmations 12
receipts/09-fold-terminate.json  1b2eca3c422c20c0194727cbf05adbf24e47cc928cdf93eb4851d938dfdc0549  confirmations 11
receipts/11d-cleanup.json  324032ab04e36abe09da849481c00c20f9405169f375df9dd77c54ce93cc72df  confirmations 12
receipts/12-insert-bob.submitted.json  f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e  confirmations 11
receipts/16a-fold-dave.submitted.json  5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704  confirmations 11
tx=$(jq -r '.submissions[0].identity' receipts/16a-fold-dave.submitted.json)
curl -fsS -X POST "$(koios_url)/tx_info" -H 'content-type: application/json' -d "{\"_tx_hashes\":[\"$tx\"]}" > receipts/tx-info.json
jq '.[0] | {tx_hash, block_height, absolute_slot, inputs: [.inputs[] | {from: .payment_addr.bech32[0:16], ada: ((.value|tonumber)/1000000)}], outputs: [.outputs[] | {to: .payment_addr.bech32[0:16], ada: ((.value|tonumber)/1000000), tokens: [.asset_list[].asset_name[0:8]], has_data: (.inline_datum != null)}]}' receipts/tx-info.json

Result:

{
  "tx_hash": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704",
  "block_height": 6353,
  "absolute_slot": 6353,
  "inputs": [
    {
      "from": "addr_test1vqqqkv",
      "ada": 2000
    },
    {
      "from": "addr_test1wpnmk5",
      "ada": 3
    },
    {
      "from": "addr_test1wpye9y",
      "ada": 1.34472
    }
  ],
  "outputs": [
    {
      "to": "addr_test1wpye9y",
      "ada": 1.34472,
      "tokens": [
        "974b521f"
      ],
      "has_data": true
    },
    {
      "to": "addr_test1wpnmk5",
      "ada": 3,
      "tokens": [
        "dafb3d3d"
      ],
      "has_data": true
    },
    {
      "to": "addr_test1vqqqkv",
      "ada": 1998.804843,
      "tokens": [],
      "has_data": false
    }
  ]
}

Extra: look at the wallets

Run again at the end of the path:

wallet_show "$alice_addr"

Result:

{
  "outputs": 8,
  "total_ada": 11986.494149,
  "utxos": [
    {
      "tx": "324032ab04e3",
      "ix": 0,
      "ada": 3,
      "tokens": []
    },
    {
      "tx": "39c953a90667",
      "ix": 1,
      "ada": 1996.267247,
      "tokens": []
    },
    {
      "tx": "5bbebbe36d27",
      "ix": 1,
      "ada": 1996.293221,
      "tokens": []
    },
    {
      "tx": "87242299f3ed",
      "ix": 1,
      "ada": 1995.104616,
      "tokens": []
    },
    {
      "tx": "902f615c16fc",
      "ix": 1,
      "ada": 1996.293177,
      "tokens": []
    },
    {
      "tx": "993221e8358b",
      "ix": 1,
      "ada": 1997.851455,
      "tokens": []
    },
    {
      "tx": "a4a0852c727e",
      "ix": 0,
      "ada": 3.02562,
      "tokens": []
    },
    {
      "tx": "a4a0852c727e",
      "ix": 1,
      "ada": 1998.658813,
      "tokens": []
    }
  ]
}

Run again at the end of the path:

wallet_show "$bob_addr"

Result:

{
  "outputs": 6,
  "total_ada": 11993.558311,
  "utxos": [
    {
      "tx": "324032ab04e3",
      "ix": 1,
      "ada": 1999.637594,
      "tokens": []
    },
    {
      "tx": "46aa68223dd2",
      "ix": 2,
      "ada": 1998.822565,
      "tokens": []
    },
    {
      "tx": "5b4e0b56b222",
      "ix": 2,
      "ada": 1998.804843,
      "tokens": []
    },
    {
      "tx": "72818fb4dc42",
      "ix": 4,
      "ada": 2000,
      "tokens": []
    },
    {
      "tx": "72818fb4dc42",
      "ix": 5,
      "ada": 2000,
      "tokens": []
    },
    {
      "tx": "f4442a45f79c",
      "ix": 1,
      "ada": 1996.293309,
      "tokens": []
    }
  ]
}

Run again at the end of the path:

curl -fsS "$(koios_url)/tip" | jq '.[0] | {abs_slot, block_no}'

Result:

{
  "abs_slot": 6372,
  "block_no": null
}

Extra: look inside the transactions

Run again at the end of the path:

jq '.transactions[] | {effects, deadline}' bundles/fold-dave.bundle

Result:

{
  "effects": [
    "the first output is live holding the token alone"
  ],
  "deadline": 8658
}

Run again at the end of the path:

jq '.submissions[]? | {transaction: .identity, chainPoint, confirmations, claims}' receipts/16a-fold-dave.submitted.json

Result:

{
  "transaction": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704",
  "chainPoint": {
    "blockHash": "270764ee7ce67282958f23d70356b6192f3454f14291b5c16d610392059270fd",
    "slot": 6353
  },
  "confirmations": 11,
  "claims": [
    "the first output is live holding the token alone"
  ]
}

Run again at the end of the path:

for f in receipts/*.json; do [ "$f" = receipts/tx-info.json ] && continue; jq -r --arg f "$f" '.submissions[]? | "\($f)  \(.identity)  confirmations \(.confirmations)"' "$f"; done

Result:

receipts/04-fold-insert.json  46aa68223dd20e55c4beb3cdb7bdb7a07f52da38b549aaf496f74c0579291886  confirmations 12
receipts/09-fold-terminate.json  1b2eca3c422c20c0194727cbf05adbf24e47cc928cdf93eb4851d938dfdc0549  confirmations 11
receipts/11d-cleanup.json  324032ab04e36abe09da849481c00c20f9405169f375df9dd77c54ce93cc72df  confirmations 12
receipts/12-insert-bob.submitted.json  f4442a45f79c618fbfe5abde2b8943e1a01a1e41b004e01b1a4d0b9a6b301a8e  confirmations 11
receipts/16a-fold-dave.submitted.json  5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704  confirmations 11

Run again at the end of the path:

tx=$(jq -r '.submissions[0].identity' receipts/16a-fold-dave.submitted.json)
curl -fsS -X POST "$(koios_url)/tx_info" -H 'content-type: application/json' -d "{\"_tx_hashes\":[\"$tx\"]}" > receipts/tx-info.json

Run again at the end of the path:

jq '.[0] | {tx_hash, block_height, absolute_slot, inputs: [.inputs[] | {from: .payment_addr.bech32[0:16], ada: ((.value|tonumber)/1000000)}], outputs: [.outputs[] | {to: .payment_addr.bech32[0:16], ada: ((.value|tonumber)/1000000), tokens: [.asset_list[].asset_name[0:8]], has_data: (.inline_datum != null)}]}' receipts/tx-info.json

Result:

{
  "tx_hash": "5b4e0b56b222ab51b27f4ee98836bcf602954104ce0ef0e039fe10324110d704",
  "block_height": 6353,
  "absolute_slot": 6353,
  "inputs": [
    {
      "from": "addr_test1vqqqkv",
      "ada": 2000
    },
    {
      "from": "addr_test1wpnmk5",
      "ada": 3
    },
    {
      "from": "addr_test1wpye9y",
      "ada": 1.34472
    }
  ],
  "outputs": [
    {
      "to": "addr_test1wpye9y",
      "ada": 1.34472,
      "tokens": [
        "974b521f"
      ],
      "has_data": true
    },
    {
      "to": "addr_test1wpnmk5",
      "ada": 3,
      "tokens": [
        "dafb3d3d"
      ],
      "has_data": true
    },
    {
      "to": "addr_test1vqqqkv",
      "ada": 1998.804843,
      "tokens": [],
      "has_data": false
    }
  ]
}