Skip to content

Latest commit

 

History

History
133 lines (93 loc) · 3.22 KB

README.md

File metadata and controls

133 lines (93 loc) · 3.22 KB

Umbrella network - logo

Aquarius

Umbrella Network's Solana program repository. The Solana programs are written in rust and compiled to a BPF bytecode variant which can be deployed to a local validator cluster, to one of the public testnets, or mainnet beta. Development uses the anchor framework which includes rust abstractions for program development, cli build, deployment and testing tools.

Setup for Dev Environment

  1. Install rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

source: https://www.rust-lang.org/tools/install

  1. Install solana CLI tools:
sh -c "$(curl -sSfL https://release.solana.com/v1.9.12/install)"

Ensure that the solana program path is included in your PATH env variable.

source: https://docs.solana.com/cli/install-solana-cli-tools

  1. Install yarn, which is required for anchor:
npm i -g corepack

source: https://yarnpkg.com/getting-started/install

  1. Install anchor:
npm i -g @project-serum/anchor-cli

source: https://book.anchor-lang.com/chapter_2/installation.html

  1. Install dependencies:
npm install
  1. Setup solana dev environment (not required for building, deploying, testing with anchor):

OPTION A - public devnet

  • To use the public 'devnet' cluster, use the following command to configure solana:
solana config set --url https://api.devnet.solana.com

OPTION B - local validator

  • To deploy and test against a local validator, use the following to configure solana:
solana config set --url http://localhost:8899
  • Then start the validator in a separate terminal window, if required:
solana-test-validator

note: this will create a dir in the working directory called 'test-ledger' which will store the blockchain / log data for the validator. note: if testing using anchor against local validator, then this validator must be stopped

  1. Create keypair to use for testing:
solana-keygen new --force

This should create the following output file: ~/.config/solana/id.json

  1. Request some testnet SOL via airdrop program (not required for building, deploying, testing with anchor):
solana airdrop 5

note: sometimes 5 is too much - in that case retry with 2

  1. Set the target cluster in the Anchor.toml file:

For local test validator:

[provider]
cluster = "localnet"

For devnet:

[provider]
cluster = "devnet"
  1. Compile rust programs / build bytecode artifacts:
anchor build
  1. Get program ID's to update in lib source files:
anchor keys list

Then update the following line in each program's lib.rs file with the correct program ID:

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");

Then ensure the following line contains the correct ID for each program in Anchor.toml:

[programs.localnet]
blocks = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
  1. Also update the following line in programs/chain/src/instructions/initialize.rs with your public key:
static INITIALIZER: &'static str = "BWujass7Wx77tKWYyckdNnBav6pjVA3tuaDvLAdpfS67";
  1. Run tests, which include deployments:
  • For running rust tests
anchor test