@proximuslabs/sdk-bitcoin
v0.2.0-alpha.5
Published
Proximus bitcoin API integration SDK - alpha
Maintainers
Readme
Proximus Bitcoin SDK
Review Bitcoin PSBTs before your wallet signs them. Create an API key in your PROXIMUS dashboard, install the SDK and connect to the hosted API.
Install
Install the SDK in your application:
npm install @proximuslabs/[email protected]A direct public download is also available:
npm install https://www.proximus.sh/sdk/proximuslabs-sdk-bitcoin-0.2.0-alpha.5.tgzCreate an API key in your PROXIMUS dashboard and pass it to the client. The SDK connects to https://api.proximus.sh by default. Customers do not deploy the security engine.
Server quickstart
import { createBitcoinClient, requireAllow } from "@proximuslabs/sdk-bitcoin";
const client = createBitcoinClient({
apiKey: process.env.PROXIMUS_API_KEY,
baseUrl: process.env.PROXIMUS_BASE_URL,
});
const review = await client.reviewPayment({
requestId: "btc_order_123_review_1",
origin: "https://wallet.example",
network: "mainnet",
walletType: "taproot",
account: "your-public-account-reference",
psbt: process.env.UNSIGNED_PSBT_BASE64,
outputs: [{ address: process.env.RECIPIENT_ADDRESS, satoshis: "10000" }],
});
requireAllow(review); // Throws on challenge/block. Errors also pause execution.
console.log(review.verdict);Wallet families
| SDK value | Script family | Purpose |
| --- | --- | --- |
| legacy | P2PKH | 44 |
| nested-segwit | P2SH-P2WPKH | 49 |
| native-segwit | P2WPKH | 84 |
| taproot | P2TR | 86 |
derivationPath(type, network, account) returns the account path. The SDK does not derive private keys or create a wallet. Mainnet, testnet, signet and regtest are explicit metadata. These four single-key address families do not cover every wallet or multisig script.
Use bitcoinAction(input) to build a review envelope. In a frontend, reviewAndSignPsbt(input, reviewer, signPsbt) calls your existing wallet only after allow. The reviewer is your authenticated backend, not a browser client holding a Proximus key.
The local action builder checks encoding and envelope fields. The hosted engine parses PSBT v0 and v2 maps, binds standard output scripts to supplied addresses and checks supported sighash restrictions and v2 locktime constraints. Call client.capabilities() for current checks. UTXO ownership, change ownership, full fee analysis and hardware-wallet policy remain separate wallet checks. Keep the reviewed PSBT bytes unchanged through the execution claim and signing callback.
Standards: BIP 44, 49, 84, 86, 174.
Protect an action
Use protectAndExecute in JavaScript or TypeScript, protect_and_execute in Python or Rust, or ProtectAndExecute in Go to review an action before calling your signer or payment provider. The SDK proceeds only when the action is allowed, its required checks completed and its execution authorization is current. Blocked, incomplete and expired reviews stop execution.
Use the returned execution ID for your provider's idempotency key. Retrieve the provider result before retrying an uncertain payment.
See the integration guide for setup, examples and supported checks. Each review shows which checks completed and whether the action can proceed.
Shared configuration and errors
apiKey: scoped server-side API key.review:writefor review submission,security:executefor execution authorization,reviews:readfor retrieval and capabilities. monitoring additionally needsmonitor:writeand a linked integration.baseUrl: defaults tohttps://api.proximus.sh. Set your own HTTPS gateway URL for self-hosting. Loopback HTTP is allowed locally. A base path such ashttps://app.example/securityis supported when your proxy mounts the contract there. The SDK does not follow redirects or send browser cookies.fetch: optional compatible implementation for your runtime.timeoutMs: default 15000, maximum 120000. Pass{ signal }to each request.- Supply an immutable
requestId. Reuse it with the identical body for retries. The SDK never retries or charges automatically.requestId()generates a secure UUID wherecrypto.randomUUIDis available. ProximusErrorexposescode,statusandretryAfter; it never includes your secret key or raw error response. 401/403 require configuration fixes, 402 is a hosted credit limit, 409 is a conflict/in-progress request, 429 is a rate limit and 503 is unavailable analysis. First retrieve uncertain reviews before deciding to submit another ID.client.getReview(requestId)returns the backend's stored review record. Hosted and reference-gateway storage shapes may differ; use the submitted review response for immediate execution gating.reviewAndExecuteand wallet/payment guards require an exact, unexpired action binding and a fresh execution claim. On your backend, callclient.authorize(action)to produce this response. Use a durable execution ID and wallet or payment-provider idempotency. A claimed attempt must be reconciled before retrying.- No telemetry, private-key custody, background scanning or direct database access is performed by these SDKs.
Use client.capabilities() to read the current supported networks, checks and behavior-model availability. Solana protection includes external_state by default, so unavailable chain simulation pauses execution.
Platforms
The transport and action builders are TypeScript with ESM/CommonJS outputs. Payment fee calculations use decimal.js for decimal arithmetic. Node 22+ is the tested server target. Browser, React Native and Electron frontends use the action builders/guards with a reviewer calling their own authenticated backend; createClient rejects known browser/React Native environments to reduce accidental secret exposure. This runtime check is a guardrail, not a substitute for secure application architecture.
examples/browser-reviewer.ts, examples/BackendReviewer.swift and examples/BackendReviewer.kt demonstrate that backend boundary. Swift and Kotlin examples are not published native SDKs. React Native may need fetch, AbortController, TextEncoder and secure UUID polyfills; compatibility depends on runtime version. Do not put long-lived API keys in mobile or desktop binaries.
Your backend must authenticate the app user, verify their ownership/permissions, derive the exact action, validate origin/CSRF where applicable, enforce quotas and apply decisions. A client can bypass its own UI guard.
Language packages
All six SDK products are available in TypeScript, Go, Python and Rust under Apache 2.0. The TypeScript package stays at the repository root. Each language has typed feature inputs, guarded execution, exact amounts, hosted/self-hosted URLs, examples and loopback HTTP tests.
| Language | Package and setup | | --- | --- | | TypeScript | This directory - ESM, CommonJS and declarations | | Go | go/README.md - standard library, context cancellation | | Python | python/README.md - Python 3.10+, standard library, typed inputs | | Rust | rust/README.md - blocking reqwest, serde types |
Public release packages are available through the installation guide. Python uses the equivalent version 0.2.0a5. The guide selects a verified registry release or a direct PROXIMUS package URL for each language.
Platform APIs
Use the platform SDK for chat, agents, testing and workspace APIs. This specialized package retains its review contract and execution guards. See the API reference for current public operations and required scopes.
Contributing
Bug reports, examples and pull requests are welcome. Read CONTRIBUTING.md to get started and SECURITY.md to report a vulnerability.
License
Copyright 2026 PROXIMUS Research Labs Foundation. The SDK is licensed under Apache 2.0, which permits integration, modification and commercial use subject to its terms. The license grants permission to use the code, it does not transfer copyright or grant rights to PROXIMUS trademarks. Hosted services have separate access and pricing terms. See LICENSE and NOTICE.
Payment fee estimates
Use estimatePaymentFees to calculate the PROXIMUS curve, partner fees and a network-cost reserve in exact atomic units. prepareAndExecutePayment calls your existing provider to prepare the complete unsigned payment, reviews that final action and invokes execution once after authorization. Include every fee recipient and amount before review.
The same workflow is available as estimate_payment_fees and prepare_and_execute_payment in Python and Rust, and EstimatePaymentFees and PrepareAndExecutePayment in Go. Amounts use integer strings. The estimate does not sign a transaction or collect a payment.
See payment integration for arguments, return values, examples and supported execution responsibilities.
