TxRelay API

Secure, Non-Custodial Blockchain Transaction Service

Version 2.0 Ethereum Polygon Base Sepolia Amoy

Introduction

TxRelay API allows you to build and broadcast blockchain transactions without sharing your private keys. We handle the complexity of gas estimation, nonce management, and broadcasting.

Authentication: Add x-api-key: YOUR_KEY header to all requests.

Endpoints

POST /api/v1/transactions/prepare

Creates an unsigned transaction optimized for current network conditions.

Body:
{
  "from": "0xYourWallet...",
  "to": "0xRecipient...",
  "amount": "0.1",
  "chain": "sepolia"
}
POST /api/v1/transactions/broadcast

Submits a locally signed transaction to the network.

Body:
{
  "signedTx": "0xSignedHexData...",
  "chain": "sepolia"
}
GET /api/v1/transactions

Get your transaction history.

GET /api/v1/balance/:address

Get the native token balance of any address.

GET /api/v1/me

Check your current plan limits and usage.

Integration Example

// JavaScript Example
const response = await fetch('https://api.txrelay-api.com/api/v1/transactions/prepare', {
  method: 'POST',
  headers: { 
    'Content-Type': 'application/json',
    'x-api-key': 'cg_live_...' 
  },
  body: JSON.stringify({
    from: '0xYourWallet...',
    to: '0xRecipient...',
    amount: '0.1',
    chain: 'sepolia'  // or 'ethereum', 'polygon', 'base', 'amoy'
  })
});
const { unsignedTx } = response.data;
// Sign locally with your wallet, then broadcast...