Threads
Deposit Threads
Threads are a core way of tracking money using the String Theory paradigm. Each piece of money that enters the system has a new thread attached to it which we call a deposit thread. You can use the thread to see where the money has gone and it's current state.
Split Threads
Each time a piece of money is split for any reason, a new thread is created, called a split thread. The split amount will be associated with both the original thread, and the new thread. So you can see the entire history of the money by looking at the deposit thread, or, just the information about what happened after the split by looking at the split thread.
Money that has been split a bunch of times will have a complex web of threads that resembles a tree structure. However, each split remains associated with all other threads that came before it. This means that no matter how many changes or splits money has gone through it will always be associated with its deposit thread.
Threads & Knots
Threads are a pointer to the history and current state of money, but don't actually store any money themselves. Each thread has a series of knots (starting with an initial knot) that show how the money has changed over time, and what the current state is.
How to think about threads
You can think of a thread as a special account that can be withdrawn from, or have money returned to, but cannot receive deposits. In addition to knowing what funds are available for the account, the thread also knows about all the money that has ever been withdrawn from it.
Threads are a great tool when you know what general blocks of money you want to change or withdraw from, but you don't care about which specific pieces of money are chosen, much like an account in double entry systems. Operating on threads still creates deterministic attribution and auditability, but hides the complexity of all of that when you don't need it.
Simple Thread Example
Here is an example of a relatively simple thread with one partial withdraw. You can see the current state of the money by looking at the final knot of each thread (K2 and K4).
Steps
- A deposit was received for $59.00 which created the knot K1 and the deposit thread T1
- A withdraw of $20.00 was requested
- The original amount was split into two parts, the requested $20.00 as knot K3, which also created a new split thread T2.
- The remaining $39.00 was represented as knot K2 and still belongs only to the deposit thread T1
- The requested $20.00 is withdrawn creating knot K4