Skip to content

Commit

Permalink
Describe Jerboa as a prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Oct 25, 2024
1 parent 0e94273 commit 7a7cd71
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
# Work in Progress
# Not Public Yet
# Prototype only
# Not Suitable for Production Use

![jerboa](./jerboa.jpg)

This repository contains a prototype of LedgerLoops, for demonstration purposes.

It uses peer-to-peer messaging, [Decentralized Cycle Detection](https://datatracker.ietf.org/doc/draft-dejong-decentralized-cycle-detection/), and [hashlocks](https://ledgerloops.com/description), and a centralised [Semaphore Service](https://github.com/ledgerloops/jerboa/blob/main/src/SemaphoreService.ts) to successfully clear obligations in a network setting.

NB: this prototype [still uses a centralised semaphore service](https://github.com/ledgerloops/jerboa/issues/57) - an issue we hope to resolve in Q1/Q2 of 2025.

## Sarafu-Based Netting Challenge
To participate in the [Sarafu-Based Netting Challenge](https://github.com/ledgerloops/strategy-pit/pull/41), check out the strategy-pit repo next to this one,
and run:
To test its performance, we have used the [Sarafu-Based Netting Challenge](https://github.com/ledgerloops/strategy-pit?tab=readme-ov-file#sarafu-based-netting-challenge), as follows:
```
git clone https://github.com/ledgerloops/strategy-pit
git clone https://github.com/ledgerloops/jerboa
cd jerboa
npm install
npm run build
time node build/src/jerboaChallenge.js __tests__/fixtures/sarafu-10k.csv
NUM_WORKERS=20 time node build/src/jerboaChallenge.js __tests__/fixtures/sarafu-50k.csv __tests__/fixtures/sarafu-50k.solution
NUM_WORKERS=20 time node build/src/jerboaChallenge.js __tests__/fixtures/sarafu-100k.csv
NUM_WORKERS=20 time node build/src/jerboaChallenge.js ../Sarafu2021_UKdb_submission/sarafu_xDAI/sarafu_txns_20200125-20210615.csv
```
This will take roughly 6 minutes, depending on your laptop. Taking into account that this simulates the entire network of about 7,000 nodes over 18 months, we believe this processing time to be acceptable.

You can pipe the output to a file (or add some code to write it to a file from `./src/jerboaChallenge.ts`)
and then follow the [instructions](https://github.com/ledgerloops/strategy-pit/tree/sarafu-netting-challenge?tab=readme-ov-file#solution-analysis) to analyse the result.
```
cd ../strategy-pit
npm run build
python -m pip install ortools
node ./build/src/sarafu-to-debt.js ../jerboa/__tests__/fixtures/sarafu-50k.csv ./debt.csv ./sources.csv ./drains.csv 1000000
python mcf.py > flow.csv
node build/src/subtractFlow.js ./debt.csv ./flow.csv ./mcf-out.csv
node build/src/dfs.js debt.csv dfs.csv
node build/src/dfs.js mcf-out.csv mcf-dfs.csv
node ./build/src/analyse-sarafu-challenge-solution.js ./debt.csv ./mcf-dfs.csv
node ./build/src/analyse-sarafu-challenge-solution.js ./debt.csv ./dfs.csv
node ./build/src/analyse-sarafu-challenge-solution.js ./debt.csv ../jerboa/__tests__fixtures/sarafu-50k.solution
```
The last three lines will show you the performance of Min-Cost-Flow, Dept-First Search, and Jerboa (this prototype).
Min-Cost-Flow will show a performance of roughly 18.9%, the optimum.
Depth-First Search will show a performance of roughly 16.6%, a close second, but still a centralised algorithm.
Jerboa will show our prototype's performance of roughly 15.5%, so that's 80% of the optimum, which we believe is encouraging performance for a prototype.

0 comments on commit 7a7cd71

Please sign in to comment.