RathRath Finance
How-To GuidesRelay Transactions

Introduction

Learn the shared relay transaction methods and lifecycle used across Tachyon-supported networks.

The Tachyon SDK provides a complete workflow for submitting transactions to the relay network, monitoring their status, and waiting for on-chain execution. Use the chain-specific pages in this section for runnable examples, then refer back here for the shared methods and lifecycle.

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> resolving to 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> resolving to 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:

{
  "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: 0x094b3e172162c1f7618397413dbcde074f7f908bc63fd8010d4e6ca40d5afa76

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


Smart Contract Calls

Use the Tachyon Relay API to interact with smart contracts across multiple blockchains. The /api/submit-tx endpoint supports EVM, Solana, Aptos, Sui, NEAR, and Starknet through a unified relay flow: encode your contract call, submit it to Tachyon, then track the returned transaction ID.

Use the chain-specific pages in this section for runnable SDK and REST examples.

SDK Step-by-Step Instructions

  1. Install the required dependencies:
npm install @rathfi/tachyon ethers
  1. Import the necessary modules:

    • Import Tachyon and ChainId from @rathfi/tachyon.
    • Import the chain-specific encoding library, such as ethers for EVM calldata.
  2. Initialize the Tachyon SDK:

    • Create a new Tachyon instance.
    • Pass your API key in the configuration object: { apiKey: 'YOUR_API_KEY' }.
  3. Define the contract call:

    • For EVM, define the ABI function signature.
    • For non-EVM chains, build the chain-specific payload required by that runtime.
  4. Encode the function call:

    • Convert the function call into callData.
    • For EVM, use ethers.Interface.encodeFunctionData().
    • For Aptos, Sui, NEAR, Solana, and Starknet, use the chain-specific payload encoding shown in the child pages.
  5. Submit the relay transaction:

    • Call tachyon.relay() with chainId, to, value, callData, and any optional relay parameters.
    • Use await because the relay call is asynchronous.
  6. Handle the transaction ID:

    • The method returns a txId string.
    • Use this ID to track transaction status through Tachyon.

SDK Function Parameters

tachyon.relay(options)

ParameterTypeRequiredDescriptionExample
chainIdChainId or numberYesChain identifier. Use a ChainId enum value when available, or the numeric chain ID.ChainId.BASE or 8453
tostringYesTarget contract address."0xA7A833e6641D7901F30EaD6f27d4Ee2C9bb670a7"
valuestringYesNative token amount in the chain's smallest unit. Use "0" for non-payable calls."0"
callDatastringYesEncoded function call data.Result from iface.encodeFunctionData()
labelstringOptionalCustom transaction label."Say Hello Example"
gasLimitstringOptionalGas limit override."100000"
isAuthenticatedTxbooleanOptionalAuthenticated relay mode.true or false
transactionTypestringOptionalProcessing type."flash" or "flash-blocks"

Returns: Promise<string> - The transaction ID (txId).

REST API Step-by-Step Instructions

  1. Obtain your API key from the Tachyon dashboard at https://accounts.rath.fi.

  2. Prepare your contract call data:

    • Identify the target contract address (to).
    • Encode your function call into callData.
    • Determine the chainId for your target network, such as 8453 for Base.
  3. Set the transaction value:

    • Use "0" for non-payable functions.
    • Specify the amount as a string in the chain's smallest unit for payable functions.
  4. Make the API request:

    • Send a POST request to https://tachyon.rath.fi/api/submit-tx.
    • Include your API key in the api-key header.
    • Set Content-Type to application/json.
  5. Handle the response:

    • Extract the txId from the response.
    • Use this txId to track transaction status.

API Parameters

The RelayParams object defines the parameters used by both the SDK and REST API relay request.

NameTypeRequiredDescription
chainIdnumberYesBlockchain network ID where the transaction will be executed. Must be a supported chain.
tostringYesRecipient wallet address or smart contract address. Format varies by chain.
callDatastringYesEncoded transaction data. Use '0x' only for simple transfers.
valuestringNoNative token amount in the smallest unit. Defaults to '0' if not specified.
labelstringNoOptional human-readable label for transaction identification and tracking.
gasLimitstringNoOptional gas limit. If omitted, Tachyon estimates it automatically.
gasPricestringNoLegacy gas price. Cannot be used with maxFeePerGas or maxPriorityFeePerGas.
maxFeePerGasstringNoEIP-1559 max fee per gas. Must be used with maxPriorityFeePerGas.
maxPriorityFeePerGasstringNoEIP-1559 priority fee per gas. Must be used with maxFeePerGas.
maxUSDnumberNoMaximum transaction cost in USD.
retriesnumberNoNumber of retry attempts. Defaults to 0.
shouldBatchInMulticallbooleanNoWhether to batch this transaction in a multicall operation.
isAuthenticatedTxbooleanNoEnables authenticated relay mode. Defaults to false.
derivationPathstringNoOptional HD wallet derivation path for transaction signing.
transactionType"flash" | "authenticated" | "funding-signed" | "flash-blocks"NoRelay transaction type. Defaults to "flash".
authorizationListAuthorizationListItem[]NoOptional authorization entries for delegated transactions or batched operations. Cannot be used with "flash-blocks".

Transaction Lifecycle

After submitting your transaction through either the REST API or SDK:

  1. Submission: The /api/submit-tx endpoint returns a unique txId.
  2. Queued: Transaction enters the relay queue with NOT_PICKED_UP status.
  3. Processing: A relay node picks up and broadcasts the transaction to the blockchain.
  4. Executed: Transaction gets confirmed on-chain and the execution hash becomes available.

You can use the txId to query transaction status and retrieve the execution hash once confirmed.

Summary

The Tachyon Relay API provides a unified interface for smart contract calls across multiple blockchain networks. Whether you use direct REST calls or the TypeScript SDK, the flow remains the same: encode the call, submit it to the relay, and track execution with the returned transaction ID.

On this page