RathRath Finance
How-To GuidesRelay Transactions

Solana

Submit and track a relay transaction on Solana.

Solana is a high-throughput blockchain where on-chain applications are called programs. A program interaction is made from one or more instructions containing a program ID, required accounts, and encoded instruction data.

Follow these steps to submit and track a simple transaction on Solana.

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: 10100000, // Solana chain ID
  to: 'BSNsLtDDM1wN8rjEJQaZreVqRhibsUtsEq9m1G2deAm',
  value: '1', // 1 lamport
  callData: '0x',
  label: 'My Solana 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 Solana Program

For this Memo Program example, the instruction is represented as JSON and base64-encoded into callData before it is relayed.

import { Tachyon } from '@rathfi/tachyon'

const tachyon = new Tachyon({ apiKey: 'YOUR_API_KEY' })
const programId = 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'

const message = {
  programId,
  keys: [],
  data: Buffer.from('Hello from Rath', 'utf8').toString('base64'),
}

const callData = Buffer.from(JSON.stringify(message), 'utf8').toString('base64')

const txId = await tachyon.relay({
  chainId: 10100000,
  to: programId,
  value: '0',
  callData,
  label: 'call-program-solana',
})
curl -X POST https://tachyon.rath.fi/api/submit-tx \
  -H "api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr",
    "callData": "eyJwcm9ncmFtSWQiOiJNZW1vU3E0Z3FBQkFYS2I5NnFuSDhUeXNOY1d4TXlXQ3FYZ0RMR21mY0hyIiwia2V5cyI6W10sImRhdGEiOiJTR1ZzYkc4Z1puSnZiU0J5WVhSbyJ9",
    "value": "0",
    "chainId": 10100000,
    "label": "call-program-solana"
  }'

On this page