This repository contains Solana Anchor program that is deployed on Solana blockchain. It allows to request signatures from SigNet MPC network.
- Node.js v16+ and npm
- Rust and Cargo
- Solana CLI v2.0.0+
- Anchor Framework v0.29.0+
- Solana wallet with testnet SOL
- Responder private key
-
Clone the repository
git clone https://github.com/sig-net/signet-solana-program.git cd signet-solana-program -
Install project dependencies
# Client dependencies cd clients/deploy-client yarn cd ../request-client yarn cd ../response-server yarn
-
Build the Solana program
# Build the smart contract anchor build # Get the Program ID solana address -k target/deploy/chain_signatures-keypair.json
-
Update Program ID
Update the Program ID in the following files:
programs/signet/src/lib.rs(indeclare_id!macro)Anchor.toml(under[programs.testnet])
After updating the Program ID, build the contract again
anchor build
-
Create a .env file in the project root
# Solana Configuration RPC_URL=https://api.devnet.solana.com KEYPAIR_PATH=~/.config/solana/id.json # Ethereum Signing Keys MPC_ROOT_KEY=0x... # Your Responder root private key # For client verification RESPONDER_BASE_PUBLIC_KEY=0x... # Uncompressed (0x04...) public key -
Prepare your Solana wallet
# Set the Solana RPC URL solana config set --url https://api.devnet.solana.com # Check if you have a Solana keypair solana address # If not, create one solana-keygen new # Fund your wallet with testnet SOL solana airdrop 2
# Deploy the program with your specified Program ID
solana program deploy --program-id <YOUR_PROGRAM_ID> target/deploy/chain_signatures.so
# Initialize the program state
cd clients/deploy-client
npx ts-node deploy.ts# In a new terminal window
cd clients/response-server
npx ts-node sig-server.tsThe responder will start listening for signature requests on the Solana blockchain and automatically respond using your Responder private key.
# In a new terminal window
cd clients/request-client
npx ts-node sig-client.tsThe project includes tests for all program functionality including configuration, signature requests, CPI calls, and error handling.
-
Environment Setup
- Ensure you have the
.envfile configured (see Configuration section above) - Node.js dependencies installed (
yarn installin the signet-program directory) - Anchor framework installed
- Ensure you have the
-
Required Environment Variables
# In your .env file at project root MPC_ROOT_KEY=0x... # Your mock signer root private key RESPONDER_BASE_PUBLIC_KEY=0x... # Corresponding public key KEYPAIR_PATH=~/.config/solana/id.json
cd signet-program
anchor testThis command will:
- Start a local Solana test validator
- Deploy the program to the test network
- Run all test suites
- Clean up automatically