Skip to content
SolRengine
Case study

Voting — on-chain voting where Solana is the database

A community voting dApp where every vote lives on-chain and Rails stores no votes at all. Polls, candidates, and tallies are PDA accounts read straight from Solana.

auth rpc programs tokens devnet
Live demo View source
voting.solrengine.org
Voting — on-chain voting where Solana is the database screenshot

Voting is a community poll dApp built on a simple, strict premise: Rails is the view layer, Solana is the database. No vote is ever stored in the Rails DB. Polls, candidates, and tallies are all PDA accounts on-chain; Rails reads them, renders them, and prepares unsigned instructions — but the chain is the single source of truth.

It was built for Solana Bootcamp 2026 and has its own deep-dive writeup: Voting on Solana, built with Rails →. This page is the short version.

What it does

The “Solana is the database” architecture

How a vote happens

1. POST /poll/vote with a candidate name
2. Rails builds a vote instruction — solrengine-programs derives both PDAs from the IDL seed specs
3. It fetches a fresh blockhash (20s cache) and returns JSON:
   { program_id, accounts, instruction_data (base64), blockhash, last_valid_block_height }
4. The browser signs via @solrengine/wallet-utils and sends to a devnet RPC
5. A Stimulus state machine polls /poll/confirm/:signature until confirmed
6. The validator has already incremented the candidate's on-chain vote count

Server-side, prepare_vote validates the candidate against the YAML allow-list, enforces a 32-byte cap, and checks the poll is open — so the unsigned instruction Rails hands back is always well-formed and authorized.

The SolRengine gems behind it

It also uses solrengine-ui for the interface components.

Try it

← All showcases Build your own →