make wallet-{serve,pin,ask}: query the wallet with your own questions
Three new targets layered on the wallet-demo:
- wallet-serve long-running server pointed at your real corpus
(defaults: SHARDS_DIR=$HOME/.arborist/shards, override
with DB=path); Ctrl-C to stop
- wallet-pin fetch the server's current snapshot_root once and save
to $HOME/.arborist/wallet.anchor. Real SPV trust:
verify the anchor out-of-band before pinning, then
every subsequent ask grounds against the pinned value
- wallet-ask Q="your question" — reads the pinned anchor (warns +
auto-fetches if no pin), submits via wallet client,
prints the verified JSON. Optional ANCHOR= override.
Typical flow:
make wallet-serve & # one terminal
make wallet-pin # one-time bootstrap
make wallet-ask Q="what is X?" # repeat as needed
This commit is contained in:
parent
8ebc81cf64
commit
80c6da3914
1 changed files with 35 additions and 1 deletions
36
Makefile
36
Makefile
|
|
@ -42,7 +42,7 @@ SEARCH_Q ?= computer
|
|||
crawl-textbooks crawl-textbooks-stats textbook textbook-list bench-jaggedness \
|
||||
monitor-poll monitor-graph monitor-access \
|
||||
bootstrap-object-store cold-pack cold-pack-dvd cold-pack-all cold-pack-all-dvd cold-unpack cold-hydrate cold-stats cold-list \
|
||||
wallet-demo
|
||||
wallet-demo wallet-serve wallet-pin wallet-ask
|
||||
|
||||
all: bootstrap fetch-cur ingest-cur verify stats ## bootstrap → fetch cur → ingest cur → verify → stats
|
||||
|
||||
|
|
@ -1499,6 +1499,40 @@ clean-data: ## remove fetched dumps
|
|||
# anchor proves rejection. Cleans up both HOMEs on exit.
|
||||
|
||||
WALLET_DEMO_PORT ?= 18780
|
||||
WALLET_PORT ?= 18780
|
||||
WALLET_URL ?= http://127.0.0.1:$(WALLET_PORT)
|
||||
WALLET_ANCHOR_FILE ?= $(HOME)/.arborist/wallet.anchor
|
||||
WALLET_QA_DB ?= $(HOME)/.arborist/wallet-qa.db
|
||||
SHARDS_DIR ?= $(HOME)/.arborist/shards
|
||||
|
||||
wallet-serve: bootstrap ## start a long-running wallet server [WALLET_PORT=18780 SHARDS_DIR=... or DB=... ARBORIST_WALLET_STUB=1]
|
||||
@mkdir -p $(dir $(WALLET_QA_DB))
|
||||
@if [ -n "$$DB" ]; then \
|
||||
echo "serving --db $$DB on http://0.0.0.0:$(WALLET_PORT) (qa-db=$(WALLET_QA_DB))"; \
|
||||
$(ARBORIST) --db "$$DB" serve --host 0.0.0.0 --port $(WALLET_PORT) --qa-db $(WALLET_QA_DB); \
|
||||
else \
|
||||
echo "serving --shards-dir $(SHARDS_DIR) on http://0.0.0.0:$(WALLET_PORT) (qa-db=$(WALLET_QA_DB))"; \
|
||||
$(ARBORIST) --shards-dir $(SHARDS_DIR) serve --host 0.0.0.0 --port $(WALLET_PORT) --qa-db $(WALLET_QA_DB); \
|
||||
fi
|
||||
|
||||
wallet-pin: bootstrap ## fetch + save the server's current snapshot_root as trust anchor [WALLET_URL=...]
|
||||
@mkdir -p $(dir $(WALLET_ANCHOR_FILE))
|
||||
@curl -sS $(WALLET_URL)/snapshot_root | $(PY) -c "import json,sys;print(json.load(sys.stdin)['snapshot_root'])" > $(WALLET_ANCHOR_FILE)
|
||||
@printf 'pinned anchor:\n '; cat $(WALLET_ANCHOR_FILE); printf ' → %s\n' "$(WALLET_ANCHOR_FILE)"
|
||||
|
||||
wallet-ask: bootstrap ## query the wallet server with your own question [Q="..." WALLET_URL=... ANCHOR=hex (else uses pinned/auto-fetches)]
|
||||
@test -n "$(Q)" || { echo 'usage: make wallet-ask Q="your question" [ANCHOR=hex] [WALLET_URL=...]'; exit 2; }
|
||||
@ANCHOR="$(ANCHOR)"; \
|
||||
if [ -z "$$ANCHOR" ]; then \
|
||||
if [ -f $(WALLET_ANCHOR_FILE) ]; then \
|
||||
ANCHOR=$$(cat $(WALLET_ANCHOR_FILE)); \
|
||||
echo "# using pinned anchor from $(WALLET_ANCHOR_FILE)" >&2; \
|
||||
else \
|
||||
echo "# WARN: no pinned anchor; auto-fetching from server (run 'make wallet-pin' for true SPV trust)" >&2; \
|
||||
ANCHOR=$$(curl -sS $(WALLET_URL)/snapshot_root | $(PY) -c "import json,sys;print(json.load(sys.stdin)['snapshot_root'])"); \
|
||||
fi; \
|
||||
fi; \
|
||||
$(ARBORIST) wallet ask "$(Q)" --server-url $(WALLET_URL) --trust-anchor $$ANCHOR
|
||||
|
||||
wallet-demo: bootstrap ## SPV wallet end-to-end proof: vanilla laptop queries a cloud server, verifies cryptographically [WALLET_DEMO_PORT=18780]
|
||||
@set -e; \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue