Overview
Deploying NullGraph to devnet involves three key steps:- Build and deploy the Anchor program to Solana devnet
- Initialize the protocol by creating the ProtocolState singleton
- Update the frontend IDL to match the deployed program
The deployed program ID on devnet is:
2u3DXQq9A6UgMryeVSWCNdYLy3Fjh391R5hcfWYkCgZKPrerequisites
Before deploying, ensure you have:- Completed the local setup
- Built the program with
anchor build - At least 2 SOL in your devnet wallet for deployment
- Configured Solana CLI to devnet:
solana config set --url devnet
Deployment Steps
Build the program
Compile the Anchor program and generate the IDL:This creates:
- Compiled program binary:
target/deploy/nullgraph.so - IDL file:
target/idl/nullgraph.json - TypeScript types:
target/types/nullgraph.ts
Deploy to devnet
Deploy the program to the Solana devnet cluster:This command:
- Uploads the compiled program to devnet
- Uses the program ID from
Anchor.toml:2u3DXQq9A6UgMryeVSWCNdYLy3Fjh391R5hcfWYkCgZK - Deducts deployment costs from your wallet
Initialize the protocol
Run the one-time initialization script to create the ProtocolState singleton:This script:
- Derives the ProtocolState PDA:
["protocol_state"] - Calls
initialize_protocolwith fee rate of 250 basis points (2.5%) - Sets the treasury address
- Initializes counters (
nka_counter,bounty_counter) to zero
This script only needs to run once per deployment. If the PDA already exists, it will fail with “already in use”.
Verify deployment
Verify the program deployed successfully:You can also view the program on Solana Explorer:https://explorer.solana.com/address/2u3DXQq9A6UgMryeVSWCNdYLy3Fjh391R5hcfWYkCgZK?cluster=devnet
Anchor Configuration
The deployment configuration is defined inAnchor.toml:
| Field | Description |
|---|---|
programs.devnet.nullgraph | Program ID for devnet deployment |
provider.cluster | Target cluster (devnet, testnet, mainnet-beta) |
provider.wallet | Path to keypair file for deployment authority |
Protocol Initialization Details
Theinitialize_protocol instruction creates the global ProtocolState account:
| Field | Type | Initial Value | Description |
|---|---|---|---|
authority | Pubkey | Deployer wallet | Protocol admin |
nka_counter | u64 | 0 | Auto-incrementing NKA counter |
bounty_counter | u64 | 0 | Auto-incrementing bounty counter |
fee_basis_points | u16 | 250 | Fee on settlement (2.5%) |
treasury | Pubkey | Treasury wallet | Fee collection address |
bump | u8 | PDA bump | PDA derivation seed |
Updating the Frontend IDL
After deploying or updating the program, synchronize the frontend IDL:Program Upgrades
To upgrade an existing deployment with new program code:Only the upgrade authority (the wallet that deployed the program) can upgrade it. Check the upgrade authority with:
Deployment Checklist
- Built program:
anchor build - Funded wallet with 2+ SOL:
solana balance - Deployed program:
anchor deploy --provider.cluster devnet - Initialized protocol:
npx ts-node scripts/init-protocol.ts - Verified deployment:
solana program show <program-id> - Updated frontend IDL:
cp target/idl/nullgraph.json app/src/lib/ - Tested frontend connection:
cd app && npm run dev
Deployment Costs
| Action | Approximate Cost | Description |
|---|---|---|
| Program deployment | ~2 SOL | One-time program account rent + transaction fees |
| Protocol initialization | ~0.001 SOL | ProtocolState PDA creation |
| NKA submission | ~0.001 SOL | NullResult PDA creation |
| Bounty creation | ~0.002 SOL | NullBounty + vault PDA creation |
Costs are for devnet and may vary. Mainnet costs will be similar but use real SOL.
Verifying On-Chain State
After initialization, verify the ProtocolState account:Troubleshooting
”Insufficient funds” error
Solution: Request more devnet SOL:“Program already deployed” error
Solution: Useanchor upgrade instead of anchor deploy:
“PDA already in use” during initialization
Solution: The protocol is already initialized. Skip the initialization step.”Transaction simulation failed” on frontend
Solution: Ensure the frontend IDL matches the deployed program:Next Steps
- Run the test suite against devnet
- Explore program architecture
- Learn about accounts and instructions
- Connect the frontend to your deployment