NETConnecting

Docs Build

Deploy a program

Deploy a Solana program to Acrux with the stock solana CLI or Anchor, show it, call it from web3.js, and run an Anchor test suite. The upgradeable loader, --use-rpc, funding the deploy, and what runs on the SVM.

A Solana program deploys to Acrux the way it deploys to Solana: the stock solana CLI writes it through the upgradeable loader, and from the next slot any transaction can call it. The binary is the same SBF file you build for Solana.

  1. Point the CLI at Acrux

    Terminal
    solana config set --url https://rpc.acrux.computer
    solana address

    solana address prints the default keypair's address, the one that pays for the deploy and holds its upgrade authority.

  2. Fund the deployer

    A deploy pays the program's rent and a fee for each buffer write, in ACRUX. Ask the faucet for the address solana address printed, then check what the program will hold:

    Terminal
    solana balance
    solana rent <SIZE_OF_PROGRAM_SO_IN_BYTES>

    During the deploy the buffer holds a copy of the program beside the program data, so the deployer needs about twice what solana rent prints for the .so, plus the fees. The CLI refuses the deploy with the amount it needs when the balance is short. A small program such as the hello example below fits within one faucet grant of 2 ACRUX.

  3. Deploy

    Terminal
    solana program deploy --use-rpc target/deploy/<program>.so

    --use-rpc sends every buffer write through sendTransaction. Acrux has no TPU port, so a deploy without it does not reach the chain. Once the program is deployed the CLI prints Program Id: <PROGRAM_ID> and Signature: <SIGNATURE>. A program's keypair in target/deploy/<program>-keypair.json sets its address, as on Solana; --program-id names another.

  4. Show it

    Terminal
    solana program show <PROGRAM_ID>

    prints the program as Solana's CLI does:

    LineMeaning
    OwnerBPFLoaderUpgradeab1e11111111111111111111111, the upgradeable loader
    ProgramData Addressthe account that holds the program's code
    Authoritythe deployer, which can upgrade it
    Last Deployed In Slotthe slot the deploy landed in
    Data Lengththe program's size in bytes
    Balancethe program data's rent, in ACRUX; the CLI names the native unit SOL
  5. Call it

    call.ts
    import { readFileSync } from 'node:fs'
    import { Connection, Keypair, PublicKey, Transaction, TransactionInstruction, sendAndConfirmTransaction } from '@solana/web3.js'
    
    const connection = new Connection('https://rpc.acrux.computer', 'confirmed')
    const payer = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(readFileSync('keypair.json', 'utf8'))))
    
    const tx = new Transaction().add(
      new TransactionInstruction({ programId: new PublicKey('<PROGRAM_ID>'), keys: [], data: Buffer.from('gm, Acrux') }),
    )
    const signature = await sendAndConfirmTransaction(connection, tx, [payer], { commitment: 'confirmed' })
    const { meta } = await connection.getTransaction(signature, { commitment: 'confirmed', maxSupportedTransactionVersion: 0 })
    console.log(meta.logMessages)

    The program's logs come back in meta.logMessages. The hello example logs Hello from Acrux: program <PROGRAM_ID>, called with "gm, Acrux" and slot <SLOT>, then the runtime's consumed <N> of 200000 compute units and success. The signature opens the transaction's trail at https://acrux.computer/tx/<SIGNATURE>.

A program to try

The source download carries one in chain/examples/hello. It logs a greeting with its program ID, the instruction data it was called with, and the slot it ran in, which the call above prints.

Terminal
cd acrux-0.4.5-src/chain/examples/hello
cargo build-sbf --arch v0
solana program deploy --use-rpc target/deploy/hello.so

Build for SBF v0, the target Solana mainnet runs: newer platform tools default to v3, which neither chain runs.

Anchor

An Anchor workspace deploys and runs its own test suite against Acrux with only the provider's cluster changed. Checked with Anchor 0.31.

  1. Build for SBF v0

    Terminal
    anchor build -- --arch v0
  2. Deploy

    Terminal
    anchor deploy --provider.cluster https://rpc.acrux.computer -- --use-rpc

    Everything after -- goes to solana program deploy, so --use-rpc sends the buffer writes through sendTransaction, as above. The provider's wallet pays, so fund its address from the faucet first.

  3. Run the suite

    Terminal
    anchor test --skip-local-validator --skip-deploy --provider.cluster https://rpc.acrux.computer

    The suite runs against the program you deployed, and exits on its own when it is done. Its .rpc() calls confirm through Solana's PubSub on Acrux (Solana PubSub).

On Windows, Anchor hands its test script to WSL's bash. Run the workspace's test command yourself instead, with the provider set in the environment, from Git Bash:

Git Bash
ANCHOR_PROVIDER_URL=https://rpc.acrux.computer ANCHOR_WALLET=<path/to/wallet.json> \
  yarn run ts-mocha -p ./tsconfig.json -t 1000000 "tests/**/*.ts"

The source download carries a workspace to try in chain/examples/counter: a counter anyone creates and increments, with a suite that creates one at zero, increments it three times and checks that another signer is refused. It holds about 1.3 ACRUX of rent once deployed, so its deployer takes two faucet grants.

What runs

Loaderthe upgradeable loader, BPF Loader v3, as on Solana mainnet
Callsa transaction may call any program on the chain (Programs on Acrux); one that calls an account that is not a program fails at execution and pays its fees
Featuresevery SVM feature Solana mainnet runs; loader v4 is not active, nor the end of new loader v3 deployments, as on mainnet
Compute budgetSetComputeUnitLimit, SetComputeUnitPrice, RequestHeapFrame and SetLoadedAccountsDataSizeLimit
Closed accountsan account a transaction leaves with no lamports no longer exists, as on Solana, so its address can be created again; a deploy closes its buffer this way

A deploy sends a few hundred buffer writes at once, within the submit limit. They all write the one buffer, so the merge places only some of them in each slot (Ordering and selection); the rest go back to their proposer and land in the next slots, and none is recorded as failed.

On a net you run, a program can also be loaded at a fixed address before the first slot (Load a program).