The service logger is an internal Holo component that measures and logs the hosting carried out by Hosts, on behalf of Clients, then generates a proof of service invoice via bridge to Holofuel.
Clients that want to have some hosting done will log a Request. Then, when the Hosts finished doing a block of hosting, they will require a signature from the Clients, to generate the signed service log. After that the Service Logger will count the number of unpaid logs until its value hits a threshold configured in the Hosting App, to then trigger the generation of an Invoice, via bridge to Holofuel
Service Logger is best and most reliably built under a nix-shell environment. Checkout the version
of holochain-rust consistent with the version specified in zomes/service/code/Cargo.toml,
eg. git checkout v0.0.18-alpha1. Then run nix-shell. When you get a prompt, cd into your clone
of servicelogger, and run the following commands:
make testFirst, install testing dependencies:
cd ./test/ & npm installThen:
hc testNote since this repo is in dev mode. If you want to test using the holochain-rust
developbranch, first edittest/index.jsto use a "relative" version of nodejs_conductor; you would have to pull the holochain-rust repo in the same folder you pull this repo into. This is required to run the hc test with the latest nodejs_conductor in the holochain-rust.
Requires the HoloFuel, Holo-Hosting-App and service logger DNAs, built and/or copied to the local service logger dist/ directory.
- Build
holofuelDNA and copyholofuel/dist/holofuel.dna.jsontodist/holofuel.dna.json - Build
Holo-Hosting-Appand copy../Holo-Hosting-App/dna-src/dist/Holo-Hosting-App.dna.jsontodist/holohosting.dna.json
Run the Bridging tests with:
hc test -t test/bridging.jshc package.dna.json result will be in ./dist.
const crypto = require('crypto');
const JSONserialize = require('json-stable-stringify');
const { Codec, KeyManager } = require("@holo-host/chaperone");
const utf8 = new TextEncoder();
const keys = new KeyManager( crypto.randomBytes( 32 ) );
const client_agent_id = Codec.AgentId.encode( keys.publicKey() );
const payload = { "key": "value" };
const sig_bytes = keys.sign( utf8.encode(JSONserialize(payload)) );
const b64_sig = Codec.Signature.encode( sig_bytes );