Перейти к основному содержимому

Port dApp from Solana

To reduce the time to convert and rebuild programs from Solana. We have supported scripts to quickly re-deploy programs to Renec from previously built programs.

Prerequisites#

  • For Linux user:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev
sudo apt install libssl-dev
sudo apt install git
  • For Mac user:
brew install openssl
brew install git
  • For Windows user: must install make
  • Install Chocolatey from here https://chocolatey.org/install
  • Then run choco install make from a fresh terminal.
  • Then install git

Setup#

Clone repository#

git clone https://github.com/renec-chain/dapp-starter
cd dapp-starter

Setup environments#

  • 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. We recommend using this version.

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 the program's interaction.

  • To run a localnet that has the same version as renec-mainnet, run;
make localnet

Setup wallets#

  • To gen a new wallet, run:
make gen-wallet name="<wallet-name>"

Type “Enter” for skipping pass Passphrase, and a new wallet will be created:

The wallet's secret key will be stored in the ./wallets folder.

  • To import an existing wallet, create a json file in .wallets folder containing the secret string. Example: prepare solana.json wallet

Then run:

make import-wallet name="<wallet-name>"

  • To request faucet token in testnet or localnet, run:
make faucet amount=1 name="<wallet-name>"

Deploy#

Bash script params annotation:#

program_file_path: Path to the built program file used to deploy on Solana keypair_path: Path to the keypair used to deploy on Solana program_id_keypair: Path to the program ID keypair file used to deploy on Solana

  • Deploy on Testnet:
CLUSTER=testnet make port-dapp program_file_path=path/to/program_file.so keypair_path=path/to/wallet.json program_id_keypair=path/to/program-id/keypair.json

  • Deploy on Mainnet:
CLUSTER=mainnet make port-dapp program_file_path=path/to/program_file.so keypair_path=path/to/wallet.json progran_id_keypair=path/to/program-id/keypair.json