Skip to Content
TachyonQuickstart

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

Requirements: Node.js 16+, TypeScript 4.5+

Complete Example

example.ts
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);

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
Last updated on