This repo provides a starting point for building a dapp on the renec
blockchain.
programs
: This folder contains the logic code for the program. It usesanchor
framework to build the program.app
: This folder contains FE code for the dapp. It usesnext-js
andtypescript
to build the FE.dev-scripts
: This folder contains scripts to build and deploy the program, and to setup the FE usingbash-scripts
. Support running onUnix
environemnt.tests
: This folder contains tests for theprogram
- cargo / rust
- To setup program dependencies, run:
make install-deps
This will install the anchor
and solana
cli if needed. Default solana 1.14.6
, anchor 0.25.0
To use different version compatible with renec cluster
, set the CLUSTER
and ANCHOR_VERSION
environment variables and run the command
For example:
CLUSTER=mainnet ANCHOR_VERSION=0.20.1 make install-deps
CLUSTER
can either be mainnet
, testnet
or localnet
. By setting the cluster correctly, the installer will set the corresponding cli
for program's interaction.
- To run a
localnet
that has the same version asrenec-mainnet
, run;
make localnet
- To run a
localnet
that has the same version asrenec-testnet
, run;
CLUSTER=testnet make localnet
CLUSTER
variables can be either mainnet
, testnet
or localnet
, which corresponding to RENEC cluster url
. Default CLUSTER
is testnet
.
- To gen a new wallet, run:
make gen-wallet name="<wallet-name>"
If not passing name
parameter, the default name of the wallet will be id
. The wallets' screte keys will be stored in ./wallets
folder.
- To import an existing wallet, run:
make import-wallet name="<wallet-name>"
- To request faucet token in
testnet
orlocalnet
, run:
make faucet amount=1 name="<wallet-name>"
- To build program:
make build
This command will generate the program keypair
if needed, and replace it inside programs/dapp-starter/src/lib.rs
file.
Then it will build the program and generate program so
file.
For FE interaction, this script copies the `dapp_starter.json`, `dapp_starter.ts` and replace `program_id` into the `config.json` file in `app/src/artifacts` folder.
- To deploy
CLUSTER=mainnet make deploy name="<wallet-name>"
This command deploy the program, under .wallets/<wallet-name>.json
authority. The program will be deploy to CLUSTER
env, which could either be localnet
, mainnet
or testnet
-
The frontend is built with
next-js
andtypescript
. It uses@project-serum/anchor
to interact with the program. -
The FE uses daemon-wallet to connect with
renec-blockchain
. -
The provided program and the FE provide a simple
counter
program, which allows users toinitialize a counter
, andincrement
the count in thatcounter
.
- Node.js 16.8.0 or newer
build and deploy
the program to therenec testnet
. Make sure that you've runmake build
andCLUSTER=testnet make deploy
before running the frontend.
cd app
yarn && yarn dev