Pular para o conteúdo

Process cold vault operations with the API

Use this page for programmatic cold vault operations. For the conceptual model, see Cold vaults.

Cold vault workflows involve two systems:

  • The online Ripple Custody (Vault) API, which requires JWT authentication.
  • The cold bridge API, which runs on the air-gapped workstation and provides local endpoints for upload, status, download, and payload inspection.

API endpoints

OperationSystemEndpoint
Export pending operationsOnline APIExport prepared operations
Import signed operationsOnline APIImport signed operations
Get vault detailsOnline APIGet vault details
Upload operationsCold bridgePOST {ColdBridgeURL}/v1/feed/upload
Check signing statusCold bridgeGET {ColdBridgeURL}/v1/feed/status
Download signed operationsCold bridgeGET {ColdBridgeURL}/v1/feed/download
Decode payloadCold bridgePOST {ColdBridgeURL}/v1/feed/decode

Complete the first-time vault handshake

When you register a new cold vault, it can be created in a Pending state because the cold vault cannot automatically connect to the online deployment. Complete the handshake by downloading the vault payload from the cold bridge and importing it into Ripple Custody (Vault).

  1. On the air-gapped workstation, download the vault payload from the cold bridge:

    curl -X GET "{ColdBridgeURL}/v1/feed/download?clean=false" \
      --output cold-vault-handshake.dat

    Use clean=false until the payload is successfully imported. After confirming successful import, you can use clean=true to clear the cold bridge cache.

  2. Transfer cold-vault-handshake.dat to the online environment using your approved transfer process.

  3. Import the payload into Ripple Custody (Vault) with Import signed operations:

    curl -X POST "${CUSTODY_API_URL}/v1/vaults/operations/signed" \
      -H "Authorization: Bearer ${JWT_TOKEN}" \
      -F "files=@cold-vault-handshake.dat"
  4. Verify that the vault status is Completed:

    curl -X GET "${CUSTODY_API_URL}/v1/vaults/${VAULT_ID}" \
      -H "Authorization: Bearer ${JWT_TOKEN}"

After the vault status is Completed, you can use the vault for account creation, transactions, and manifests.

Process accounts, transactions, or manifests

Any accounts, transactions, or manifests created for a cold vault remain Pending until the cold vault signs the prepared operations. You can batch multiple pending operations into the same export.

Step 1: Export pending operations

Call Export prepared operations:

curl -X GET "${CUSTODY_API_URL}/v1/vaults/${VAULT_ID}/operations/prepared" \
  -H "Authorization: Bearer ${JWT_TOKEN}" \
  --output cold-vault-operations.dat

Transfer cold-vault-operations.dat to the air-gapped workstation using your approved transfer process.

Step 2: Decode and verify the payload

The cold bridge doesn't require this step, but it's the only point where you can see what the cold vault signs. Decode and review every payload before you upload it.

To decode the exported file, call the cold bridge decode endpoint:

curl -X POST "{ColdBridgeURL}/v1/feed/decode" \
  -F "files=@cold-vault-operations.dat"

The endpoint returns a JSON array with one element for each uploaded file. Each element is an array of the operations in that file, in this order: accounts, transactions, manifests, and rewraps. When you decode a signed file returned by the cold vault, the first entry is the vault registration.

Each entry is the vault's protobuf message for that operation, converted to JSON field by field. The endpoint doesn't format values according to what they represent, and has no option to return decimal or hexadecimal values. To read the output:

  • Field names are in snake_case, such as seq_num, not the camelCase names used in the protobuf definitions.
  • A field that holds one of several options (a protobuf oneof) is nested twice: under the field name, then under the name of the option that is set. For example, a transaction destination appears under data, with one key that holds either an external address string or an internal account object.
  • Enumerations, such as the ledger or signing algorithm, are numbers, not names.
  • An unset field is null.

Read each value according to its protobuf type:

Protobuf typeJSON formHow to read it
Value{"value": [1, 134, 160]}An unsigned big-endian integer stored as bytes. null and {"value": []} both mean zero. What the integer represents depends on the ledger and the field. See Amounts.
Bytes, and binary fields such as hashes, public keys, and signaturesArray of byte values, wrapped as {"value": [...]} for BytesRaw bytes. Convert to hexadecimal to compare with other tools.
U32, U64, and other integer fieldsNumber, wrapped as {"value": 5} for U32 and U64Use as is.
Floating-point fieldsDecimal numberUse as is.
Text fieldsStringUse as is.

Amounts

Most amounts and fees are Value integers in the smallest unit of the asset. This applies to the transaction amount and fee fields, native XRP amounts (in drops), and Solana, Substrate, Cardano, and Tezos amounts.

The following amounts use a different encoding:

  • XRPL issued tokens: the amount is a Value, but it's a fixed-point decimal with 81 decimal places, not an integer in the smallest unit. Divide it by 1081. For example, 1 USD is encoded as 1081.
  • XRPL Multi-Purpose Tokens (MPTs): the amount is a U64, so it's a number, not a byte array.
  • Canton: the transfer amount is a decimal string in whole units, for example "42.0".
  • Bitcoin fee settings: the fee rate is a decimal number in satoshis per virtual byte. The change amount and dust limit are numbers in satoshis.
  • Other ledger-specific settings, such as gas prices and budgets, fee limits, nonces, and chain IDs, are numbers.

For example, to convert values in Python:

from decimal import Decimal

def to_int(v):
    return int.from_bytes(bytes(v["value"]), "big") if v else 0

to_int({"value": [1, 134, 160]})              # amount in smallest unit: 100000
Decimal(to_int(token_amount)).scaleb(-81)      # XRPL issued token amount
bytes([222, 173, 190, 239]).hex()              # binary data: 'deadbeef'

The output contains 64-bit integers at full precision. Python's json module reads them exactly, but JavaScript and older versions of jq round integers larger than 253. Take this into account if you process the file with other tools.

For transactions, verify the destination address, amount, network, and fees before allowing the cold vault to sign.

Verify before signing

Cold vault signing is a high-control operation. Decode and review the payload before signing, especially for transactions. Once a signed transaction is broadcast to the blockchain network, it cannot be recalled by Ripple Custody (Vault).

Step 3: Upload operations to the cold bridge

Upload the exported file to the cold bridge:

curl -X POST "{ColdBridgeURL}/v1/feed/upload" \
  -F "files=@cold-vault-operations.dat"

After upload, the vault processes the data from the cold bridge and signs the pending operations.

Step 4: Check signing status

Call the cold bridge status endpoint:

curl -X GET "{ColdBridgeURL}/v1/feed/status"

The response includes counters for unsigned and signed operations:

{
  "accountToSign": 0,
  "accountSigned": 0,
  "transactionToSign": 0,
  "transactionSigned": 0,
  "manifestToSign": 0,
  "manifestSigned": 0
}

When the ToSign counters are zero, all pending operations in the uploaded payload have been signed.

Step 5: Download signed operations

Download the signed payload from the cold bridge:

curl -X GET "{ColdBridgeURL}/v1/feed/download?clean=false" \
  --output signed-cold-vault-operations.dat

Transfer signed-cold-vault-operations.dat back to the online environment.

Step 6: Import signed operations

Import the signed payload into Ripple Custody (Vault) with Import signed operations:

curl -X POST "${CUSTODY_API_URL}/v1/vaults/operations/signed" \
  -H "Authorization: Bearer ${JWT_TOKEN}" \
  -F "files=@signed-cold-vault-operations.dat"

After import, Ripple Custody (Vault) continues processing the account, transaction, or manifest.