Deploy MultiGov on Solana#
This guide provides instructions on how to set up and deploy the MultiGov Staking Program on Solana. Before proceeding with the deployment, ensure that MultiGov aligns with your project's governance needs by reviewing the system architecture.
Once your project setup is complete, follow this guide to configure, compile, and deploy the necessary Solana programs and supporting accounts. This deployment enables decentralized governance participation on Solana as a spoke chain within the MultiGov system.
Prerequisites#
To deploy MultiGov on Solana, ensure you have the following installed:
- Install Git
- Install Node.js
v20.10.0
- Install Solana CLI
v1.18.20
- Install Anchor
v0.30.1
- Install Rust
v1.80.1
- Install Docker
- Clone the repository:
Build the Project#
To create a verifiable build of the MultiGov Staking Program, run the following command:
Once the build is complete, the compiled artifacts will be available in the target
folder.
Set Up the Deployer Account#
For a successful deployment, you need a funded deployer account on Solana. This account will store the program and execute deployment transactions.
In this section, you will create a new keypair, check the account balance, and ensure it has enough SOL tokens to cover deployment costs. If needed, you can fund the account using different methods before deploying.
Generate a New Keypair#
To create a new keypair and save it to a file, run the following command:
Check the Deployer Account Address#
To retrieve the public address of the newly created keypair, run the following command:
Check the Deployer Account Balance#
To verify the current balance of the deployer account, run the following command:
Important
When deploying the MultiGov Staking Program, the deployer account must have enough SOL to cover deployment costs and transaction fees.
- 7.60219224 SOL for deployment costs
- 0.00542 SOL for transaction fees
Fund the Deployer Account#
If the account does not have enough SOL, use one of the following methods to add funds.
-
Transfer SOL from another account - if you already have SOL in another account, transfer it using a wallet (Phantom, Solflare, etc.) or in the terminal
-
Request an airdrop (devnet only) - if deploying to devnet, you can request free SOL
-
Use a Solana faucet (devnet only) - you can use online faucets to receive 10 free SOL
Deploy the MultiGov Staking Program#
With the deployer account set up and funded, you can deploy the MultiGov Staking Program to the Solana blockchain. This step involves deploying the program, verifying the deployment, and ensuring the necessary storage and metadata are correctly configured. Once the IDL is initialized, the program will be ready for further setup and interaction.
Deploy the Program#
Deploy the MultiGov Staking Program using Anchor:
anchor deploy --provider.cluster https://api.devnet.solana.com --provider.wallet ./app/keypairs/deployer.json
Verify the Deployment#
After deployment, check if the program is successfully deployed by running the following command:
Extend Program Storage#
If the deployed program requires additional storage space for updates or functionality, extend the program storage using the following command:
Initialize the IDL#
To associate an IDL file with the deployed program, run the following command:
anchor idl init --provider.cluster https://api.devnet.solana.com --filepath ./target/idl/staking.json INSERT_PROGRAM_ID
Configure the Staking Program#
The final step after deploying the MultiGov Staking Program is configuring it for proper operation. This includes running a series of deployment scripts to initialize key components and set important governance parameters. These steps ensure that staking, governance, and cross-chain communication function as expected.
Run Deployment Scripts#
After deploying the program and initializing the IDL, execute the following scripts in order to set up the staking environment and necessary accounts.
-
Initialize the MultiGov Staking Program with default settings:
-
Create an Account Lookup Table (ALT) to optimize transaction processing:
-
Set up airlock accounts:
-
Deploy a metadata collector:
-
Configure vote weight window lengths:
-
Deploy the message executor for handling governance messages:
Set MultiGov Staking Program Key Parameters#
When deploying MultiGov on Solana, several key parameters need to be set. Here are the most important configuration points:
maxCheckpointsAccountLimit
u64 - the maximum number of checkpoints an account can have. For example,654998
is used in production, while15
might be used for testinghubChainId
u16
- the chain ID of the hub network where proposals are primarily managed. For example,10002
for Sepolia testnethubProposalMetadata
[u8; 20] - an array of bytes representing the address of the Hub Proposal Metadata contract on Ethereum. This is used to identify proposals from the hubvoteWeightWindowLength
u64 - specifies the length of the checkpoint window in seconds in which the minimum voting weight is taken. The window ends at the vote start for a proposal and begins at the vote start minus the vote weight window. The vote weight window helps solve problems such as manipulating votes in a chainvotingTokenMint
Pubkey - the mint address of the token used for votinggovernanceAuthority
Pubkey - the account's public key with the authority to govern the staking system. ThegovernanceAuthority
should not be the default Pubkey, as this would indicate an uninitialized or incorrectly configured setupvestingAdmin
Pubkey - the account's public key for managing vesting operations. ThevestingAdmin
should not be the default Pubkey, as this would indicate an uninitialized or incorrectly configured setuphubDispatcher
Pubkey - the Solana public key derived from an Ethereum address on the hub chain that dispatches messages to the spoke chains. This is crucial for ensuring that only authorized messages from the hub are executed on the spoke