is there a way to do a notification system for initiated polls and finished polls? So we dont rely only on forum/telegram etc to spread the news about the poll. It could increase engagement and voting turnout
Thanks @lukaskywalker.chain this is a great idea, we will integrate events that can be listened for. A service for this will not be build in the first version, but will be enabled by this.
Unfortunately finished poll is not a metric we can deliver easily out of the smart contracts, but a secondary server can observe the contract and look out for those.
browser push notifications (example via third party services like https://onesignal.com/)
mobile push notifications
And maybe the Base wallet @stoyan.chain or AEXpansion team @emil and or middlware @jsnewby could think about a standard for this then different wallets, blockchain explorers etc. could use that standard to trigger mobile or browser push notifications etc.
@philipp.chain thanks for sharing! should the description include some points on how polls are created/added? from my perspective this is a very important part–understanding anyone could create a poll and the UI for doing so.
@emin.chain you mean a standard for broadcasting the poll announcement/duration/ending/results?
@stoyan.chain currently the description includes no implementation details, wireframes or UI proposals. This will be figured out as we go. With the current discussion we want to make sure the polling mechanics work as intended. Creating a poll will be a simple form available to any user.
I think @emin.chain was referring to a notification standard overall, where the discussion would be out of scope for this thread.
Hello @emin.chain, here you can find a first draft of the voting and delegation functionality, keep in mind this is nowhere near finality, lots of design changes will be made, caching and oder performance optimizations will have to be done as well as proper handling of errors and more testing.
Great work! I am eager to test this. Also, I am all for the notifications proposed by Emin above. This is essential for an engaged community. Would love to receive a notification in the Base aepp, but other options should be available too. Let’s first get the mechanics and UX/UI right
I do fully agree @drag0x. But we will need a fully trustless backend server as well. Some aggregations would be way to slow to be counted by every client. Imagine 1000 voters, having to check their balances would be 1000 requests to the node. Then voters may have delegations and delegations can be recursive, for each we will have to get balance at height to show a preliminary result.
The backend service will be able to be hosted and verified by anybody and only assists the voting experience with additional aggregated data and is not necessary for voting.
Maybe you can try to create a general API service that will serve such applications (dApp + frontend). Think about https://infura.io/ for Aeternity.
For example, if the logic how to calculate the final result will be implemented in the smart contract, it should be possible to call that entrypoint via general API to see what is the result at that moment. Similarly, you will have to just implement all the entrypoints that will be useful to expose all necessary data in the frontend app.
Recursive datatypes are not available in the sophia language right now. This is planned to be implemented after the next hardfork but is a limiting factor right now in discovery of delegation chains, as delegations can be done with recursion and thus will be great to be represented by a recursive datatypes. There are possible workarounds, but they would be very costly in gas and amount of code.
There is no Chain.balance(height) function in sophia, without this fetching stakes for past polls can’t be done in a trustless and reliable way within the smart contract. If we would have this feature in sophia it would be quite costly as well, as either all past account states would have to be persisted or will have to be recalculated for every call.
Some endpoints need lots of calls, as explained in a prior post. Imagine 1000 voters, having to check their balances would be 1000 requests to the node. Then voters may have delegations and delegations can be recursive, for each we will have to get balance at height to show a preliminary result.
Even if this would be possible to do without a backend it would lead to extensive load times when opening the aepp, in early testing over a minute for polls with > 50 participants.
All of these can easily be overcome by using a trustless backend server, that can be hosted and verified by anyone.
OK, not everything need to be implemented in a smart-contract especially if it will blow up complexity. But then I suggest to extract from the backend some essential logic as a separate library that implements that logic. Everybody will be able to clone it and run it on their own computer to verify polling results. I guess it can connects to any Aeternity node and then generates polling stats. Will it need any special middleware to be run on the node?
Yes this is the plan, the Backend will be mostly verification script and caching method. We will provide a way for anyone to verify the poll results just with access to a node.