| Crates.io | spherenet-authority |
| lib.rs | spherenet-authority |
| version | 0.1.0 |
| created_at | 2025-11-21 18:30:36.089697+00 |
| updated_at | 2025-11-21 18:30:36.089697+00 |
| description | Authority abstraction for single-sig and multisig execution on SphereNet |
| homepage | |
| repository | https://github.com/Sphere-Foundation/spherenet-authority |
| max_upload_size | |
| id | 1943924 |
| size | 216,394 |
Authority and governance primitives for SphereNet.
spherenet-authority provides a unified abstraction for executing privileged operations on SphereNet with different signing patterns:
This crate powers the governance capabilities of SphereNet's administrative tools, enabling decentralized control over validator whitelists, program deployments, and protocol upgrades.
The Authority enum provides a unified interface for single-sig and multi-sig execution:
use spherenet_authority::Authority;
// Single-sig: immediate execution
let authority = Authority::SingleSig {
keypair: read_keypair_file("./authority.json")?,
};
// Multi-sig: creates proposal for approval
let authority = Authority::MultiSig {
multisig: multisig_pda,
member: read_keypair_file("./member.json")?,
};
// Execute instruction:
// - Single-sig: executes immediately, returns signature
// - Multi-sig: creates proposal, returns proposal PDA and index
authority.execute_instruction(&rpc_client, instruction, "Description")?;
Provides complete multisig operations (create, approve, execute) plus manual instruction building due to SDK dependency conflicts. Includes correct SmallVec serialization (1-byte/2-byte length prefixes vs Borsh's 4-byte) and all PDA derivation helpers. Battle-tested in spherenet-admin.
use spherenet_authority::Authority;
use solana_sdk::instruction::Instruction;
// Build validator whitelist instruction
let ix = AddToWhitelistBuilder::new()
.payer(authority.instruction_authority_pubkey()?)
.whitelist_authority(authority.instruction_authority_pubkey()?)
.vote_account(validator_vote_account)
.start_epoch(100)
.end_epoch(200)
.instruction();
// Execute (single-sig or multi-sig, same interface!)
let result = authority.execute_instruction(
&rpc_client,
ix,
"Add validator to whitelist",
)?;
match result {
ExecutionResult::Executed { signature } => {
println!("✅ Validator added: {}", signature);
}
ExecutionResult::ProposalCreated { proposal, transaction_index } => {
println!("📝 Proposal created: {} (index: {})", proposal, transaction_index);
println!(" Waiting for approvals...");
}
}
SphereNet Testnet:
SqdsYSe3QC9aGdU5p8y7Y3HtT5VrVLEtYCNjN37yBThhttps://api.testnet.sphere.netSphereNet Mainnet: (when available)