Trustless Flow

You can run an AMA integration using purely the RPC and its quite reliable. You also need to download the latest binary release of the node and run it as OFFLINE=true ./amadeusd, it functions as a utility tool similar to geth.

Get the current chain height and hash from your integrations inception:

curl -s https://nodes.amadeus.bot/api/chain/stats \
| jq -r '.stats.tip.header_unpacked.height'

34959084

curl -s https://nodes.amadeus.bot/api/chain/stats \
| jq -r '.stats.tip.hash'

BENtrybSL5UGBnjJMm7sVZ9fr1CN7Qu9R3SdH88GxdEt

Next generate deposit wallets as required:

./amadeusd --bw-command start generate_wallet

5ibhX6qynQvFuBaQH1phfqCCY3VKMw4kLXkcSeBCNeAyCpyMVYzsEWx9FNBu6yz2XF
3CHRgeHNDzg3qjnFGdruvXqVb45TAWXzGZpnK2mKKHaByy7ZiQUMaDjLbQu1z4AnfsNtN2diM6Tc9PBVPgWZ7zgL

Check for finality and scan the block for deposits or withdrawls:

curl -s https://nodes.amadeus.bot/api/chain/hash/BENtrybSL5UGBnjJMm7sVZ9fr1CN7Qu9R3SdH88GxdEt?filter_on_function=transfer \
| jq -r '.entry.consensus.finality_reached'
true

curl -s https://nodes.amadeus.bot/api/chain/hash/BENtrybSL5UGBnjJMm7sVZ9fr1CN7Qu9R3SdH88GxdEt?filter_on_function=transfer \
| jq -r '.entry.txs_filtered'
[
  {
    "metadata": {
      "entry_hash": "BENtrybSL5UGBnjJMm7sVZ9fr1CN7Qu9R3SdH88GxdEt",
      "entry_slot": 34959084
    },
    "signature": "231XbxmVFKYNJsFb8X49wGAx1HVbW7FuiNFzVxuF1BCey5SpdsRzaSYRzTJEdJ22XF8g3NfzJgqnMrgypxZYbVV3hJWVTqRukY6C6cnPYNDbUTyu2gHVyQvNqRUkNfCmmi58",
    "hash": "6NxepwR3YTf3JbNoTtycZ73eLmY79CFzhueFJdYvDsoE",
    "tx": {
      "nonce": 1760628863344857048,
      "signer": "69TDon8KJp3vicNeFR3dg5x5sKY8PJFLmoizX3RN31YL4fwr266AVcXgwy1mjCLy6M",
      "actions": [
        {
          "args": [
            "5tUw2maGeGEvNyn6hkwssyNgiEd7K4Dp6jtkDFTSkbHZGiWR4Q12JMpbtC3n3r8cef",
            "64516000000000",
            "AMA"
          ],
          "function": "transfer",
          "op": "call",
          "contract": "Coin"
        }
      ]
    }
  }
]

Parse the single relevant transfer transaction now:

Check if there is another block after that has reached finality and repeat.

To process a withdrawl now create a serialized transaction substituting the SEED64= envvariable for your sender seed/privatekey as base58, then 69receiver as the receivers public key in base58, amount here cannot be float it must be the full integer accounting for 9 decimals.

Call a similar API build_and_broadcasttx to directly broadcast it to an RPC node:

You can now check the TX hash to confirm the RPC node relayed it to a validator and it got included in the chain

The only part missing is to prove the RPC is not lying in a trustless way. This is beyond the scope right now of this guide and protocol upgrades are underway as well. Of course the best way now is to run a personal node and you can follow the validator guide for that.

Last updated