SDKs overview

Every Blockchain0x SDK wraps the same HTTP API behind the same resource surface,
so the concepts you learn in one language carry to the others. The Node SDK is
the reference implementation; the rest mirror it with idiomatic naming.

Pick your language

LanguagePackageInstallRegistry
Node / TS@blockchain0x/nodenpm i @blockchain0x/nodenpm
Pythonblockchain0xpip install blockchain0xPyPI
Gogithub.com/Tosh-Labs/blockchain0x-gogo get github.com/Tosh-Labs/blockchain0x-goGo proxy (git tags)
Rubyblockchain0xgem install blockchain0xRubyGems

For HTTP-402 pay-per-call, the x402 family (@blockchain0x/x402 and its
Python/Go/Ruby siblings) adds the pay-side client and receive-side server
adapters. See the x402 reference.

The resource surface

Every SDK exposes the same resources, plus a standalone webhook-signature helper:

ResourceWhat it manages
agentsAgent wallets - create, read, list.
apiKeysAPI keys - create, list, rotate, revoke.
paymentsOutbound payments.
paymentRequestsInvoices - create and settle with on-chain proof.
transactionsOn-chain transaction history and lookups.
webhooksWebhook endpoint management + webhooks.verify().

Configure the client

You construct a client with your API key; everything else has a sensible default:

const client = createClient({ apiKey: process.env.B0X_API_KEY! }); // sk_test_* -> testnet

The constructor options:

OptionDefaultPurpose
apiKeyrequiredBearer credential; prefix selects test/live.
baseUrlhttps://api.blockchain0x.comOverride for self-hosted or staging targets.
network(from key)testnet or mainnet; sets the X-Network header.
timeoutMs30000Per-attempt request timeout.

Retries and idempotency

The SDK retries transient failures automatically: on 429 and 5xx it retries
up to 3 times with exponential backoff (roughly 250ms, 500ms, 1000ms), and it
honours a Retry-After header when the server sends one. Pass retry: 'off' on a
call to disable it.

Because a retry can re-send a write, send an Idempotency-Key on
state-changing calls (payments, settlements). The server dedupes a given key for
24 hours, so a retried payment is never double-spent. See
Send payments and idempotency.

Error model

A non-2xx response throws a typed error you can branch on:

ErrorWhen
Blockchain0xErrorAny API error. Carries code, status, message, requestId, details.
ApiKeyErrorSubclass for the apikey.* failure codes (scope, assignment, revocation).
WebhookSignatureErrorRaised by webhooks.verify() when a signature fails to validate.

Branch on error.code for exhaustive handling, and log error.requestId when you
contact support. The full catalogue lives in
Errors and rate limits.

Per-language reference

  • Node - @blockchain0x/node
  • Python - blockchain0x
  • Go - blockchain0x-go
  • Ruby - blockchain0x
  • x402 - the HTTP-402 protocol family