Developing a token-based voting application

Now, let's develop a token-based voting application on the blockchain. What I mean by token-based voting is that in order to vote, you must have a token that is created in the smart contract. If you vote with this token, then the token is burnt, meaning that you cannot vote twice. In this smart contract, the number of tokens are also limited, unlike previous voting applications where unlimited accounts can vote. Let's write a smart contract in the contracts directory and name the file TokenBasedVoting.vy. Refer to the code file in the following GitLab link for the full code: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_06/voting_project/contracts/TokenBasedVoting.vy ...

Get Hands-On Blockchain for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.