RathRath Finance

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:

  1. Apply for the API KEY
  2. Sign up or log in to your Tachyon account

Installation

Install the Tachyon SDK using your preferred package manager:

npm install @rathfi/tachyon ethers
yarn add @rathfi/tachyon ethers
pnpm add @rathfi/tachyon ethers

Requirements: 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

ParameterTypeRequiredDescriptionExample
chainIdnumberYesTarget blockchain network8453 (Base)
tostringYesContract/recipient address"0xA7A8..."
valuestringYesAmount in wei"0"
callDatastringYesEncoded function call"0x..."
labelstringNoCustom label for tracking"My Transfer"
gasLimitstringNoGas limit override"100000"

Transaction Lifecycle

  1. Submit → Returns a unique txId
  2. Queue → Transaction enters relay queue (NOT_PICKED_UP)
  3. Process → Relay node broadcasts to blockchain
  4. Execute → Transaction confirmed on-chain with execution hash

On this page