The implementation of this design creates blocks that are then stored in the Blockchain. Each block contains data, including the index of the block, the timestamp of when the block is created, the difficulty, the hash of the previous block, a set of 40 votes (with the corresponding user’s ID), voting results for each candidate, the nonce for which the hash satisfies the difficulty, and the hash of the block. Figure 8 show a sample of two blocks in the blockchain memory. For this example, 40 votes are recorded in each block and the hash is generated using a difficulty of 12 (seen as 0000000c in the figure). The difficulty is satisfied using the nonce values stored in the different blocks. It can be seen that the hash of the first block is the previous hash of the second block, which creates the chain in the blockchain.
The tested hardware design collects 40 votes, unless it reaches a timeout first, and generates a block of the votes with the results. Then, a new set of votes are collected and the blockchain grows. In our design, the Zedboard also shows the progress of the voting. The LEDs show the candidate number of the candidate that is in the lead, which is based on the results calculated. In case of a draw, the every other LED is lit. The left-most LED is used to indicate if the system is ready to receive votes or not. When it is on, it is in the Data Validation state, which collects votes, and after the before-mentioned timeout, or 40 votes, the LED turns off, indicating that the system is computing the hash. Once the hash is computed, the block in the chain is complete and will return back to collecting new data.
In hardware, the design was tested with various difficulties to observe the differences in computing times. A difficulty of 8 has such a fast computation rate that it is not observable with the LEDs indicating the process. Increasing the difficulty level will, obviously, increase the computation time as well. When the difficulty level is raised to 20, it takes about 2 second to generate a block, while with a difficulty of 24, the computation rate changes to about 2 minutes per block. Systems with high computational power will have a higher computation rate, which is why a Zedboard was used for this project.