Build DAO Voting and RIF Utility on Rootstock with the Collective SDK
This guide is written for developers who want to move from reading SDK docs to building production dApps with staking, governance, and RIF utility.
Why Build Governance dApps?
Governance dApps fail when developers cannot connect business goals to chain actions. The Collective SDK solves that gap for Rootstock by exposing staking, proposals, backing, and holdings in one TypeScript package. You can ship participation flows fast, then expand into richer use cases.
For this guide, the target outcome is practical. A developer should be able to open a starter kit, connect a wallet, stake RIF, read active proposals, and cast a vote with simulation before write.
This is the core bridge between RIF utility and DAO activity.
What the Kit Covers
The starter kit is a working reference app. It covers governance participation and keeps complexity low.
Implemented now:
- Connect wallet with Wagmi and RainbowKit.
- Initialize
CollectiveSDKfor Rootstock Mainnet or Testnet. - Stake and unstake RIF.
- Fetch and display proposals.
- Vote with simulation before submit.
Not implemented in the sample UI:
- Proposal creation UI.
- Backing module UI.
- Rewards claim UI.
- Vault-specific flows.
Those are ideal "build next" paths for teams that need custom business logic.
Getting Started
-
Setup: Clone, environment variables,
npm install, andnpm run devlive in the rootstock-collective-starter-kit README (Setup). The Dev Portal does not copy those steps here. When the kit changes, update the README once and both the quick start and this guide stay accurate. -
Quick start: Use Collective DAO starter kit for links to the repo and a minimal run checklist.
-
Deep dive: Continue with About the SDK for how Collective SDK methods map to files in the kit, simulation, FAQs, and a production checklist.
About the SDK
The package is @rsksmart/collective-sdk. It exposes modules you can compose by use case.
sdk.stakingfor RIF to stRIF flows and voting power setup.sdk.proposalsfor reading proposals and casting votes.sdk.backingfor builder allocation workflows.sdk.holdingsfor balances, voting power, and rewards.
The starter kit demonstrates the first two modules directly in UI components. It also keeps contract addresses explicit in one file so teams can manage deployments safely.
// /src/constants/contracts.ts
// Override Collective contract addresses per Rootstock chain.
export const COLLECTIVE_CONTRACT_ADDRESSES = {
31: {
governor: "0x25b7eb94f76cc682a402da980e6599478a596379",
treasury: "0xc4dacee263b0d1f2a09006dbc0170a4fda861b68",
backersManager: "0xd520cb42c46115762c02e4340646c2051ca3406d",
builderRegistry: "0x5fc1dd934ef2e6b5c4a433a3ec0a1326834b0f42",
RIF: "0x19f64674D8a5b4e652319F5e239EFd3bc969a1FE",
stRIF: "0xe7039717c51c44652fb47be1794884a82634f08f",
USDRIF: "0x8dbf326e12a9fF37ED6DDF75adA548C2640A6482",
},
} as const
Core Implementation Flow
This section maps method calls to files within the kit so developers can navigate quickly.
1) Initialize SDK from wallet chain
Use the connected wallet chain. Do not hardcode one network in the hook.
// /src/hooks/useCollective.ts
// Create CollectiveSDK for chain 30 or 31 with explicit address overrides.
const sdk = new CollectiveSDK({
chainId,
rpcUrl,
contractAddresses,
})
What it does:
- File:
src/hooks/useCollective.ts - Method:
new CollectiveSDK({ chainId, rpcUrl, contractAddresses }) - Guardrails: return
isReady: falsewhen wallet is disconnected or chain is not Rootstock.