SNS Canisters
Service Nervous Systems (SNS) are algorithmic DAOs that enable decentralized governance of dapps on the Internet Computer. An SNS consists of multiple canisters working together to provide governance, token management, and decentralization.Overview
An SNS deployment includes:- Governance Canister: Manages proposals, neurons, and voting
- Ledger Canister: ICRC-1 token ledger for the SNS token
- Root Canister: Orchestrates upgrades and canister management
- Swap Canister: Conducts decentralization swap to distribute tokens
- Index Canister: Indexes token transactions for efficient queries
- Archive Canisters: Store historical transaction data
SNS Governance Canister
The SNS Governance canister is similar to NNS Governance but customized for individual DAOs.Core Features
- Neuron management with staking and voting
- Proposal submission and voting
- Configurable governance parameters
- Voting rewards distribution
- Treasury management
- Automatic SNS upgrades
Key Methods
manage_neuron
Manage an SNS neuron.The neuron’s subaccount (32 bytes)
The operation to perform:
Split: Split neuron into twoFollow: Set followees on a functionSetFollowing: Set multiple followeesDisburseMaturity: Convert maturity to tokensClaimOrRefresh: Claim or refresh neuronConfigure: Change neuron settingsRegisterVote: Vote on proposalMakeProposal: Submit proposalStakeMaturity: Stake maturity for voting powerAddNeuronPermissions: Grant permissions to principalsRemoveNeuronPermissions: Revoke permissionsMergeMaturity: Merge maturity into stakeDisburse: Withdraw tokens
Result of the command execution
list_neurons
Query neurons in the SNS.Filter neurons by principal (controller or with permissions)
Maximum neurons to return
Starting neuron ID for pagination
List of neurons matching the filters
list_proposals
Query proposals with filters.Maximum proposals to return
Return proposals before this ID
Exclude proposals of these function IDs
Filter by status: 1=Open, 2=Rejected, 3=Adopted, 4=Executed, 5=Failed
Filter by reward eligibility
Filter by proposal topics
List of proposals matching filters
Whether ballots by caller are included
get_proposal
Get details of a specific proposal.The proposal ID to query
Proposal: Full proposal dataError: Error if not found
get_nervous_system_parameters
Get current governance parameters.Current governance configuration including:
- Neuron minimum stake
- Dissolve delay limits
- Voting period durations
- Proposal rejection costs
- Voting rewards parameters
- Max number of neurons
get_metadata
Get SNS metadata.Project URL
Logo image (base64 or URL)
SNS name
SNS description
list_nervous_system_functions
List all available proposal functions.List of native and custom proposal functions
Reserved function IDs
get_metrics
Get governance metrics.Time window for recent metrics
Comprehensive metrics including:
- Number of recent proposals
- Treasury balances
- Total voting power
- Neuron statistics
SNS Proposal Actions
SNS proposals can execute various actions: Native Actions:ManageNervousSystemParameters: Update governance parametersAddGenericNervousSystemFunction: Add custom proposal functionRemoveGenericNervousSystemFunction: Remove custom functionUpgradeSnsToNextVersion: Upgrade SNS canistersRegisterDappCanisters: Register dapp canistersDeregisterDappCanisters: Deregister dapp canistersTransferSnsTreasuryFunds: Transfer from treasuryUpgradeSnsControlledCanister: Upgrade dapp canisterManageDappCanisterSettings: Update dapp settingsMintSnsTokens: Mint new tokensManageSnsMetadata: Update SNS metadataManageLedgerParameters: Update ledger parametersMotion: Non-executable text proposal
SNS Neuron Structure
Unique neuron identifier (blob/subaccount)
List of principals with their permission types:
- Vote: Can vote on proposals
- Submit proposals: Can submit proposals
- Manage principals: Can add/remove permissions
- Manage voting permission: Can grant/revoke vote permission
- Disburse: Can disburse neuron
- Split: Can split neuron
- Merge maturity: Can merge maturity
- Disburse maturity: Can disburse maturity
- Stake maturity: Can stake maturity
- Change auto-stake: Can change auto-stake setting
Staked token amount in e8s
Accumulated maturity from voting rewards
Maturity that has been staked
Accumulated fees
DissolveDelaySeconds: Not dissolvingWhenDissolvedTimestampSeconds: Dissolving
When neuron started aging
Voting power multiplier (100 = 1x)
Vesting period for swap neurons
Map of function ID to followees
Pending maturity disbursements (7 day delay)
SNS Topics
Proposals are categorized by topic:- Governance: Governance upgrades
- SnsFrameworkManagement: SNS framework changes
- DappCanisterManagement: Dapp canister operations
- ApplicationBusinessLogic: Custom business logic
- DaoCommunitySettings: Community settings
- TreasuryAssetManagement: Treasury operations
- CriticalDappOperations: Critical dapp operations
SNS Swap Canister
The Swap canister conducts the decentralization sale to distribute SNS tokens to participants.Swap Lifecycle
- Pending: Swap is created but not yet open
- Open: Accepting ICP contributions
- Committed: Swap succeeded, finalizing
- Aborted: Swap failed, refunding participants
Key Methods
get_state
Get comprehensive swap state.Complete swap state including:
- Lifecycle state
- Parameters (min/max ICP, duration, etc.)
- Current participation amounts
- Buyer states
- Neuron recipes
Derived information:
- SNS tokens per ICP
- Total ICP raised
- Participant counts
- Direct vs Neurons’ Fund participation
get_buyer_state
Get participation info for a buyer.The participant’s principal
- Amount of ICP contributed
- Whether neuron recipes were created
new_sale_ticket
Create a participation ticket (before sending ICP).Amount of ICP to contribute in e8s
Subaccount for contribution
Ok: Ticket with transfer instructionsErr: Error with invalid amount or existing ticket
get_sale_parameters
Get swap parameters.Swap parameters:
min_participants: Minimum participant countmin_icp_e8s: Minimum total ICPmax_icp_e8s: Maximum total ICPmin_participant_icp_e8s: Min per participantmax_participant_icp_e8s: Max per participantswap_due_timestamp_seconds: Swap deadlinesns_token_e8s: SNS tokens for saleneuron_basket_construction_parameters: Neuron creation settings- Neurons’ Fund participation parameters
get_derived_state
Get derived swap statistics.Total ICP contributed
Exchange rate (SNS tokens per ICP)
Number of direct participants
ICP from direct participants
ICP from Neurons’ Fund
Number of Neurons’ Fund participants
refresh_buyer_tokens
Trigger token distribution to a participant (after swap commitment).Participant principal as text
Result of token refresh operation
list_direct_participants
List direct swap participants.Max participants to return
Pagination offset
List of participants with their contributions
Swap Participation Flow
- Call
new_sale_ticketto get participation instructions - Transfer ICP to the specified subaccount on ICP ledger
- Swap automatically detects the transfer
- When swap commits, neurons are created automatically
- Call
refresh_buyer_tokensif needed to claim neurons
SNS Root Canister
The Root canister manages the SNS canisters and coordinates upgrades.Key Methods
list_sns_canisters
Get all SNS canister IDs.Root canister ID
Governance canister ID
Ledger canister ID
Swap canister ID
Index canister ID
Registered dapp canister IDs
Archive canister IDs
Extension canister IDs (if any)
get_sns_canisters_summary
Get status of all SNS canisters.Whether to refresh the canister list first
Root canister status
Governance canister status
Ledger canister status
Swap canister status
Index canister status
Dapp canister statuses
Archive canister statuses
- Canister ID
- Status (running, stopping, stopped)
- Memory size
- Cycles balance
- Controller principals
- Module hash
register_dapp_canisters
Register dapp canisters with the SNS (called via governance proposal).Dapp canister IDs to register
set_dapp_controllers
Update dapp canister controllers (called via governance proposal).Dapp canisters to update
New controller principals
List of canisters that failed to update
SNS Deployment Architecture
Canister Roles
Governance Canister- Controls the Root canister
- Manages proposals and voting
- Holds treasury funds
- Executes approved proposals
- Controls Ledger, Swap, and dapp canisters
- Coordinates SNS upgrades
- Manages dapp canister registration
- Controlled by Root
- Implements ICRC-1/ICRC-2 standards
- Manages SNS token transfers
- Controlled by NNS (during swap), then Root
- Conducts decentralization sale
- Creates initial neurons
- Controlled by Root (after decentralization)
- The actual application canisters
- Upgradeable via governance proposals
Treasury Management
SNS Governance can manage multiple treasuries: SNS Treasury (Treasury 1)- Holds SNS tokens
- Funded from swap or minting
- Controlled by governance
- Can hold ICP tokens
- For diversification or operations
- Requires manual setup
TransferSnsTreasuryFunds proposal action.
Best Practices
For SNS DAO Members
- Participate in Governance: Regularly vote or set followees
- Understand Parameters: Review nervous system parameters
- Monitor Proposals: Check proposals before voting deadline
- Manage Neurons: Optimize dissolve delay for voting power
- Use Maturity: Decide whether to stake, disburse, or merge maturity
For SNS Developers
- Proposal Design: Design clear, atomic proposals
- Custom Functions: Define custom proposal functions for dapp operations
- Test Thoroughly: Test proposals in testnet before mainnet
- Monitor Metrics: Track governance metrics and participation
- Upgrade Planning: Follow SNS upgrade procedures carefully
For Swap Participants
- Verify Parameters: Check min/max ICP, token amount, duration
- Use Tickets: Always use
new_sale_ticketbefore transferring - Transfer Quickly: Complete transfer before ticket expires
- Save Receipts: Keep block indices of ICP transfers
- Claim Neurons: Call
refresh_buyer_tokensif neurons don’t appear