NETConnecting

Docs Build

Solana programs and tools

Use web3.js, Anchor clients and the solana CLI against Acrux. The Solana JSON-RPC methods rpc.acrux.computer serves, how to send and confirm, and how programs come onto the chain.

Acrux runs Solana's transactions and programs on the SVM, so the tools you already use for Solana work against it. https://rpc.acrux.computer answers Solana's JSON-RPC beside Acrux's own: a request whose params is an array is Solana's. Amounts are lamports of ACRUX, 1 ACRUX = 1,000,000,000 lamports, so LAMPORTS_PER_SOL converts them as it does on Solana.

web3.js

transfer.ts
import { Connection, Keypair, LAMPORTS_PER_SOL, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js'

const connection = new Connection('https://rpc.acrux.computer', 'confirmed')
const payer = Keypair.generate() // funded from the faucet, see Endpoints and limits

console.log(await connection.getBalance(payer.publicKey) / LAMPORTS_PER_SOL, 'ACRUX')

const tx = new Transaction().add(
  SystemProgram.transfer({ fromPubkey: payer.publicKey, toPubkey: Keypair.generate().publicKey, lamports: 1_000_000 }),
)
const signature = await sendAndConfirmTransaction(connection, tx, [payer])

sendAndConfirmTransaction fetches the blockhash, sends, and confirms through signatureSubscribe on wss://rpc.acrux.computer, the WebSocket web3.js derives from the RPC URL. A transaction is processed once it executes. It is confirmed and finalized together once its cblock is final and that cblock's state is on the node's disk, so a restart never takes back what was reported final. Until then it stays processed, because before that an executed transaction can still go with a skipped cblock; so confirmed on Acrux promises what finalized does. The subscriptions, onAccountChange and onSlotChange among them, are on Event stream.

sendTransaction simulates the transaction, then sends it in the clear to the three proposers of the next slot after the latest started one, and a copy that misses that slot's block is carried by the next; { skipPreflight: true } sends without the simulation. Sending the same signed transaction again answers the same signature, and until it executes sends it out again. To split it t-of-n so no proposer reads it alone, send the same signed transaction with @acrux/sdk.

Acrux's own event stream streams every transaction's trail through the slot. The slot itself, measured beside Solana mainnet with onSlotChange from one client, and the script to measure it yourself: The slot beside Solana.

Anchor clients

An Anchor program's client works over the same Connection, and .rpc() sends and confirms as it does on Solana. Deploying an Anchor workspace and running its suite are on Deploy a program.

anchor.ts
import { AnchorProvider, Program, Wallet } from '@coral-xyz/anchor'

const provider = new AnchorProvider(connection, new Wallet(payer), { commitment: 'confirmed' })
const program = new Program(idl, provider)

const accounts = await program.account.hub.all() // getProgramAccounts
const signature = await program.methods.joinHub().accounts({ /* … */ }).rpc()

Reads through program.account.*.fetch and .all() use getAccountInfo, getMultipleAccounts and getProgramAccounts.

The solana CLI

The stock solana CLI runs against Acrux with -u https://rpc.acrux.computer. Fund the keypair's address from the faucet first: a grant lands as 2 ACRUX of native balance, which the CLI prints as SOL, and token accounts holding 100 AXA and 100 AXB, which getTokenAccountsByOwner lists.

Terminal
solana balance -u https://rpc.acrux.computer
solana transfer <RECIPIENT> 0.01 --allow-unfunded-recipient -u https://rpc.acrux.computer
solana confirm -v <SIGNATURE> -u https://rpc.acrux.computer

solana transfer prints the signature once the transfer confirms; solana confirm -v prints the transaction with its fee, logs and status. The same signature opens its whole trail through the slot at https://acrux.computer/tx/<SIGNATURE>, and Acrux's own getTransaction takes it too. acrux send sends from a keypair file too, t-of-n as well as in the clear.

Methods

MethodReturns
getHealth"ok"
getVersionsolana-core as acrux-<version>, feature-set 0
getGenesisHashthe hash of the chain's genesis state
getSlot, getBlockHeightthe latest executed slot
getEpochInfothe epoch, 432,000 slots long, and the slot's place in it
getLatestBlockhasha blockhash from 8 slots back, and lastValidBlockHeight: it is valid for 1,200 slots, one minute
isBlockhashValidwhether a blockhash is one of the last 1,200 slots'
getBalancean address's lamports
getAccountInfo, getMultipleAccountsaccounts with their lamports, owner, data, executable flag and size; null for an account that does not exist; up to 100 keys
getProgramAccountsevery account a program owns
getTokenAccountsByOwneran owner's token accounts, filtered by { "mint" } or { "programId" }; SPL Token and Token-2022 both when the filter names neither
getTokenAccountBalancea token account's balance: amount, decimals, uiAmount, uiAmountString
getTokenSupplya mint's supply, in the same shape
getMinimumBalanceForRentExemptionthe rent-exempt minimum for a data length
getFeeForMessagewhat the message pays when sent with sendTransaction: the base fee, the priority fee, and three inclusion fees, one per proposer it goes to; null for a blockhash past its 1,200 slots (Fees)
getRecentPrioritizationFees0: every slot's merge orders by priority fee, and none is needed to land
getVoteAccountsthe validators with their stake
getRecentPerformanceSamplesone sample a minute of the slots and transactions the chain executed, newest first: slot, numSlots, numTransactions, numNonVoteTransactions (equal, Acrux has no vote transactions), samplePeriodSecs; up to the given limit, at most 720 (twelve hours); with onSlotChange, how the slot beside Solana is measured
getBlockTimea slot's time in Unix seconds, from the wall clock at the latest executed slot and 20 slots a second back from it; an error for a slot that has not executed
simulateTransactionthe transaction run against the current state and nothing kept: err, logs, unitsConsumed; sigVerify checks its signatures, replaceRecentBlockhash runs it over the latest blockhash and returns that one as replacementBlockhash
sendTransactionthe transaction's first signature; base58 by default, or { "encoding": "base64" }; simulated first unless skipPreflight
getSignatureStatusesup to 256 signatures; per signature: slot, err, and confirmationStatus processed once executed or finalized once its cblock is final; null before it executes
getTransactionan executed transaction by signature with slot, blockTime (the Unix second its slot executed), version, the transaction in json, jsonParsed, base64 or base58, and meta with fee, preBalances, postBalances, preTokenBalances, postTokenBalances, logMessages and computeUnitsConsumed. jsonParsed parses System, SPL Token, Token-2022, Associated Token Account and Memo instructions, and gives Compute Budget instructions unparsed, as Solana does. Transactions people send are kept 7 days. The answer is null until its cblock is final, or with { "commitment": "confirmed" } once it executes
getSignaturesForAddressthe signatures of executed transactions that name the address, newest first, with slot, err, blockTime (the Unix second its slot executed) and confirmationStatus, processed or finalized; limit up to 1,000, before and until page through them; the transactions people send are kept 7 days

Every result carries Solana's context with the slot where Solana's does. The account methods and getTokenAccountsByOwner take { "encoding" }: base64, the default, base58, or jsonParsed. jsonParsed parses SPL Token and Token-2022 token accounts (mint, owner, tokenAmount, state, isNative, delegate, closeAuthority) and mints (mintAuthority, supply, decimals, isInitialized, freezeAuthority), and returns every other account in base64. A JSON array of up to 100 requests is a batch, answered in order, each request counted against the limits on its own.

A failed transaction's err reads {"InstructionError":[0,{"Custom":0}]} in every Solana shape; the error itself is in its logs, meta.logMessages, on the site at /tx/<SIGNATURE>, and in failure of Acrux's own getTransaction. A transaction that fails validation in sendTransaction is refused with Transaction simulation failed: …, code -32002, and one whose fee payer does not hold the inclusion fee of its three copies with The fee payer cannot pay the inclusion fee: fund it first. A string param longer than 1,684 characters, the base58 of a full 1,232-byte transaction, or a getMultipleAccounts list of more than 100 keys is refused with -32602. These methods count against the read and submit limits. simulateTransaction and sendTransaction's preflight are also charged the compute units they run, per client IP; past that limit they answer RATE_LIMITED: too much simulation from this address, and sendTransaction with skipPreflight still sends. Acrux's own methods, with object params, are on JSON-RPC.

Programs on Acrux

Solana programs run on Acrux unchanged: the same SBF binaries, the same instructions and accounts, and a transaction may call any program on the chain. solana program deploy --use-rpc deploys one through the upgradeable loader (Deploy a program). On a net you run, --program ADDRESS=PATH also loads one at a fixed address before the first slot (Load a program). Acrux Net's genesis carries the Hub Registry and the demo pool, CUBR9LNdTwxwp5ARBQj1EopfuH8dr8u4i7DsXcb8HbHN, whose swap instruction trades the faucet's AXA and AXB. SPL Token, Token-2022, the Associated Token Account program and Memo run at their mainnet addresses: every program on the chain is on Programs on Acrux, and moving a whole app is Move a Solana app.