We use cookies to provide the best site experience
Okay

Algorithm design

Economist, scientific Director of the graduate FINTECH, Director of research Thalamus Lab, Ranepa
Chapter 3. Blockchains and DLT algorithm design
Alexander Didenko
In this short long read you will learn about Big O notation, P/NP completeness and different approaches to designing algorithms as well as study applications of algorithm design heuristics in blockchains and distributed ledgers field.
More formally:
Let two functions be given f(n) и g(n) with a natural argument n whose values are positive real numbers. They say that f = O(g) («f grows not faster than g»), if a constant c > 0 exists so that f(n) ≤c *g(n) for all natural n. The notation f = O(g) can be read as «f ≤ g accurate to a constant». Similarly, there are analogs for "≥" and "=" : f = Ω(g) (f grows no slower than g, up to a constant) means g = O (f); f = Θ (g) (f and g have the same growth order) means that f = O(g) and g = O(f).
«Big O» in blockchains
«Big O» notation is ubiquitous in the literature and general communications about blockchains as well as in general computer science. For example, Kiayias et al. (2016) develops new, more efficient algorithm for «proving PoW» in Bitcoin; here and here «Big O» notation is used to discuss scaling Bitcoin transaction volume; here time complexity of Paxos vs. PoW is discussed; and here time complexity of cryptographic functions is described. It relates to the basic grammar of computer science.
Complexity classes
Another important concept, which often is mentioned when computational hardness is discussed in the context of blockchains, is P/NP problems. Good introduction to the topic is on the Wikipedia; here NP-completeness of hash functions is discussed, and in this blog post the author describes importance of «P vs. NP» for PoW consensus sustainability. NP-hardness is the key concept to understand modern PoW algorithms: see, for example, Loe & Quaglia (2018) short research paper or read the whole dissertation; or Ding (2019). If you need more information on «P vs. NP», you definitely need to refer to one of the most influential books in computer science.
Euler diagrams showing mutual relation of complexity classes. P problems are solvable in polynomial time; NP problems might be solvable in polynomial time and are checkable in polynomial time. NP-complete problems are NP problems so that finding a solution to them would let you solve every NP problem. NP-hard problems are problems at least as complex as the NP-complete problems.

Algorithm design techniques

First of all, there is absolutely awesome resource to learn in details and experiment with these and many other algorithms. Then, as usual, several links extending what was mentioned in the video:
ASIC-resistant Scrypt algorithm
Techniques to reduce transaction fees
New coin selection algorithm of Bitcoin
'PHANTOM/GHOSTDAG' blockchain protocol
“There is a small problem with the protocol I have just described: we have this step of finding the maximal k-cluster in the DAG, which is a NP-hard problem. If you know computer science, that is not a good idea for a protocol, you would have to run in exponential time to find the set that is the best. So our solution is GHOSTDAG. The solution is to use a greedy algorithm to get a large k-cluster."
Guy Corem, computer scientist, co-creator of GHOSTDAG protocol
Additional materials
Made on
Tilda