Skip to Content

Smart Contract Call

Use the Tachyon Relay API to interact with smart contracts across multiple blockchains. The /api/submit-tx endpoint supports EVM, Solana, Aptos, Sui, and NEAR, enabling a unified interface for submitting encoded contract calls through the Tachyon network.

Chain Examples

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

Using REST API

Code Example

terminal
curl -X POST https://api.tachyon.rath.fi/api/submit-tx \ -H "apikey: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chainId": 8453, "to": "0xA7A833e6641D7901F30EaD6f27d4Ee2C9bb670a7", "value": "0", "callData": "0xc3a9b1c50000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001348656c6c6f2066726f6d2054616368796f6e2100000000000000000000000000", "label": "Hello From Tachyon Call" }'

Response:

response.json
{ "txId": "68fa3450539a3c9d28bbca33" }

Step-by-Step Instructions

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

  2. Prepare your contract call data:

    • Identify the target contract address (to)
    • Encode your function call into callData (see SDK example for encoding details)
    • Determine the chainId for your target network (e.g., 8453 for Base, 1 for Ethereum)
  3. Set the transaction value:

    • Use "0" for non-payable functions
    • Specify the amount in wei as a string for payable functions
  4. Make the API request:

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

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

API 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.
labelstringNoOptional 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.

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; execution hash becomes available

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


Summary

The Tachyon Relay API provides a simple, unified interface for interacting with smart contracts across multiple blockchain networks. Whether you’re using the REST API for direct HTTP calls or the TypeScript SDK for type-safe integration, the process remains straightforward: encode your contract call, submit it to the relay, and track it using the returned transaction ID.

Last updated on