Giter Site home page Giter Site logo

super-dev-0113 / solana-bpf-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from myungjunchae/solana-bpf-boilerplate

0.0 0.0 0.0 36 KB

Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana

License: MIT License

Rust 53.69% TypeScript 46.31%

solana-bpf-boilerplate's Introduction

Solana BPF Boilerplate

Solana

Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana

This boilerplate provides the following.

  • Simple smart contract that can be published on Solana Online.
    • Store data through byte buffer on account what you create.
  • RPC Client interacts with published smart contracts
    • Send transaction about creating an account for store data of the published program, and Initializing published program.

Prerequisite

Quick Start

  • Build Rust
  • Setup Solana Config and Test-Validator(Single node cluster)
  • Set Environment
  • Run RPC Client

Build Rust

Build Rust and get .so file. You should conduct following command on contract folder

cargo build-bpf

Run test-validator

solana-test-validator -r --bpf-program 5yznMbghv1Z2Gb4uaKkY9fxb9PkLMrSn9xgjswucHq4X ${.so}

If you want to get more information about validator.

Use solana-test-validator -h

Setup Solana

Set CLI config url to localhost cluster

solana config set --url localhost

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

solana-keygen new

Set Environment

Before running RPC Client, Change .example-env to .env.

And refer to the below and fill USER_PUBLICE_KEY & USE_PRIVATE_KEY

CUSTOM_PROGRAM_ID=5yznMbghv1Z2Gb4uaKkY9fxb9PkLMrSn9xgjswucHq4X
USER_PUBLIC_KEY=6Nr8iPDAAkR54aEfhuc5LD86paVfeFkvETwj3pdf73o5
USER_PRIVATE_KEY=[180,232,26,240,241,108,253,206,155,230,59,44,39,19,191,11,17,180,126,71,236,92,212,4,110,29,2,0,180,168,52,132,79,227,47,188,174,13,151,40,50,237,0,221,198,50,72,164,14,48,23,225,87,115,28,241,156,41,239,176,116,23,157,72]

Run RPC Client

Install the necessary dependencies for running RPC Client. You should conduct following command on client folder

npm install

Run RPC Client for interaction with on-chain program what you published.

npm run transaction

Further

SmartContract

  • Pack & Unpack with Barsh

RPC Client

  • Setup.ts for create wallet account

solana-bpf-boilerplate's People

Contributors

myungjunchae avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.