Skip to content

nosana-ci/buildstation

 
 

Repository files navigation

Solana

Hello world on Solana

This project demonstrates how to use the Solana Javascript API to interact with programs on the Solana blockchain.

The project comprises:

  • An on-chain hello world program
  • A client that can send a "hello" to an account and get back the number of times "hello" has been sent

Quick Start

The following dependencies are required to build and run this example, depending on your OS, they may already be installed:

If this is your first time using Rust, these Installation Notes might be helpful.

Configure CLI

If you're on Windows, it is recommended to use WSL to run these commands

  1. Set CLI config url to localhost cluster
solana config set --url http://127.0.0.1:8899
  1. Create CLI Keypair

If this is your first time using the Solana CLI, you will need to generate a new keypair:

solana-keygen new

Install npm dependencies

npm install

Build the on-chain program

There is both a Rust and C version of the on-chain program, whichever is built last will be the one used when running the example.

npm run build:program-rust
npm run build:program-c

Deploy the on-chain program

solana program deploy dist/program/helloworld.so

Run the JavaScript client

npm run start

Customizing the Program

To customize the example, make changes to the files under /src. If you change any files under /src/program-rust or /src/program-c you will need to rebuild the on-chain program and redeploy the program.

Now when you rerun npm run start, you should see the results of your changes.

About

Hello world on Solana

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 51.9%
  • Rust 34.5%
  • C 12.8%
  • Makefile 0.8%