How-To GuidesRelay Transactions
EVM
Submit and track a relay transaction on EVM-compatible chains.
The Ethereum Virtual Machine (EVM) is the shared execution environment used by networks such as Ethereum, Base, Arbitrum, Optimism, and Polygon. EVM transactions can transfer native tokens or call Solidity smart contracts using ABI-encoded calldata.
Follow these steps to submit and track a simple transaction on an EVM-compatible chain.
Import the SDK
import { Tachyon, ChainId } from '@rathfi/tachyon'Initialize the Tachyon Client
const tachyon = new Tachyon({
apiKey: 'API-KEY',
})Submit a Transaction
const txId = await tachyon.relay({
chainId: ChainId.BASE, // 8453
to: '0x3dbE34f2C21b3B2980d4dc53f3c7E51e39663F49',
value: '1', // 1 wei
callData: '0x',
label: 'My Base Transaction',
})
console.log('Transaction submitted with ID:', txId)Check Transaction Status
const status = await tachyon.getRelayStatus(txId)
console.log('Transaction status:', status.status)Wait for Execution
const executedTx = await tachyon.waitForExecutionHash(txId)
console.log('Execution hash:', executedTx.executionTxHash)Call a Smart Contract
Encode the contract function and arguments into callData, set to to the contract address, and relay the transaction through the same flow.
import { Tachyon, ChainId } from '@rathfi/tachyon'
import { ethers } from 'ethers'
const tachyon = new Tachyon({ apiKey: 'YOUR_API_KEY' })
const iface = new ethers.Interface(['function sayHello(string message)'])
const callData = iface.encodeFunctionData('sayHello', ['Hello from Tachyon!'])
const txId = await tachyon.relay({
chainId: ChainId.BASE,
to: '0xA7A833e6641D7901F30EaD6f27d4Ee2C9bb670a7',
value: '0',
callData,
label: 'Say Hello Example',
})curl -X POST https://tachyon.rath.fi/api/submit-tx \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chainId": 8453,
"to": "0xA7A833e6641D7901F30EaD6f27d4Ee2C9bb670a7",
"value": "0",
"callData": "0xc3a9b1c50000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001348656c6c6f2066726f6d2054616368796f6e2100000000000000000000000000",
"label": "Hello From Tachyon Call"
}'