# Uniqueness Via Linked List ## Metadata **Status**:: #x **Zettel**:: #zettel/literature **Created**:: [[2023-10-28]] **Tags**:: #blockchain #utxo ## Synopsis Consider this distributed app scenario that users can claim a unique number without permissions. The most strait-forward solution is adopting a central registry to record which numbers have already been claimed. The problem of this solution is also clear: the central registry becomes the bottleneck of the system. All the claims must be queued to access and update the central registry. A remedy is splitting the registry into partitions. However, it's hard to find a strategy which splits load to partitions evenly. One of the extream is storing each number in its own registry, but it will cost a lot of resources, if not impossible. Linked List is a smart solution to this problem. I learned from an amazing dApp project. The core idea is using a linked list to store the claimed numbers. The list node contains the number, and links to the previous and next node in the list. Nodes are sorted by the number. The following is an example of the list containing only one number 1, where each line is a node, and V, N, P indicates the number value, the next node, and the previous node respectively. ``` V=1,N=1,P=1 ``` This is another example of 3 numbers 1, 9, 10 ``` V=1,N=9,P=10 V=9,N=10,P=1 V=10,N=1,P=9 ``` To insert a new node into the list, we must find the previous and the next node first. It's easy to check that the two nodes are linked directly so there's no claimed numbers in these two nodes, which guarantees the uniqueness.