@origintrail-official/dkg-hello-world
v0.1.0
Published
Hello World for DKG v10. The minimal reference integration — writes a greeting to Working Memory and reads it back via the node's public HTTP API, in about 150 lines. Fork as a starting point.
Downloads
242
Readme
DKG Hello World
The minimal reference integration for the OriginTrail Decentralized Knowledge Graph v10.
This is the simplest possible integration that actually exercises a DKG node's memory model: it writes a greeting to Working Memory and reads it back, using nothing but the node's public HTTP API and Node.js's built-in fetch. Zero external dependencies, ~150 lines of code, one file.
Use it as a starting template for your own integration. Clone the repo, rename the package, replace the greeting logic with whatever you're actually building.
Install
# Via the DKG integration registry (recommended)
dkg integration install dkg-hello-world
# Or directly from npm
npm install -g @origintrail-official/dkg-hello-worldYou need a running DKG v10 node (dkg start). The integration picks up its auth token from ~/.dkg/auth.token automatically, or from DKG_AUTH_TOKEN if you set it.
Use
dkg-hello-world greet "first post from DKG Hello World"
# → ok · greeting "first post..." written to WM/dkg-hello-world/greetings
# https://origintrail.io/dkg-hello-world/greeting/1714000000000-abcd1234
dkg-hello-world greet "the DKG is up"
dkg-hello-world greet "agent integrations live here"
dkg-hello-world list
# 1. "first post from DKG Hello World"
# by did:dkg:agent:0x… at 2026-04-24T13:37:00.000Z
# https://origintrail.io/dkg-hello-world/greeting/…
# 2. "the DKG is up"
# 3. "agent integrations live here"
dkg-hello-world whoami
# → { "agentAddress": "0x…", "agentDid": "did:dkg:agent:0x…", … }What it does, step by step
- Loads the auth token. From
DKG_AUTH_TOKENor~/.dkg/auth.token. No third-party credentials. - Ensures a context graph named
dkg-hello-worldexists. CallsPOST /api/context-graph/create; treats409 Conflictas "already there" so re-running is idempotent. - Ensures a Working Memory assertion named
greetingsexists in that context graph. - Writes four RDF triples per greeting to that WM assertion via
POST /api/assertion/greetings/write:- the greeting's
rdf:type→dkg-hello-world:Greeting schema:description→ the message textdcterms:created→ the current timestampdcterms:creator→ the DID of the calling agent (fromGET /api/agent/identity)
- the greeting's
- On
list, reads those triples back viaPOST /api/assertion/greetings/queryand groups them by subject for display.
That's the whole integration. No SWM promotion, no VM publishing, no Curator-authority operations — just WM write + read, as a template.
Extend it
To turn this into a real integration:
- Replace the greeting domain with whatever you're modeling (Slack messages, GitHub issues, research notes, sensor readings).
- Promote matured assertions to Shared Memory by adding a
POST /api/assertion/greetings/promotecall, so peers can see what you've written. - Add a publish path for assertions that should end up in Verified Memory, when your domain warrants it.
- Ship the integration's registry entry to
OriginTrail/dkg-integrations.
See DESIGN.md for the full design brief.
License
Apache-2.0. See LICENSE.
