Quickstart Guide
Get started with the Tachyon SDK and API to relay transactions across multiple blockchain networks.
Quickstart Guide
The Tachyon SDK is a TypeScript/JavaScript library that provides a simple interface to interact with the Tachyon API. It allows you to relay transactions, check their status, and manage account information across multiple blockchain networks.
Getting Your API Key
To use Tachyon, you'll need an API key:
- Apply for the API KEY
- Sign up or log in to your Tachyon account
Installation
Install the Tachyon SDK using your preferred package manager:
npm install @rathfi/tachyon ethersyarn add @rathfi/tachyon etherspnpm add @rathfi/tachyon ethersRequirements: Node.js 16+, TypeScript 4.5+
No installation required. Use cURL or any HTTP client to interact with the Tachyon API directly.
Complete Example
import { Tachyon, ChainId } from '@rathfi/tachyon';
import { ethers } from 'ethers';
async function relayTransaction() {
// Initialize SDK
const tachyon = new Tachyon({
apiKey: process.env.TACHYON_API_KEY!
});
// Encode contract call
const abi = ["function transfer(address to, uint256 amount)"];
const iface = new ethers.Interface(abi);
const callData = iface.encodeFunctionData("transfer", [
"0x742d35cc6634C0532925a3b8D1C9b53e6aC3",
ethers.parseUnits("10", 18) // 10 tokens with 18 decimals
]);
// Submit transaction
const txId = await tachyon.relay({
chainId: ChainId.BASE, // or use 8453
to: "0xA7A833e6641D7901F30EaD6f27d4Ee2C9bb670a7",
value: "0",
callData,
label: "Token Transfer"
});
console.log('Transaction ID:', txId);
// Check status
const status = await tachyon.getRelayStatus(txId);
console.log('Status:', status.status);
// Wait for execution
const result = await tachyon.waitForExecutionHash(txId);
console.log('Executed:', result.executionTxHash);
}
relayTransaction().catch(console.error);Submit a Transaction
curl -X POST https://tachyon.rath.fi/api/submit-tx \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{
"chainId": 8453,
"to": "0xA7A833e6641D7901F30EaD6f27d4Ee2C9bb670a7",
"value": "0",
"callData": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d1c9b53e6ac30000000000000000000000000000000000000000000000008ac7230489e80000",
"label": "Token Transfer"
}'Track the Transaction
curl "https://tachyon.rath.fi/api/tx?id=YOUR_TX_ID" \
-H "api-key: YOUR_API_KEY"Key Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
chainId | number | Yes | Target blockchain network | 8453 (Base) |
to | string | Yes | Contract/recipient address | "0xA7A8..." |
value | string | Yes | Amount in wei | "0" |
callData | string | Yes | Encoded function call | "0x..." |
label | string | No | Custom label for tracking | "My Transfer" |
gasLimit | string | No | Gas limit override | "100000" |
Transaction Lifecycle
- Submit → Returns a unique
txId - Queue → Transaction enters relay queue (
NOT_PICKED_UP) - Process → Relay node broadcasts to blockchain
- Execute → Transaction confirmed on-chain with execution hash