Content pfp
Content
@
0 reply
0 recast
0 reaction

Noah Bragg šŸ”„ pfp
Noah Bragg šŸ”„
@nbragg
Solidity devs: How possible is it to store a large array to hold a leaderboard onchain? It would need to be updated as it changes and shifted around. My gut reaction as that this would be too expensive to make happen. Is on a layer2 at least. Or are there any better solutions?
7 replies
0 recast
5 reactions

Angel - Not A Bot pfp
Angel - Not A Bot
@sayangel
Do you want it on chain for composability or provenance? If just provenance Iā€™d say just update a hash of the leaderboard on chain. And lazy composability would then be to expose the leaderboard via oracle and verify against the hash.
1 reply
0 recast
3 reactions

Noah Bragg šŸ”„ pfp
Noah Bragg šŸ”„
@nbragg
Neither actually. Would want it onchain so that onchain logic changes based on your relation to other players on the leaderboard. "who are the 5 above you and 5 below you" Kind of thing.
1 reply
0 recast
1 reaction

iain pfp
iain
@iain
You probably can do something elegant with trees as a data structure. Have a simple linked list and then store the score + next highest and prev lowest with a lookup from user to node. Then you can go up and down to get above and below. Amending the tree can happen on the client side that says insert node here with an onchain variant check.
0 reply
0 recast
1 reaction