Skip to Content
TachyonHow-To GuidesRelay Transactions

Relay Transactions

The Tachyon SDK provides a complete workflow for submitting transactions to the relay network, monitoring their status, and waiting for on-chain execution. This guide covers the three main methods you’ll use: submitting transactions, checking their status, and waiting for confirmation.


Quick Start

EVM Chains (Ethereum, Base, Polygon, etc.)

Follow these steps to submit and track a transaction on EVM-compatible chains:

Import the SDK

import.js
import { Tachyon, ChainId } from '@rathfi/tachyon'

Initialize the Tachyon Client

initialize.js
const tachyon = new Tachyon({ apiKey: 'API-KEY', })

Submit a Transaction

submit-tx.js
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

check-status-evm.js
const status = await tachyon.getRelayStatus(txId) console.log('Transaction status:', status.status)

Wait for Execution

wait-execution-evm.js
const executedTx = await tachyon.waitForExecutionHash(txId) console.log('Execution hash:', executedTx.executionTxHash)

Methods

relay(params)

Submits a transaction to the Tachyon relay network for execution. The relay service handles gas payments and transaction submission on your behalf, returning a unique transaction ID for tracking.

Parameters:

The RelayParams object defines the parameters required when calling the relay() method.

NameTypeRequiredDescription
chainIdnumberYesThe blockchain network ID where the transaction will be executed. Must be a supported chain.
tostringYesThe recipient wallet address or smart contract address. Format varies by chain (hex for EVM, base58 for Solana, named for NEAR).
callDatastringYesEncoded transaction data in hexadecimal format (use ‘0x’ for simple transfers).
valuestringNoAmount of native currency to send in the smallest unit (wei for EVM, lamports for Solana, yoctoNEAR for NEAR). Defaults to ‘0’ if not specified.
labelstringNoNo human-readable label for easier transaction identification and tracking.
gasLimitstringNoOptional gas limit for the transaction. If not specified, it will be estimated automatically.
gasPricestringNoGas price for legacy transactions. Cannot be used with maxFeePerGas or maxPriorityFeePerGas.
maxFeePerGasstringNoMaximum fee per gas for EIP-1559 transactions. Must be used together with maxPriorityFeePerGas.
maxPriorityFeePerGasstringNoMaximum priority fee per gas for EIP-1559 transactions. Must be used together with maxFeePerGas.
maxUSDnumberNoMaximum cost in USD that you’re willing to pay for this transaction.
retriesnumberNoNumber of retry attempts for the transaction. Defaults to 0.
shouldBatchInMulticallbooleanNoWhether to batch this transaction in a multicall operation.
isAuthenticatedTxbooleanNoEnable authenticated relay mode for additional security and verification. Defaults to false.
derivationPathstringNoOptional HD wallet derivation path for transaction signing (useful for multi-account setups).
transactionType"flash" | "authenticated" | "funding-signed" | "flash-blocks"NoType of relay transaction. Defaults to "flash". "flash-blocks" is only supported on Base (8453) and Base Sepolia (84532).
authorizationListAuthorizationListItem[]NoOptional list of authorization entries for delegated transactions or batched operations. Cannot be used with "flash-blocks" transaction type.

Important Notes:

  • gasPrice and maxFeePerGas cannot be used together
  • gasPrice and maxPriorityFeePerGas cannot be used together
  • If using EIP-1559 gas parameters, both maxFeePerGas and maxPriorityFeePerGas must be provided together
  • authorizationList is not allowed for "flash-blocks" transactions
  • "flash-blocks" transaction type is only supported on Base (8453) and Base Sepolia (84532)

getRelayStatus(txId)

Retrieves the current status of a relay transaction, including execution details, costs, and any errors that may have occurred.

Parameters:

NameTypeRequiredDescription
txIdstringYesThe transaction ID returned from the relay() method.

Returns: Promise<RelayStatusBase> — A status object containing detailed information about the transaction.

Status Object Properties:

PropertyTypeDescription
idstringUnique transaction identifier.
statusstringCurrent status (e.g., "NOT_PICKED_UP", "PENDING", "EXECUTED", "FAILED").
executionTxHashstring | nullOn-chain transaction hash once executed, null if pending.
costUSDnumberEstimated or actual cost of the transaction in USD.
timestampstringISO timestamp of when the transaction was submitted.
latencynumber | nullTime taken for execution in milliseconds, null if not yet executed.
retriesnumberNumber of retry attempts made for this transaction.

waitForExecutionHash(txId, timeoutMs?, pollIntervalMs?)

Polls the relay service until the transaction has been executed on-chain, returning the final transaction status with the execution hash. This method is useful when you need to wait for confirmation before proceeding with subsequent operations.

Parameters:

NameTypeRequiredDescription
txIdstringYesThe transaction ID to monitor.
timeoutMsnumberOptionalMaximum time to wait for execution in milliseconds (default: 5000ms).
pollIntervalMsnumberOptionalTime between status checks in milliseconds (default: 50ms).

Returns: Promise<RelayStatusBase> — The completed transaction status object with the execution hash.

Throws: Will reject the promise if the timeout is reached before the transaction executes.


Transaction Lifecycle

  1. Submission: Call relay() with transaction parameters to submit to the relay network.
  2. Queued: Transaction enters the relay queue with status "NOT_PICKED_UP".
  3. Processing: Relay service picks up and submits the transaction on-chain.
  4. Executed: Transaction is confirmed on-chain and executionTxHash becomes available.

Example Output

After submitting a transaction and checking its status, you’ll receive a response similar to this:

status-response.json
{ "id": "68fa3450539a3c9d28bbca33", "userId": "68c275846a6ba1c9a2198a8c", "to": "0x3dbE34f2C21b3B2980d4dc53f3c7E51e39663F49", "callData": "0x", "value": "1", "chainId": 8453, "gasPrice": null, "maxFeePerGas": null, "maxPriorityFeePerGas": null, "gasLimit": null, "label": "My Transaction", "status": "NOT_PICKED_UP", "executionTxHash": null, "timestamp": "2025-10-23T13:57:36.672Z", "latency": null, "costUSD": 0.8400561743999754, "retries": 0, "isAccountCharged": false, "extraData": null, "transactionType": "flash" }

Once the transaction is executed, the executionTxHash will be populated:

output.txt
Execution hash: 0x094b3e172162c1f7618397413dbcde074f7f908bc63fd8010d4e6ca40d5afa76

You can use this hash to view the transaction on a block explorer or verify its execution on-chain.

Last updated on