Understanding Polkadot's On-Chain Governance System
Polkadot features a sophisticated on-chain governance system that allows token holders to propose and vote on changes to the protocol. This system ensures that the network can evolve and adapt without requiring hard forks.
Polkadot uses OpenGov, a more flexible and efficient governance system that replaced the original governance model:
OpenGov uses different tracks for different types of proposals, each with its own requirements and timelines:
For the most critical changes that require the highest level of approval.
For treasury proposals and spending decisions.
For whitelisting certain operations or addresses.
Polkadot's voting system includes several innovative features:
Let's explore how to interact with Polkadot's governance system:
// Governance operations with Polkadot.js API
import { ApiPromise, WsProvider } from '@polkadot/api';
const api = await ApiPromise.create({ provider: new WsProvider('wss://rpc.polkadot.io') });
// 1. Submit a proposal
const proposal = api.tx.system.remark('Hello, Polkadot!');
const proposalTx = api.tx.referenda.submit(
{ Origins: 'Root' }, // track
{ Lookup: { Hash: proposal.hash, len: proposal.length } }, // proposal
{ After: 100 } // enactment delay
);
// 2. Vote on a referendum
const voteTx = api.tx.convictionVoting.vote(
0, // referendum index
{
Standard: {
vote: { aye: true, conviction: 'Locked1x' },
balance: 1000000000000
}
}
);
// 3. Delegate voting power
const delegateTx = api.tx.convictionVoting.delegate(
{ Origins: 'Root' }, // track
'5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', // delegate
'Locked1x', // conviction
1000000000000 // balance
);
// 4. Undelegate voting power
const undelegateTx = api.tx.convictionVoting.undelegate({ Origins: 'Root' });
// 5. Get referendum information
const referendumInfo = await api.query.referenda.referendumInfoFor(0);
console.log('Referendum info:', referendumInfo.toHuman());While OpenGov is the primary governance mechanism, Polkadot also has specialized bodies:
Elected body that represents passive stakeholders and can propose referenda.
Technical experts who can fast-track emergency proposals.
The treasury is a key component of Polkadot's governance system:
// Treasury operations
// 1. Propose treasury spending
const treasuryProposal = api.tx.treasury.proposeSpend(
1000000000000, // amount
'5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' // beneficiary
);
// 2. Approve treasury proposal
const approveTx = api.tx.treasury.approveProposal(0);
// 3. Reject treasury proposal
const rejectTx = api.tx.treasury.rejectProposal(0);
// 4. Get treasury information
const treasuryBalance = await api.query.treasury.proposalCount();
const treasuryInfo = await api.query.treasury.proposals(0);
console.log('Treasury balance:', treasuryBalance.toString());
console.log('Treasury proposal:', treasuryInfo.toHuman());In this chapter, we've explored Polkadot's governance system:
In the next chapter, we'll explore parachains and XCM, learning how different blockchains can communicate and interoperate within the Polkadot ecosystem.