Building Governance Tools
This guide is for developers building governance dashboards, voting interfaces, or indexers on top of the ELA main chain. You'll use the JSON-RPC interface (port 20336 on mainnet) for all queries and transaction submission.
Prerequisites: A running ELA node or access to a public RPC endpoint. See Network Endpoints for URLs.
Querying DAO State
Council Members
// List all candidates
{ "method": "listcrcandidates", "params": { "start": 0, "limit": 25, "state": "all" } }
// List seated council members
{ "method": "listcurrentcrs", "params": { "start": 0, "limit": 25 } }
// List next term's council members
{ "method": "listnextcrs", "params": {} }
// Get current governance stage (voting period, committee state, next election height)
{ "method": "getcrrelatedstage", "params": {} }
Proposals
// List proposal states
{ "method": "listcrproposalbasestate", "params": { "start": 0, "limit": 25, "state": "all" } }
// Get specific proposal details (status, budgets, vote results, tracking)
{ "method": "getcrproposalstate", "params": { "proposalhash": "abc123..." } }
// Get proposal draft document
{ "method": "getproposaldraftdata", "params": { "drafthash": "abc123..." } }
// Get available DAO funds
{ "method": "getcommitteecanuseamount", "params": {} }
BPoS Validators
// List all validators
{ "method": "listproducers", "params": { "start": 0, "limit": 100, "state": "all" } }
// Get current validator set (active, candidates, on-duty)
{ "method": "getarbitersinfo", "params": {} }
// Get voting status for an address
{ "method": "votestatus", "params": { "address": "EXxxxx..." } }
// Get producer deposit
{ "method": "getdepositcoin", "params": { "ownerpublickey": "03abc..." } }
// Get council member deposit
{ "method": "getcrdepositcoin", "params": { "id": "icJ4z2..." } }
BPoS Staking
// Detailed v2 vote info
{ "method": "getalldetaileddposv2votes", "params": { "address": "EXxxxx..." } }
// Get voter's rights
{ "method": "getvoterights", "params": { "address": "EXxxxx..." } }
// BPoS voter reward info
{ "method": "dposv2rewardinfo", "params": { "address": "EXxxxx..." } }
Submitting Transactions
// Broadcast a signed transaction
{ "method": "sendrawtransaction", "params": { "data": "<hex-encoded-signed-tx>" } }
// Build an unsigned transaction
{ "method": "createrawtransaction", "params": {
"inputs": [{ "txid": "abc...", "vout": 0 }],
"outputs": [{ "address": "EXxxxx...", "amount": "1.0" }]
} }
// Sign a transaction
{ "method": "signrawtransactionwithkey", "params": {
"data": "<hex-unsigned-tx>",
"codes": ["<hex-redeem-script>"],
"privkeys": ["<private-key>"]
} }
Transaction Structure
Every ELA governance transaction follows this format:
| Field | Type | Description |
|---|---|---|
| Version | uint8 | Transaction format version |
| TxType | uint8 | Type code (0x21, 0x25, etc.) |
| PayloadVersion | uint8 | Payload format version |
| Payload | bytes | Type-specific payload (serialized) |
| Inputs | []Input | UTXO inputs (for fees) |
| Outputs | []Output | UTXO outputs |
| Programs | []Program | Signature scripts |
Building a Council Vote Transaction
- Query UTXOs:
listunspent { "addresses": ["EXxxxx..."] } - Construct a
TransferAsset(type0x02) with anOTVoteoutput - Set
VoteTypetoCRC(0x02) and list candidates with vote amounts - Sign with your P-256 private key
- Broadcast:
sendrawtransaction { "data": "<hex>" }
Key Constants
| Constant | Value |
|---|---|
| ELA Asset ID | a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0 |
| 1 ELA | 100,000,000 sela |
| Main chain signatures | P-256 curve |
| ESC/EID signatures | secp256k1 |
Indexing Governance Data
For historical governance data, the Elastos.ORG.API.Misc service provides a blockchain indexer:
| Endpoint | Purpose |
|---|---|
/api/1/history/{addr} | Transaction history for an address |
/api/1/dpos/producer/{producer}/{height} | Producer stats at a given height |
/api/1/dpos/address/{address} | Voter stats for an address |
/api/1/dpos/rank/height/{height} | Producer rankings at a height |
/api/1/dpos/vote/height/{height} | Total votes at a height |
Monitoring
The Elastos.ELA.Monitor (Python) provides alerting scripts:
| Script | Monitors |
|---|---|
warn_node_height.py | Block height stalls |
warn_producer_state.py | Producer becomes inactive/illegal |
warn_onduty.py | Validator duty rotation issues |
warn_tx_pool.py | Transaction pool overflow |
SDKs and Libraries
| Language | Component | Repository |
|---|---|---|
| Go | Main chain node | elastos/Elastos.ELA |
| TypeScript | Election service | elastos/Elastos.Service.Election |
| TypeScript | Governance portal | CyberRepublic/CyberRepublic |
| Solidity | Staking NFTs (ESC) | elastos/Elastos.ELA.StakeTicket.Solidity |
| Python | Node monitoring | elastos/Elastos.ELA.Monitor |
| Go | Blockchain indexer | elastos/Elastos.ORG.API.Misc |