This repo includes the Solana-Rust implementation of the Push Communicator contract.
Note: Currently in WIP
- Make sure you have the latest version of Rust and Anchor installed.
- Set up your Solana wallet and ensure you have the necessary funds for deployment on your chosen network (localnet, devnet, or mainnet).
-
Create and Configure the
.env
FileCopy the example environment file to create your own:
cp .env.example .env
Open .env in a text editor and update the following values:
# Choose your network: localnet, devnet, or mainnet NETWORK=localnet # Change this to your desired environment # Path to your wallet ANCHOR_WALLET=/path/to/your/solana/id.json # Program ID (only needed for upgrades) PROGRAM_ID=YourProgramID # Replace with your actual program ID # Provider URLs PROVIDER_LOCALNET=http://localhost:8899 PROVIDER_DEVNET=https://api.devnet.solana.com PROVIDER_MAINNET=https://api.mainnet-beta.solana.com
Make sure to set the correct path for ANCHOR_WALLET and provide your actual PROGRAM_ID if you're upgrading an existing program.
-
Deploying the Program
Use the provided deployment script to build and deploy the Push Communicator program. This script will automatically use the values from your .env file for the selected network and wallet:
bash scripts/deploy.sh
The script will perform the following actions:
Build the program.
- Deploy it to the specified network using the appropriate provider URL and wallet.
- After deployment, the program ID will be displayed.
-
Upgrading the Program
If you need to upgrade an existing program, use the upgrade script. This script will also use the values from your .env file:
bash scripts/upgrade.sh
The upgrade process will:
- Build the program.
- Upgrade the existing program using the specified PROGRAM_ID, provider URL, and wallet from the .env file.
A success message will confirm the upgrade.
For localnet, ensure to run the Solana test validator in a separate terminal:
solana-test-validator
This will start a local Solana cluster that your deployment scripts can interact with.