XRPL TESTNET · en
Audit One XRPL Testnet Payment with AgentTrail
Record a payment intent, link an externally signed XRPL Testnet transaction, and independently verify the audit report.
Published · Updated
A transaction hash tells you which payment to inspect. An audit also needs the expectation: what was the agent supposed to pay, and to whom?
This walkthrough records an expectation for 1 XRP on XRPL Testnet, links a payment you sign externally, and retrieves the audit report. AgentTrail is a free Testnet beta. It does not hold your funds, execute your payments, or need your wallet seed or private key. This walkthrough does not demonstrate Mainnet use.
The flow at a glance
Record the expected payment.
Sign the payment in your Testnet wallet.
Submit the transaction hash to AgentTrail.
Compare the payment with the expectation.
Wait for the report proof to be anchored.
Verify the report against the XRPL anchor.
The wallet step is separate from the audit. A retry at C does not repeat B.
Before you start
You need curl, Python 3, a Testnet wallet with test XRP, and a recipient you control or have permission to pay on Testnet. The commands below use Bash. Keep the same terminal open throughout the exercise.
Open the developer console, create a developer account if needed, and securely retain its one-time credential. Create a dedicated API key with audit:read and audit:write scopes for this exercise. New account/key issuance is not a replay endpoint: do not repeatedly create keys to retry an audit request. The beta cannot recover a lost one-time key.
Never paste a wallet secret into AgentTrail. Enter only the scoped audit API key in this terminal prompt. Do not use shell tracing or share terminal recordings.
umask 077
mkdir -p .agenttrail-demo
export AUDIT_API_URL='https://agenttrail.online/api'
read -r -s -p 'Scoped audit API key: ' AUDIT_KEY
printf '\n'
export AUDIT_KEY
export RECIPIENT='REPLACE_WITH_YOUR_TESTNET_RECIPIENT_CLASSIC_ADDRESS'
export FLOW_REF="$(python3 -c 'import uuid; print(uuid.uuid4())')"1. Save the expected payment before making it
Replace RECIPIENT above before running this step. A new exercise gets a new flow reference. For a retry of this exercise, retain the existing reference and payload.
python3 - <<'PY' > .agenttrail-demo/intent.json
import json, os
print(json.dumps({
'agent_id': 'tutorial-agent',
'task_id': os.environ['FLOW_REF'],
'network': 'xrpl-testnet',
'asset': {'type': 'native', 'currency': 'XRP'},
'expected_amount': '1',
'recipient': os.environ['RECIPIENT'],
'purpose': 'developer_test_payment'
}))
PY
curl --fail-with-body --silent --show-error \
-X POST "$AUDIT_API_URL/v1/audit/intents" \
-H "Authorization: Bearer $AUDIT_KEY" \
-H 'Content-Type: application/json' \
-H "Idempotency-Key: $FLOW_REF-intent" \
--data-binary @.agenttrail-demo/intent.json \
-o .agenttrail-demo/intent-response.json
export AUDIT_ID="$(python3 -c 'import json; print(json.load(open(".agenttrail-demo/intent-response.json"))["audit_id"])')"
printf 'Audit ID: %s\n' "$AUDIT_ID"Amounts are decimal strings. Optionally include payer_address in the intent if you also want sender matching. Without it, this walkthrough does not check the payer against an expected sender. The task ID and purpose remain your declarations; they do not establish authorization or task delivery.
2. Sign the Testnet payment externally
In your own wallet or payment integration, verify that you are on XRPL Testnet, then send exactly 1 XRP to the same recipient. This is the one step these API commands do not perform. Follow your wallet's Testnet instructions; do not substitute Mainnet funds if your wallet cannot use Testnet.
Copy the transaction's 64-character hash, then submit it to the audit API:
read -r -p 'Testnet payment hash: ' PAYMENT_HASH
export PAYMENT_HASH
python3 - <<'PY' > .agenttrail-demo/transaction.json
import json, os
print(json.dumps({
'audit_id': os.environ['AUDIT_ID'],
'network': 'xrpl-testnet',
'tx_hash': os.environ['PAYMENT_HASH']
}))
PY
curl --fail-with-body --silent --show-error \
-X POST "$AUDIT_API_URL/v1/audit/transactions" \
-H "Authorization: Bearer $AUDIT_KEY" \
-H 'Content-Type: application/json' \
-H "Idempotency-Key: $FLOW_REF-payment" \
--data-binary @.agenttrail-demo/transaction.jsonA 202 response means the audit verification is pending, not that the payment has matched. After a transport error, retry the audit request with the same key and body. Reusing a key with a changed body returns a conflict. Retrying an audit request and executing another wallet payment are separate actions.
3. Read both payment and anchor status
curl --fail-with-body --silent --show-error \
-H "Authorization: Bearer $AUDIT_KEY" \
"$AUDIT_API_URL/v1/audit/records/$AUDIT_ID" \
-o .agenttrail-demo/record.json
python3 - <<'PY'
import json
record = json.load(open('.agenttrail-demo/record.json'))
print('Payment:', record['payment_status'])
print('Anchor:', record['anchor_status'])
print('Checks:', record['checks'])
PYRepeat this read after a short wait if processing is pending. Do not create a new intent or send a new payment merely because a worker has not finished.
validated_match means the checked payment facts matched the declaration. Inspect the checks for a mismatch. Unsupported or inconclusive results are not a clean pass. Anchoring is a separate process: only anchor_validated establishes completed anchoring. A pending anchor does not mean the payment failed, and the beta does not guarantee an anchor deadline.
Example: payment matches while the proof is queued
This is an illustrative response excerpt, not a real payment or a report to upload:
{
"payment_status": "validated_match",
"anchor_status": "anchor_queued"
}The payment comparison is complete; the proof is still queued. Keep checking the same audit ID. Once the anchor reaches anchor_validated, download the latest report and verify it independently. If the payment instead says validated_mismatch, read the recorded checks to see which facts disagreed with the original expectation. Anchoring a mismatch report does not turn it into a match.
4. Download and independently verify
If the API says the record or report is not ready, return to the status check. Do not interpret that response as a wallet-payment failure.
curl --fail-with-body --silent --show-error \
-H "Authorization: Bearer $AUDIT_KEY" \
"$AUDIT_API_URL/v1/audit/records/$AUDIT_ID/report" \
-o .agenttrail-demo/audit.jsonOpen Verify a proof and select audit.json. The browser reads the report locally, recomputes its record hash, checks its Merkle inclusion proof, and queries a public XRPL node for the anchor. That ledger query requires network access. A report with an unfinished anchor is not yet independently verifiable; a node outage is not proof that the report was tampered with.
Keep the downloaded report private unless you intend to share its contents. Public proof data and the fuller holder's report are different things.
What this establishes
This flow connects a declared payment expectation to checked ledger facts and, when the proof is ready, lets you verify anchored record integrity independently. It does not prove that an agent was authorized, that a service was delivered, that every payment was captured, or that the report carries compliance certification.
When finished, revoke the exercise key in the console and clear the terminal variables:
unset AUDIT_KEY AUDIT_ID PAYMENT_HASH RECIPIENT FLOW_REFFor the shorter API overview, see Quickstart.