Writing the voting smart contract
The application you’re going to build is a voting application. Users will vote for some proposals. In this example, you can imagine students choosing where to have a study tour for their class. Do they choose to spend it on a beach or a mountain?
You’ll build the voting decentralized application using the Ape framework that you learned in the previous chapter. So, the flow of the development should be familiar to you.
First, create a Python virtual environment:
$ python3.10 -m venv .venv $ source .venv/bin/activate $ (.venv) $ pip install --upgrade pip
Then you can install the Ape Framework:
(.venv) $ pip install eth-ape'[recommended-plugins]'==0.7.23
After installing the framework, you can start developing the application by creating the directory for the voting application:
(.venv) $ mkdir voting_app (.venv) $ cd voting_app
Inside the directory, you should initialize the project using the ape
command: