From b832269dd5b1f1016e6bd2e390bf46f886d7ba46 Mon Sep 17 00:00:00 2001 From: grumbach Date: Tue, 21 May 2024 12:14:04 -0400 Subject: [PATCH] feat: docs for sn_auditor --- sn_auditor/README.md | 53 ++++++++++++++++- sn_auditor/dag.svg | 125 +++++++++++++++++++++++++++++++++++++++++ sn_auditor/src/main.rs | 2 +- 3 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 sn_auditor/dag.svg diff --git a/sn_auditor/README.md b/sn_auditor/README.md index 52e1d3c83b..f0f866956c 100644 --- a/sn_auditor/README.md +++ b/sn_auditor/README.md @@ -1,2 +1,53 @@ # sn_auditor -Audit the SAFE Network Currency + +This is a small webserver application that allows you to audit the SAFE Network Currency by gathering a DAG of Spends on the Network. + +![](./dag.svg) + +## Usage + +Running an auditor instance: + +```bash +# on a Network with known peers +cargo run --release --peer "/ip4/" + +# on a local testnet +cargo run --release --features=local-discovery +``` + +It can be run with the following flags: + +```bash + -f, --force-from-genesis + Force the spend DAG to be updated from genesis + + -c, --clean + Clear the local spend DAG and start from scratch + + -o, --offline-viewer + Visualize a local DAG file offline, does not connect to the Network + + -b, --beta-participants + Beta rewards program participants to track + Provide a file with a list of Discord + usernames as argument + + -k, --beta-encryption-key + Secret encryption key of the beta rewards to decypher + discord usernames of the beta participants +``` + +## Endpoints + +The webserver listens on port `4242` and has the following endpoints: + +| route | description | +|-------------------|---------------------------------------------------| +|`"/"` | `svg` representation of the DAG | +|`"/spend/"` | `json` information about the spend at this `addr` | +|`"/beta-rewards"` | `json` list of beta rewards participants | + +Note that for the `"/"` endpoint to work properly you need: +- to have [graphviz](https://graphviz.org/download/) installed +- to enable the `svg-dag` feature flag (with `cargo run --release --features=svg-dag`) diff --git a/sn_auditor/dag.svg b/sn_auditor/dag.svg new file mode 100644 index 0000000000..8bf6eb99df --- /dev/null +++ b/sn_auditor/dag.svg @@ -0,0 +1,125 @@ + + + + + + + + + +c1f1425c1823e48475b0828fca5d324e0c7941dcb52379174bcbedf5f9be3be5 + + +SpendAddress(c1f142) + + + + +e8f83f264e29fe515cb343c4dd54d8d4d9db750a6e57437867e33dd30869bead + + +SpendAddress(e8f83f) + + + + +0->1 + + +NanoTokens(900000000000000000) + + + +883e2d37b1fdf3f4cc3b889c8c8b904e369a699e32f64294bd3cc771825960af + + +SpendAddress(883e2d) + + + + +0->2 + + +NanoTokens(388490188500000000) + + + +66268051e972c408c5f27777d6ce080d609891194af303a19558da1c76fe271a + + +SpendAddress(662680) + + + + +1->4 + + +NanoTokens(899999999000000000) + + + +ae3b39145533d45758543c7409f3de7a972b1dddfe3ea18c7825df9bccf73739 + + +SpendAddress(ae3b39) + + + + +1->7 + + +NanoTokens(1000000000) + + + +964d04e290a8fd960b08d90aba03a5ea01ad88f7af5f917f0433b5e9271f30c1 + + +SpendAddress(964d04) + + + + +2->3 + + +NanoTokens(388490188500000000) + + + +6391d9cfbc43964587e1ebb049430e9038f3635d22aa407a046c88de55ddd9f3 + + +SpendAddress(6391d9) + + + + +4->5 + + +NanoTokens(1000000000) + + + +0b9e3253b87e1f75d65d53d9579980339b6016a2db3e0b24d82fd8728377d285 + + +SpendAddress(0b9e32) + + + + +4->6 + + +NanoTokens(899999998000000000) + + + diff --git a/sn_auditor/src/main.rs b/sn_auditor/src/main.rs index 422158eeb4..78d0323560 100644 --- a/sn_auditor/src/main.rs +++ b/sn_auditor/src/main.rs @@ -60,7 +60,7 @@ struct Opt { #[clap(long, value_parser = LogFormat::parse_from_str, verbatim_doc_comment)] log_format: Option, - /// Beta rewards program patricipants to track + /// Beta rewards program participants to track /// Provide a JSON file with a list of Discord usernames as argument #[clap(short, long, value_name = "discord_names_file")] beta_participants: Option,