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 { 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)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.
| Name | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | The blockchain network ID where the transaction will be executed. Must be a supported chain. |
to | string | Yes | The recipient wallet address or smart contract address. Format varies by chain (hex for EVM, base58 for Solana, named for NEAR). |
callData | string | Yes | Encoded transaction data in hexadecimal format (use ‘0x’ for simple transfers). |
value | string | No | Amount of native currency to send in the smallest unit (wei for EVM, lamports for Solana, yoctoNEAR for NEAR). Defaults to ‘0’ if not specified. |
label | string | No | No human-readable label for easier transaction identification and tracking. |
gasLimit | string | No | Optional gas limit for the transaction. If not specified, it will be estimated automatically. |
gasPrice | string | No | Gas price for legacy transactions. Cannot be used with maxFeePerGas or maxPriorityFeePerGas. |
maxFeePerGas | string | No | Maximum fee per gas for EIP-1559 transactions. Must be used together with maxPriorityFeePerGas. |
maxPriorityFeePerGas | string | No | Maximum priority fee per gas for EIP-1559 transactions. Must be used together with maxFeePerGas. |
maxUSD | number | No | Maximum cost in USD that you’re willing to pay for this transaction. |
retries | number | No | Number of retry attempts for the transaction. Defaults to 0. |
shouldBatchInMulticall | boolean | No | Whether to batch this transaction in a multicall operation. |
isAuthenticatedTx | boolean | No | Enable authenticated relay mode for additional security and verification. Defaults to false. |
derivationPath | string | No | Optional HD wallet derivation path for transaction signing (useful for multi-account setups). |
transactionType | "flash" | "authenticated" | "funding-signed" | "flash-blocks" | No | Type of relay transaction. Defaults to "flash". "flash-blocks" is only supported on Base (8453) and Base Sepolia (84532). |
authorizationList | AuthorizationListItem[] | No | Optional list of authorization entries for delegated transactions or batched operations. Cannot be used with "flash-blocks" transaction type. |
Important Notes:
gasPriceandmaxFeePerGascannot be used togethergasPriceandmaxPriorityFeePerGascannot be used together- If using EIP-1559 gas parameters, both
maxFeePerGasandmaxPriorityFeePerGasmust be provided together authorizationListis 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:
| Name | Type | Required | Description |
|---|---|---|---|
txId | string | Yes | The transaction ID returned from the relay() method. |
Returns: Promise<RelayStatusBase> — A status object containing detailed information about the transaction.
Status Object Properties:
| Property | Type | Description |
|---|---|---|
id | string | Unique transaction identifier. |
status | string | Current status (e.g., "NOT_PICKED_UP", "PENDING", "EXECUTED", "FAILED"). |
executionTxHash | string | null | On-chain transaction hash once executed, null if pending. |
costUSD | number | Estimated or actual cost of the transaction in USD. |
timestamp | string | ISO timestamp of when the transaction was submitted. |
latency | number | null | Time taken for execution in milliseconds, null if not yet executed. |
retries | number | Number 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:
| Name | Type | Required | Description |
|---|---|---|---|
txId | string | Yes | The transaction ID to monitor. |
timeoutMs | number | Optional | Maximum time to wait for execution in milliseconds (default: 5000ms). |
pollIntervalMs | number | Optional | Time 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
- Submission: Call
relay()with transaction parameters to submit to the relay network. - Queued: Transaction enters the relay queue with status
"NOT_PICKED_UP". - Processing: Relay service picks up and submits the transaction on-chain.
- Executed: Transaction is confirmed on-chain and
executionTxHashbecomes available.
Example Output
After submitting a transaction and checking its status, you’ll receive a response similar to this:
{
"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:
Execution hash: 0x094b3e172162c1f7618397413dbcde074f7f908bc63fd8010d4e6ca40d5afa76You can use this hash to view the transaction on a block explorer or verify its execution on-chain.