Architecture advice for an ERC721 Election Dapp on Permissioned Ethereum Blockchain?

Hi Everyone,

I’m working on an election using ERC721 tokens on a permissioned Ethereuem network. The idea is to associate some basic information with each token like sex, school, and year(aka grade) without any specifically identifying information like name. Then the voters vote for candidates by transferring their tokens to the addresses of the candidates.

I would create the accounts for the voters prior to the election using a list from the organization using web3.js. The voters would then use existing usernames and passwords to access their votes through the planned dapp. I’m also going to need the app to act as a wallet as I don’t want people to have to install Metamask (again, using web3.js).

As there are going to be multiple offices to vote for, each voter will require several ERC721 tokens with their specific information (sex, school, year) in their account. Is there a fast way to populate these accounts with these tokens (before or after the constructor function)? Or am I going to have to run a lot of transactions to mint all of the required tokens individually?

Anyone have any advice or suggestions for the architecture of such an app?

I would appreciate any comments. Cheers.


1 Like

Hi @cjd9s,

Some general comments.

In your proposed solution, voting would not be anonymous, as assuming whoever runs the system could map existing usernames to address and then who they voted for.

One way to address this would be to decouple addresses from usernames. You could create accounts and issue tokens, and then give each voter a printout with a QR code (either with a code to unlock a smart contract wallet or a private key) that they could scan into their app/dapp.

I’m not sure why you need basic information in the token, especially gender. This could be identifying. If voting is not anonymous then voters would be cautious about how and if they voted.

Instead you could have a type of vote, e.g. each voter gets a vote for president, and a vote for vice president and they can only be transferred to a registered candidate for that office.

Assuming votes for a particular office are fungible, then you could use an ERC1155 token. You could create votes for each office. ERC1155 also has batch minting.

In any event, you will have a lot of transactions to setup the accounts with votes.

Stepping back even further,

You could look at using a public blockchain (if you didn’t have any identifying information or attach identity to votes). Whilst cost wouldn’t be feasible on mainnet (unless using a Layer 2 solution), you could use a Proof of Authority sidechain such as xDAI ( where transactions are fast and low cost. You could even use a public testnet such as Goerli. This would save you from having to run the blockchain infrastructure and you would have tech that you could use such as blockchain explorers.

I’d also suggest looking at burner wallets for anonymized account setup and for your app. They are generally simple for users. (if you visit this will setup a burner wallet in your browser).
I don’t know if anyone has done a voting app/module yet.

I’d also look look at what Austin Griffith is doing in general and specifically with voting:

Stepping out even further. Why use blockchain technology, how does it improve the current process?

Vote counting is much simpler and faster with blockchain.
There is potential (depending on implementation) that votes aren’t anonymous, which could influence how voters vote (or if they vote at all) for fear of some sort of penalty.
Printed ballots and pencil are simple technology unlikely to have issues. Apps and blockchain could have technical issues impacting voting.

Are you doing this as a project for school or a hackathon, or is this a side project?

Welcome again to the community.

Hi again Andrew,

And again, thanks for your response. And for welcoming me to the community.

Yes, it’s true that the original concept was not anonymous. However, I couldn’t think of any way to safely not link the address with the voter. For example, I thought about allowing voters to create their own addresses, but then I wouldn’t be able to verify that the addresses were registered valid voters. So, I resigned myself to centralized access to the identity of voters. Of course, all of my thoughts were how to do it electronically and I didn’t consider an offline solution like a physical QR code. I can imagine a scenario where we mail out the randomized QR codes or run a desk where people come to pick up their QR codes (or both).

The idea of containing voter information in the vote was to be able to extrapolate statistics about the election after the fact. So, for example, 80% of women voted for candidate X. Or, knowing how many votes were issued to group Y, only 10% of group Y participated in the election. As I originally thought that I couldn’t avoid centralized access to voter identity, I thought that as long I didn’t make the details too specific, it would be OK. Now, with your QR code idea, I’ll make this a fully anonymous voting app.

I like your idea of vote types and, as votes for a particular office are fungible, I think I’ll use ERC1155. I’ve scanned through it and it seems to be a good fit, particularly the batch mint function. I’ll still need a batch mint transaction for every voter, but that’s doable.

As for using a public POA sidechain or testnet, I might have to do that. I’m going to crack on with this project and see how fast I can move. I actually have an ulterior motive for wanting to use a permissioned blockchain. There is potential for other projects at this entity. If I have already created and am helping to maintain a permissioned blockchain for them (admittedly with only an election factory application), then hopefully I will be awarded that contract.

I’ll take a look at burner wallets. Sounds helpful.

I’ll take a look at what Austin Griffith is doing.

The current process is paper ballots and an in-person election. There is a sizable voting population that is unable to participate because it’s in-person. Also, they hire a few people to help with elections who wouldn’t be needed with a digital election app.

Although this app could be done without blockchain, the immutability and public accessibility of the blockchain will offer confidence in the results. Voters will be able to publicly view their vote on the blockchain and be satisfied that their vote has been properly recorded and counted as part of final result.

The ulterior motive here is that this is portfolio project (albeit with a real entity) and an avenue to really get better acquainted with Solidity, web3.js, and blockchain infrastructure. And, as I mentioned earlier, to set up for future projects with this entity and others.

Thanks again for the invaluable advice. If you have more advice, I’d love to hear it and keep this conversation going. Cheers.

Your biggest fan,

1 Like