Secure, Non-Custodial Blockchain Transaction Service
TxRelay API allows you to build and broadcast blockchain transactions without sharing your private keys. We handle:
How it works:
/prepare → We return an unsigned transaction./broadcast → We send it to the blockchain.The easiest way to use TxRelay. Full TypeScript support with autocomplete.
npm install txrelay-sdk
import { TxRelay } from 'txrelay-sdk';
const client = new TxRelay('YOUR_API_KEY');
// Prepare a transaction
const { unsignedTx } = await client.prepareTransaction({
from: '0xYourWallet...',
to: '0xRecipient...',
amount: '0.1',
chain: 'ethereum'
});
// Sign locally with ethers.js
const signedTx = await wallet.signTransaction(unsignedTx);
// Broadcast
const { txHash } = await client.broadcastTransaction({
signedTx,
chain: 'ethereum'
});
// Check balance
const { balance } = await client.getBalance('0x...', 'ethereum');
// Account info
const account = await client.getAccount();
All API requests require an API key in the header:
x-api-key: YOUR_API_KEY
Get your API key from the Dashboard.
| Chain | ID | Currency | Type |
|---|---|---|---|
ethereum | 1 | ETH | Mainnet |
polygon | 137 | POL | Mainnet |
base | 8453 | ETH | Mainnet |
sepolia | 11155111 | ETH | Testnet |
amoy | 80002 | POL | Testnet |
Base URL: https://api.txrelay-api.com/api/v1
Prepares an unsigned native currency transaction.
// Request
{
"from": "0xYourWallet...",
"to": "0xRecipient...",
"amount": "0.1",
"chain": "ethereum"
}
// Response
{
"unsignedTx": { ... },
"metadata": {
"estimatedFee": "0.0001",
"totalCost": "0.1001"
}
}
Prepares an unsigned ERC-20 token transaction.
// Request
{
"from": "0xYourWallet...",
"to": "0xRecipient...",
"amount": "100",
"tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chain": "ethereum"
}
Broadcasts a signed transaction to the network.
// Request
{
"signedTx": "0x02f8...",
"chain": "ethereum"
}
// Response
{
"txHash": "0x...",
"status": "queued"
}
Lists your transaction history.
Query params: ?limit=50&offset=0&status=confirmed&chain=ethereum
Gets native currency balance. Query: ?chain=ethereum
Gets your API key info and usage statistics.
Receive real-time notifications when transactions are confirmed.
Creates a webhook subscription. Returns a secret - save it!
Lists all your active webhooks.
Deletes a webhook.
{
"id": "evt_...",
"event": "transaction.confirmed",
"created_at": 1702000000,
"data": {
"txHash": "0x...",
"status": "confirmed",
"blockNumber": 12345678
}
}
We sign every webhook with your secret. Header: X-TxRelay-Signature
// Node.js
const crypto = require('crypto');
const [tPart, sigPart] = signature.split(',');
const timestamp = tPart.split('=')[1];
const sig = sigPart.split('=')[1];
const expected = crypto
.createHmac('sha256', YOUR_WEBHOOK_SECRET)
.update(`${timestamp}.${JSON.stringify(body)}`)
.digest('hex');
if (sig === expected) { /* Verified */ }
| Code | Error | Description |
|---|---|---|
| 400 | ValidationError | Invalid request parameters |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | API key deactivated or IP blocked |
| 404 | NotFound | Resource not found |
| 409 | DuplicateTransaction | Transaction already exists |
| 429 | RateLimitExceeded | Too many requests (see headers) |
| 429 | MonthlyLimitExceeded | Monthly quota reached |
| 500 | ServerError | Internal error (contact support) |
All errors return:
{
"success": false,
"error": "ValidationError",
"message": "Invalid wallet address"
}
| Plan | Burst (per min) | Monthly | Price | Support |
|---|---|---|---|---|
| Free | 30 | 100 | €0 | |
| Pro | 120 | 10,000 | €29/mo | |
| Enterprise | 600 | 1,000,000+ | €199/mo |
Rate limit headers are included in every response:
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 25
X-RateLimit-Reset: 2025-12-08T01:00:00Z
X-Monthly-Limit: 100
X-Monthly-Used: 42