Implementing the witnessed ledger

The witnessed ledger does not exist - do not go looking for it! It's merely a product of my imagination so please have that in mind when you continue reading this post!

Overview

It was [anecdotally] italian merchants who invented double entry book-keeping. They would travel with their ledger and the buyer would make an entry in his ledger as would the seller. One of the obvious dividends was for the merchants NOT to be required to carry funds with them and thus avoid being robbed whilst travelling!

The witnessed ledger exhibits some of the same qualitiees - each legal body their own ledger. You could say that the ledger is a private journal of (select) events where the legal body is a stakeholder.

Events

It will be possible to write any kind of event to the witnessed ledger, like appointments, heartrate measurements, betting profits, current temperature, more
Each 'record' can be a simple digit or a thousand words.

Now how about genesis?

Any product/service is birthed and the witnessed ledger is too. In blockchain lingo it is refered to by the label: genesis.

The blockchain is based on a genesis block just as ledgers start with a line 1 and the witnessed ledger is no different! When I start my ledger app (accidentally on my macOS device but it might as well have been an Android, Windows, Linux or iOS device) and when it learns that there is no persisted ledger, it will form and materialize a witnessed ledger on my device.

Typical to genesis blocks; my ledger has no witnesses to line 1 neither! In memory I will form a block and I will persist that block (like any other transaction) as a line of chars sequentially added to a file in its own folder - witnessed_ledger/wl_1.wlx

0 // transaction type [0=genesis]
0000000000000000000000000000000001 // [1]
aaf6bc6b9f137278211eff1828cf88f6dd69aca698c3fec418bed1d8804474e0 // [2]
a134c1e36ad35614d99c7a2a259635be4598c168755a943a9b19d8c07e86bfce // [3]
124 // .beats (swatch internet time) [4]
879 // [4]
10012018 // [4]
WLTRDCMN // [5]

In the genesis block above, the references are

  1. The transaction ID - really not relevant but stating it will allow others to verify that transactions are sequentially correct and no transactions missing
  2. A SHA-256 hash of the (genesis) payload - and the genesis payload is simply the text string: "The witnessed ledger genesis transaction";
  3. My signature on this transaction
  4. 86.4 seconds pr beat[1], 86.4 milliseconds, CET originating date - 10th January
  5. My pigeon[2], ???, !ZZZ!ZZZ!] - a unique call tag (45^9 or 16.815.125.390.625 unique IDs)

Precursor to the next transaction

After I started my ledger app it offered me a chance to always keep my ledger in sync across devices. I have multiple ways to solve this! a) I could download the open source and run a witness myself b) keep at least one of my devices online at anytime during the day c) upload backups online to like professional witnesses.
I decided that it would probably be best to always have an up-to-date copy of my ledger, so I accepted and then the ledger app gave me a choice of witnesses supporting the WLP[3]. I opted in and choose (my own) backup service with the pigeon WLBACKUP - and that added the first contact to my list of contacts!

WLX - in gold we trust

The core feature lending its name to the witnessed ledger is what we will see from the second transaction!

My first real transaction was in a sense steered from adding the WLBACKUP pigeon to my contact list! That service is not free and the service asked for a deposit of 1 WLX[4]

In any case as the AI was not ready and did not have any data points on me, and I really did not care about the lending business right now - I bought 1000 WLX's (at the current rate that cleaned me shy of US$ 250) at https://exchange.wlx by typing in the amount, my pigeon and the creditcard information. In less than a second I was prompted by my ledger app to approve of the first ever transaction on my witnessed ledger - a transfer of 1000 WLX to my ledger (and wallet).

The first (money) transaction

I tapped the notification of a 1000 WLX transfer into my (wallet) app and the next screen I saw was a prompt asking me for my secret attached to the private key. Setting up the public/private key I choose to use an image - so the camera was on and I pointed it at my left wrist. The CNN[5] decided that the image did infact look like the image I had taken when setting up the keys and the ledger app signed the money transfer like this

1 // transaction type [1=money]
0000000000000000000000000000000002 // [1]
7283a1a1259b5eab11df532caaa3a38243ddc3cf0338ae822054aa5914b7e746 // [2]
21f039dec4334306476e4c480162da115840917c5973139dcfa5303af4141455 // [3]
601 // .beats (swatch internet time) [4]
155 // [4]
10012018 // [4]
WLTRDCMN // [5]
12694ec3b4c544c8a141ed29f937f196b6d2d15a7b0fda3349ed2f5aefba96c4 // [6]
WLXCHNG3,B0DLDCMN // [7]

In the genesis block above, the references are as above +

  1. a hash of the previous (first) transaction
  2. witnesses

Money transactions

The payload is a JSON string with a number of data points like

payments: { from: WLXCHNG3, amount: 1000, time: [601,155,10012018], text: "deposit from myself", rate: 1348.39201, fiat: USD, status: :completed }

This (first real) transaction did set me up with something to trade with and documented along the road how this trade was realized! Another example of such a deposit might be:

payments: { from: WLXCHNG3, amount: 1000, time: [601,155,10012018], text: "deposit from myself", rate: 1348.39201, fiat: EUR, status: :loan, conditions: "https://exchange.wlx/loans/WLTRDCMN/30187" }

Please notice how these conditions are nothing but a URL to a REST resource which makes it 100% transparent to evaluate the solvency of your trade partner. Anybody can peruse the loans owned by some pigeon (legal body) and make their own judgement as to the extend of the solvency of 'someone'.

The WLP now states that in order to confirm this transaction the ledger app has to produce at least 2 witnesses before it has to return a confirmed transaction to the sender. My ledger app received the transaction from a witness, (debtors can be witnesses - but only to fiat currency transactions) hence it needs a second witness. So the ledger app forwards the transaction to another witness (from my list of contacts). Currently I do not have any more contacts(except the WLBACKUP which will not witness transaction being the creditor), so I have to find someone that I can add. It has to be someone I trust. I pick my brother.

He accepts my invitation and now I have B0DLDCMN as a contact. The ledger app did queue the confirmation of my first transaction and now that it senses that there are enough contacts to use - it forwards the transaction to him! His ledger app receives the transaction confirmation message with my signature and starts by asking the enclosed witness if the transaction does infact carry any validity. His ledger app receives an :ok from WLXCHNG3 and as my brother's ledger app also checked my signature with the signature service being part of the WLX service at https://signatures.wlx my signature was ok too, his ledger app returns a :ok to me too (after adding the transaction to his ledger). Now my ledger transaction is complete - with two witnesses - and I can return an :ok to the sender (WLXCHNG3).

My brother did not have to consider this kind of transaction for long because it would involve me receiving value from an exchange in exchange for fiat money - very low risk transaction. In fact my brother setup his ledger app to witness this kind of transactions automatically!

The risk of witnessing?

Being a witness does come with a risk! You will vouch for the transaction and in this case my brother would vouch for me 'spending' a sum of US dollars on WLX's. Should the WLXCHNG3 suddenly receive a message from someone saying: "those US$250 were funny money - please give us some real money!" then WLXCHNG3 would try to get hold of me, and if I were to disappear from the face of the earth, the exchange would hit on the witnesses collectively (with 5 witnesses each would have to come up with close to US$50 in this example).

Thus witnesses are perfectly allowed to limiting their witnessing or repudiate witnessing some (or all) transactions all together, and the ledger app will have to go looking for more witnesses until the entire amount is covered.

To insurance companies this may seem terribly mundane - this is after all how most insurance companies make a living; reinsurring their policies!

The next transaction

I stored a JPEG of my late cat, Tiger, on my device and in the interest of preserving it for the future, I added it to my ledger-app.

2 // type  [2=witnessed ledger transaction]
0000000000000000000000000000063121 // [1]
1f9082d9ed4b67b2a891b4aa36b697a9e183fd89b00d4adf2274c85faeb22d6b // [2]
5b31df86133880990f9554591a09b1eb8eda01d67f66cd1be653bff8fe3e6d83 // [3]
301 // .beats (swatch internet time) [4]
280 // [4]
14022018 // [4]
WLTRDCMN // [5]
8c58faa4719151e7dab79b32e71a624ae6e9e391c944cddd4ca4a68d414856a7 // [6]
B0DLDCMN,WLBACKUP

My ledger app would start looking for 2 witnesses to confirm the transaction. My brothers ledger app responded in a few ms but the WLXCHNG3 return a {:error, :will_not_store_type_2_transactions} meaning that I will have to find yet another contact to help me confirm the transaction. Luckily my first contact was WLBACKUP and as it will store the transaction in anyway it might as well confirm it too. I get quick :ok from that contact too. Done

Building fake ledgers

Nothing will bar hackers and black hats from building fake ledgers demonstrating fortunes of WLX in pursuit of quick riches and double spends by the billions!

Nothing except a missing path!

If your ledger app is not able to compile a path of trusted witnesses from you to the trade partner, either you or the trade partner will have to add contacts effectively closing the path between the two of you.

That will add to the list of witnesses on the transaction like

...
155 // [4]
10012018 // [4]
PIGGYFOX // [5]
12694ec3b4c544c8a141ed29f937f196b6d2d15a7b0fda3349ed2f5aefba96c4 // [6]
K8W1N5LT,HGHJCKMN,3L1A53l1,FBI___88 // [7]

I got a call from this guy who claims to have one of the original Fabergé eggs and would like to sell it to me for 100,000 WLX - for the Winter Egg! If it was true it would be a steal. So, I asked him for proof of ownership and he sent me the transaction. My ledger app immediately started to validate the witnesses.

I did not have to search for long! K8W1N5LT had no recollection of any such trade, and worse; HGHJCKMN is not even a valid pigeon which leaves 3L1A53L1 and FBI___98. Both okayed the transaction with an exact copy of their own but gossip has it (my ledger app did ask all my contacts if they knew FBI___88 (and each of them asked all of their contacts, etc) that the FBI___88 is a fabricated pigeon - and since FBI___88 was not able to build a proper path to the person selling him the egg, I eventually ended passing on the opportunity ;)

This, however, is the unusual and not (so) happy path! Usually I will trade with (and have witnesses verify my transactions - like storing that picture of my cat) someone on my list of contacts. But building slightly longer paths is a part of the WLP though!

Pedigee dog breeder's turn to feel mundanely entertained! Since late in the 19th centery they have set breed standards by keeping a tab on the stud books. Some dog breeds have 150+ year family trees with upwards of 2 dozen ancestors.

Trusted contacts

That does indeed put a lot of responsibility on everyone connected - not to add contacts which they do not trust!

How to keep your list of contacts decontaminated?

  1. First off you might only add contacts which you know personally and do infact trust!

  2. Secondly you could add less trusted contacts tagging them with :not_as_witness in order to make sure that the ledger app does not consider them a possible witness to any transactions.

  3. Thirdly you could participate as a 'paid' witness by tagging a contact with :witnessed_by_fee_only and add three further datapoints:

    {fee: {percentage: 0.01}, max_witness_amount: 1000, response_speed: 200}

    Now the ledger app will consider transactions from this contact if that contact's ledger app will accept the fee. Building paths to witnesses in that way is entirely automated being a third person/witness to a transaction. The ledger app will inquire the path and the cost of the path and from those data points it will construct the cheapest/fastest path from you to the trade/transaction partner.

Bring down trading volume?

Won't that bring down trading volumes on everything? Well, if you only have a few contacts and no path to a witness to a transaction in say diamonds you probably will want to do that transaction in person anyway! Or chose witnesses which will 'insure' your transaction for a fee!

The ledger app will be able to validate 30-50 witnesses/sec so with a minimum of 2 witnesses to a transaction, you would be able to do 15-25 transactions/sec provided you were to trade exclusively with regular partners (which most do anyways). To standard trade the witnessed blockchain is a blessing. To the odd trade it merely is a hickup - forcing you to linger just a few seconds longer!

Verifying transactions

Black hats will construct transactions that do indeed look legit! They will try to build paths from you to themselves/whom-ever will be the subject.
But unless they are able to add transactions to other ledgers, building a path will not cut the mustard!

Once you're presented with a path you will ask all participating witnesses if they have added the transaction and expect them to return witnesses themselves of exactly that allowing you to ask those witnesses if they added the transaction. The longer you stray from your own contacts, the more witnesses will the ledger app require to "feel safe", and the less likely the ledger is to provide you with enough confidence to go through with the transaction.

The blackhat will - when the prize is high enough - meticulously compile paths and transactions going back years but he will not be able to touch blockchains even close to you and there lies the key!

He will have to build not one but several paths close to you with trades similar to the one he is hoping to pull of now. It is possible - let us for a minute humor the thought - but so it will be in the "real" world! Someone lives an ordinary life for 20+ years and then suddenly takes to the sunset with all the cash after having embezzled some company 20mio in funds!

The difference being that with the witnessed blockchain your 'aid' - the ledger app - will work laboriously to validate every single change of state until it either has two of your own witnesses/contacts or well insured witnesses!

Infrastructure

Now I will briefly touch on the different parts to the infrastructure:

https://signature.wlx

Signing transactions obviously are key to a functioning witnessed blockchain! How to trust a signature?

Signatures are private/public keys added to witnessed ledgers with very high trust/credability - preferably a public service.

https://wlexchange.wlx

Every broker wanting to sell wlx'es in exchange for fiat currency will register with the wlexchange.wlx and 'setup shop' here.

At the exchange brokers will sell WLX's which they will procure from the WLF (Witnessed Ledger Foundation) at the current rate of 0.0020833 troy ounce or 0.064798918 gram of 24Karat gold pr WLX. Brokers may at any time hand over their volume of WLX'es in exchange for gold as may anybody owing a WLX.

WLP - Witnessed Ledger Protocol

The protocol sets a few ground rules:

  1. Only the genesis block in any chain may only have 1 witness. The rest will have an arbitrary number of witnesses, larger than 1.
  2. The usual (happy path) transaction speed must be measured in sub-1,000 milli-seconds - usually in the range 2-400ms.
  3. There are a finite number of transaction types: genesis, money, backup, asset, ip, more
  4. [TODO]

  1. beats are the Swatch Internet Time unit ↩︎

  2. a pigeon is like a dog-tag - it's an 9 character ID and when that will not suffice there is amble room for adding more chars!
    The range encompasses: ZXCVBNMASDFGHJKLQWERTYUP0123456789$§&/()_÷≈[]
    Examples are: WLTRDCKMN, %&=234€§ ↩︎

  3. WLP is short for Witnessed Ledger Protocol ↩︎

  4. Witnessed Ledger eXchange - this cryptocurrency is linked to the gold standard in such a way that when you purchase WLX's you pay the going rate of 0.0648 gram (or 1 grain) of gold. Pay is however a somewhat confined way of looking at it - you do not necessarily pay. That is decided upon by the Artificial Intelligence. Does it have sufficient data points on you to qualify you as a solvent person and one which it will wage a bet on, well then you technically will be able to lend (some) WLX's! ↩︎

  5. Convoluted Neural Networks are used to learn machines to recognise objects in images ↩︎