2023-03-28 17:55:00 +00:00
# Pathfinder2
2022-10-12 16:13:44 +00:00
2023-03-28 17:59:26 +00:00
Pathfinder is a collection of tools related to
computing transitive transfers in the
2022-10-12 16:13:44 +00:00
[CirclesUBI ](https://joincircles.net ) trust graph.
2023-03-28 17:55:00 +00:00
## Building
2022-10-12 16:13:44 +00:00
2023-03-28 17:55:00 +00:00
This is a rust project, so assuming `cargo` is installed, `cargo build` creates three binaries:
The `server` (default), the `cli` and the `convert` tool.
2022-10-12 16:13:44 +00:00
2023-03-28 17:55:00 +00:00
All need a file that contains the trust graph edges to work.
2022-10-12 16:13:44 +00:00
A reasonably up to date edge database file can be obtained from
2023-03-28 17:55:00 +00:00
- https://chriseth.github.io/pathfinder2/edges.dat
2022-10-12 16:13:44 +00:00
2023-03-28 17:55:00 +00:00
### Using the Server
2022-10-12 16:13:44 +00:00
2022-12-28 18:35:00 +00:00
`cargo run --release <ip-address>:<port>` will start a JSON-RPC server listening on the given port.
2022-10-12 16:13:44 +00:00
It implements the interface specified in https://hackmd.io/Gg04t7gjQKeDW2Q6Jchp0Q
2022-12-28 23:07:12 +00:00
The HTTP server implementation ignores most parts of the HTTP request and header, including the path,
so it essentially responds on all paths.
2022-10-12 16:13:44 +00:00
It has two performance parameters that are currently hardcoded in the source:
Number of worker threads: 4
Size of request queue: 10
2023-03-28 17:55:00 +00:00
### Using the CLI
2022-10-12 16:13:44 +00:00
2023-03-28 17:55:00 +00:00
The CLI will load an edge database file and compute the transitive transfers from one source to one destination. You can limit the number of hops to explore and the maximum amount of circles to transfer.
2022-10-12 16:13:44 +00:00
The options are:
2022-10-28 14:01:21 +00:00
`cargo run --release --bin cli <from> <to> <edges.dat> [<max_hops> [<max_amount>]] [--dot <dotfile>]`
2022-10-12 16:13:44 +00:00
2023-03-28 17:55:00 +00:00
For example:
2022-10-12 16:13:44 +00:00
`cargo run --release --bin cli 0x9BA1Bcd88E99d6E1E03252A70A63FEa83Bf1208c 0x42cEDde51198D1773590311E2A340DC06B24cB37 edges.dat 3 1000000000000000000`
Computes a transfer of at most `1000000000000000000` , exploring 3 hops.
2022-10-28 14:01:21 +00:00
If you specify `--dot <dotfile>` , a graphviz/dot representation of the transfer graph is written to the given file.
2022-12-28 18:10:08 +00:00
2023-03-28 17:55:00 +00:00
### Conversion Tool
2022-12-28 18:10:08 +00:00
2023-03-28 17:55:00 +00:00
The conversion tool can convert between different ways of representing the edge and trust relations in the circles system.
2022-12-28 18:10:08 +00:00
All data formats are described in https://hackmd.io/Gg04t7gjQKeDW2Q6Jchp0Q
2023-03-28 17:55:00 +00:00
It can read an edge database both in CSV and binary formatand a "safe database" in json and binary format.
2022-12-28 18:10:08 +00:00
The output is always an edge database in either binary or CSV format.
Example:
`cargo run --bin convert --safes-json safes.json --edges-bin edges.dat`
2022-12-28 18:35:00 +00:00
Converts a safe json file called `safes.json` into a binary edge database file called `edges.dat` .