Notarisation

Deposit some money via the bridge contract:

./octez-client transfer 1 from $ADMIN to $BRIDGE --entrypoint "deposit"

Check your balance on Pandora:

./scripts/converter --hex-to-dec $(curl -s http://localhost:8932/global/block/head/durable/wasm_2_0_0/value\?key\=/pandora/state/accounts/2Nfp2p7gGPBfDaNA9jKUscWQ9dox/balance | jq)

1000000 µꜩ = 1 ꜩ

NB: 2Nfp2p7gGPBfDaNA9jKUscWQ9dox is obtained by re-encoding in base58 the bytes of tz1UdMeeXHKq6cQxkse9RJ1Yi8CXuD2gXQRu (=$ADMIN ) after removing the prefix and the checksum. You can use the CLI to obtain that value.

./pandora-cli --compress-pkh $ADMIN

Use the CLI to create an external message to send:

./pandora-cli --hash 00000000000000000000000000000000 --pandora-address $PANDORA --keys-alias <user-alias>
004042c5b539b3111294f555735d3a0b1617746c22006564706b7551636d4b76425243754355567050656d3553396b52584734744c4b39505747677647383268767339536659325452785a5a30303030303030303030303030303030303030303030303030303030303030307369676256344755434d443746316b354572776f69694156444437364a65336950475345516e53453647476342466d6935543451685859585032637268517650657674446f484c4276694d63686961665a586f3945537a3464684b6e52657669

Send an external message to notarise a simple hash:

./octez-client send smart rollup message "hex:[ \"004042c5b539b3111294f555735d3a0b1617746c22006564706b7551636d4b76425243754355567050656d3553396b52584734744c4b39505747677647383268767339536659325452785a5a30303030303030303030303030303030303030303030303030303030303030307369676256344755434d443746316b354572776f69694156444437364a65336950475345516e53453647476342466d6935543451685859585032637268517650657674446f484c4276694d63686961665a586f3945537a3464684b6e52657669\"]" from $ADMIN --fee-cap X.YZ

Get your hash in base58 by doing:

./pandora-cli --to-b58 00000000000000000000000000000000
4F7BsTMVPKFshM1MwLf6y23cid6fL3xMpazVoF9krzUw

Check your hash's timestamp:

curl -s http://localhost:8932/global/block/head/durable/wasm_2_0_0/value\?key\=/pandora/state/hashes/4F7BsTMVPKFshM1MwLf6y23cid6fL3xMpazVoF9krzUw/timestamp | jq

Check your balance on Pandora once again:

./scripts/converter --hex-to-dec $(curl -s http://localhost:8932/global/block/head/durable/wasm_2_0_0/value\?key\=/pandora/state/accounts/2Nfp2p7gGPBfDaNA9jKUscWQ9dox/balance | jq)

997500 µꜩ = 0.9975 ꜩ

Withdraw half of your balance from Pandora by calling the bridge contract (a message will be pending in the rollup's outbox):

NB: amount should be specified in mutez (µꜩ).

./octez-client transfer 0 from $ADMIN to $BRIDGE --entrypoint "withdrawal_request" --arg 500000

Get your balance on L1 before/after the execution of the withdrawal message from the outbox:

./octez-client get balance for $ADMIN 

0.344846 ꜩ

Check that your message is contained within the level where the withdrawal was executed:

 curl -s http://localhost:8932/global/block/head/outbox\?outbox_level\=<level> | jq

Wait for a commitment that contain your withdrawal to be cemented (the duration may vary depending on the network's constant):

# Specify the L1 <level>
curl -s http://localhost:8932/global/block/cemented/outbox/<level>/messages | jq

# For level = 67 for instance you will get something like:
[
  {
    "outbox_level": 67,
    "message_index": "0",
    "message": {
      "transactions": [
        {
          "parameters": {
            "prim": "Pair",
            "args": [
              {
                "int": "500000"
              },
              {
                "bytes": "000062988a79f6f30c7e943033e147fb529b58a88343"
              }
            ]
          },
          "destination": "KT1XpYVREyu1mhP8pkRqPpWbqMdfm62aLPFm",
          "entrypoint": "withdrawal"
        }
      ],
      "kind": "untyped"
    }
  }
]

Recover the message_index from the previous RPC and generate the outbox message's proof:

# Generate/precompute proof of inclusion in the outbox
# Specify the L1 <level> and <index> of the message to execute
curl -s http://localhost:8932/global/block/head/helpers/proofs/outbox/<level>/messages\?index\=<index> | jq -r "\"0x\" + .proof" > outbox.proof

Recover the LCC by doing this RPC from your L1 node:

curl -s http://localhost:8732/chains/main/blocks/head/context/smart_rollups/smart_rollup/sr1Bu89iV5Pki7TBSjMeZMEigNfebwQBUTSZ/last_cemented_commitment_hash_with_level

Execute the outbox message:

# Execute
# Specify last cemented commitment <LCC>
./octez-client execute outbox message of smart rollup $PANDORA from $ADMIN for commitment hash <LCC> and output proof $(cat outbox.proof) --burn-cap 1

Check that your balance is retrieved on L1:

./octez-client get balance for $ADMIN 

0.844846 ꜩ