Skip to content
Docs

Transactions

Prepare a transfer

POST /v1/transactions/prepare returns an unsigned transaction for the device to sign.

Endpoint

POST/v1/transactions/prepare

Body describes intent: transfer (default), token_transfer, nft_transfer, contract_call, or from_request—see Token, NFT, and contract intents.

Request
curl -sS -X POST "https://blockchain.gray3.io/v1/transactions/prepare" \
  -H "X-Gray-Project-Id: proj_your_project_id" \
  -H "Authorization: Bearer gray_sk_your_secret" \
  -H "Content-Type: application/json" \
  -d '{
  "kind": "transfer",
  "chainId": "ethereum-sepolia",
  "from": "0xYourAddress",
  "to": "0xRecipient",
  "value": "1000000000000000000"
}'

Response

HTTP 200 — success envelope wraps the payload in data.

json
{
  "data": {
    "chainId": "ethereum-sepolia",
    "from": "0xYourAddress",
    "to": "0xRecipient",
    "value": "1000000000000000000",
    "kind": "transfer",
    "unsignedPayload": {
      "type": "evm",
      "chainId": 11155111,
      "to": "0xRecipient",
      "value": "0xde0b6b3a7640000",
      "gas": "0x5208",
      "nonce": "0x1"
    }
  }
}

Errors

Errors use HTTP { "error": { "code", "message", "retryable" } }. Branch on code, not the message text.

Every authenticated route may also return unauthorized (401), revoked_secret (401), forbidden (403), credits_exhausted (402), plan_feature_denied (403), rate_limit_exceeded (429, retryable), and invalid_argument (413) for request bodies over 256 KiB.

CodeHTTPWhen
invalid_argument400Missing or malformed chainId, address, or body fields
plan_chain_denied403chainId is not on the project plan
chain_disabled403Chain turned off in Console › Networks
unsupported_capability400Capability not offered for this chain (e.g. testnet prices)
invalid_argument400Bad intent kind, missing from/to, or malformed signedPayload
unsupported_capability400The chain does not support this operation, such as a gas estimate on a non-EVM chain
simulation_failed400Simulate reported failure (may also return ok: false in data)
tx_unavailable503Preparation, broadcast, or receipt lookup is temporarily unavailable (retryable)
provider_error400Custom-chain RPC returned JSON-RPC error
json
{
  "error": {
    "code": "invalid_argument",
    "message": "Human-readable detail (may be sanitized).",
    "retryable": false
  }
}