--- tags: bizz, pricing, voting --- # Voting price model Introducing the Vocdoni Election Pricing Formula To address the pricing requirements for creating elections on the Vocdoni blockchain, we have developed a dynamic pricing formula that takes into consideration the size and duration of the elections, capacity of the blockchain, and additional features such as encryption and anonymity. The formula is designed to be fair and accessible for various election sizes, ensuring that both small and large organizations can effectively use the platform. ``` price = basePrice + sizePrice + durationPrice + encryptedPrice + anonymousPrice + overwritePrice ``` **Where:** + basePrice: A constant value that represents the base price for creating an election. + sizePrice: A price component proportional to maxCensusSize. + durationPrice: A price component proportional to electionDuration and inversely proportional to maxCensusSize. + encryptedPrice: A price component based on the encryptedVotes flag. + anonymousPrice: A price component based on the anonymousVotes flag. + overwritePrice: A price component proportional to maxVoteOverwrite and maxCensusSize. ### components of the formula + basePrice = `b (a constant value)` + sizePrice = `k1 * maxCensusSize * (1 - (1/capacity)) * (1 + k6 * max(0, maxCensusSize - k7))` + durationPrice = `k2 * electionDuration * (1 + (maxCensusSize / capacity))` + encryptedPrice = `k3 * maxCensusSize * (1 if encryptedVotes else 0)` + anonymousPrice = `k4 * (1 if anonymousVotes else 0)` + overwritePrice = `k5 * maxCensusSize * maxVoteOverwrite / capacity` In the sizePrice component, the price will be lower when the capacity is high relative to capacity. In the durationPrice component, the price increases with electionDuration but also considers the relation between maxCensusSize and capacity. The higher the maxCensusSize relative to capacity, the more expensive the election will be, as it requires a larger portion of the available slots during the short duration. The encryptedPrice and anonymousPrice components simply add an extra cost if the election requires encryption or anonymity. These costs can be adjusted using the k3 and k4 constants. Finally, the overwritePrice component takes into account the impact of maxVoteOverwrite on the price, while also considering the maxCensusSize and capacity. The price increases with the number of allowed overwrites and the census size but is inversely proportional to the capacity. ### constant parameters + k1, k2, k3, k4, and k5 are constant factors that can be adjusted to influence the pricing of different components. + capacity is the maximum possible capacity that the blockchain can handle in votes per block. + k6: Price growth factor for election size + k7: The election size number that triggers the growth By adjusting the constant factors and the basePrice, you can create a "freemium" model where smaller elections are almost free, while medium and large elections are more expensive. Additionally, the capacity parameter can be used to influence the price, making elections less expensive as the capacity increases. This allows the system to adapt to changing demand and resources while still maintaining a reasonable pricing structure for different election sizes and requirements. #### Constant factors proposal k1 = 0.00006 # Size price factor k2 = 0.002 # Duration price factor k3 = 0.003 # Encrypted price factor k4 = 10 # Anonymous price factor k5 = 8 # maxVoteOverwrite multiplier factor k6 = 0.0008 # Non-linear growth factor k7 = 500 # MaxCensusSize non-linear trigger capacity=500 ## Capacity Capacity represents the current maximum number of votes the blockchain can handle at a given time (a block). It's a measure of the blockchain's ability to process and store votes for elections. The capacity variable is used in the price formula to ensure that the price is adjusted based on the blockchain's current resources and limitations. The rationale behind incorporating capacity into the formula is to reflect the actual system capabilities and prevent the overloading of the blockchain with an excessive number of votes. As the capacity of the blockchain increases or decreases, it directly affects the price of creating an election. When the blockchain has more capacity, the pricing formula will be more lenient, allowing for larger elections at lower costs. Conversely, when the capacity is lower, the price formula will adjust to discourage overly large elections that could strain the system's resources. ![](https://hackmd.io/_uploads/rJvx7gYeh.png) ## Max Census Size MaxCensusSize represents the maximum number of voters allowed in a specific election. It has a direct impact on the price of creating an election. Several components of the price formula are affected by maxCensusSize, including the size price component, the duration price component, and the overwrite price component. The growth factor of maxCensusSize in the election pricing formula refers to how the price of an election changes as the maximum number of voters increases. This factor determines whether the price of an election grows linearly or non-linearly with the number of voters. The growth factor is controlled by the constant factor k6. When k6 is set to a higher value, the price of an election increases more rapidly as the maximum number of voters grows beyond a certain threshold. This threshold is set by the constant factor k7, which determines the point at which the price growth becomes non-linear. The rationale behind a non-linear pricing model is to provide more affordable pricing for smaller elections, while ensuring that larger elections are priced to reflect their higher resource demands. ![](https://hackmd.io/_uploads/rJvK9lKxh.png) ## Election duration ElectionDuration represents the total length of time the election is active and open for voting. A longer election duration requires more resources to maintain and manage, such as storage, network bandwidth, and computational power, as the voting data needs to be processed and stored for an extended period. Consequently, the price formula takes the electionDuration into account to ensure that the costs associated with longer elections are accurately reflected in the price. In the price formula, the duration price component is directly proportional to the electionDuration and inversely proportional to the maximum number of votes (maxCensusSize). This means that the price increases when the election lasts longer, and if there are more votes in a shorter time, the price also increases to reflect the higher demand for resources. ![](https://hackmd.io/_uploads/BJ_4wgtl2.png) ## Vote Overwrite VoteOverwrite represents the maximum number of times a voter is allowed to overwrite their vote in a specific election. Allowing voters to overwrite their votes can increase the complexity of managing the election. As the number of allowed vote overwrites increases, the system has to manage more vote changes, which in turn requires more computational power, storage, and network bandwidth. In the price formula, the overwrite price component accounts for the additional resource consumption and complexity associated with vote overwrites. It is proportional to both the maxVoteOverwrite and the maximum number of votes allowed in the election (maxCensusSize). The formula also considers the blockchain's capacity to ensure the price reflects the current resource constraints. ![](https://hackmd.io/_uploads/rkZBLetlh.png) ### Python notebook https://colab.research.google.com/drive/19H7NXUSKf_riDL_yVtfh04WZXyNMSoqp?usp=sharing ```python # Import required libraries import numpy as np import matplotlib.pyplot as plt # Pricing Formula Components def calculate_price(basePrice, maxCensusSize, electionDuration, encryptedVotes, anonymousVotes, maxVoteOverwrite, capacity, k1, k2, k3, k4, k5, k6, k7): sizePrice = k1 * maxCensusSize * (1 - (1/capacity)) * (1 + k6 * max(0, maxCensusSize - k7)) durationPrice = k2 * electionDuration * 6 * 60 * (1 + (maxCensusSize / capacity)) encryptedPrice = k3 * maxCensusSize * (1 if encryptedVotes else 0) anonymousPrice = k4 * (1 if anonymousVotes else 0) overwritePrice = k5 * maxCensusSize * maxVoteOverwrite / capacity price = basePrice + sizePrice + durationPrice + encryptedPrice + anonymousPrice + overwritePrice return price # Parameters maxCensusSize_values = [100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000] electionDuration = 48 # hours encryptedVotes = True anonymousVotes = True maxVoteOverwrite = 1 basePrice = 1 capacity = 500 # Constant factors k1 = 0.002 k2 = 0.002 k3 = 0.005 k4 = 10 k5 = 3 # maxVoteOverwrite multiplier factor k6 = 0.0003 # Non-linear growth factor k7 = 500 # MaxCensusSize non-linear trigger # Calculate price for each maxCensusSize value price_values = [calculate_price(basePrice, maxCensusSize, electionDuration, encryptedVotes, anonymousVotes, maxVoteOverwrite, capacity, k1, k2, k3, k4, k5, k6, k7) for maxCensusSize in maxCensusSize_values] # Second chart values (modify these as needed) electionDuration_ = 48 # hours capacity_ = 2000 k1_ = 0.002 k2_ = 0.002 k3_ = 0.005 k4_ = 10 k5_ = 3 k6_ = 0.0003 k7_ = 500 price_values_alternative = [calculate_price(basePrice, maxCensusSize, electionDuration_, encryptedVotes, anonymousVotes, maxVoteOverwrite, capacity_, k1_, k2_, k3_, k4_, k5_, k6_, k7_) for maxCensusSize in maxCensusSize_values] # Plot the charts plt.figure(figsize=(12, 6)) plt.plot(maxCensusSize_values, price_values, marker='o', label='capacity 500') plt.plot(maxCensusSize_values, price_values_alternative, marker='o', color='orange', label='capacity 2000') plt.xlabel('Max Census Size') plt.ylabel('Price (in USD)') plt.title('Price vs Max Census Size') plt.legend() plt.grid() plt.show() ```