{"id":48879467,"url":"https://github.com/viftode4/trustchain-js","last_synced_at":"2026-04-16T02:04:53.859Z","repository":{"id":341685209,"uuid":"1170875246","full_name":"viftode4/trustchain-js","owner":"viftode4","description":"TrustChain TypeScript SDK - zero-dep HTTP client, sidecar management, OpenClaw plugin","archived":false,"fork":false,"pushed_at":"2026-04-07T21:09:42.000Z","size":368,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-07T22:26:10.418Z","etag":null,"topics":["agent-economy","ai-agents","bun","mcp","reputation","sdk","trust","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viftode4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-02T16:11:13.000Z","updated_at":"2026-04-07T21:09:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/viftode4/trustchain-js","commit_stats":null,"previous_names":["viftode4/trustchain-js"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/viftode4/trustchain-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viftode4%2Ftrustchain-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viftode4%2Ftrustchain-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viftode4%2Ftrustchain-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viftode4%2Ftrustchain-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viftode4","download_url":"https://codeload.github.com/viftode4/trustchain-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viftode4%2Ftrustchain-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31863501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-economy","ai-agents","bun","mcp","reputation","sdk","trust","typescript"],"created_at":"2026-04-16T02:04:45.245Z","updated_at":"2026-04-16T02:04:53.847Z","avatar_url":"https://github.com/viftode4.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TrustChain TypeScript SDK\n\n[![CI](https://github.com/viftode4/trustchain-js/actions/workflows/ci.yml/badge.svg)](https://github.com/viftode4/trustchain-js/actions)\n[![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)\n\n**TypeScript SDK for [TrustChain](https://github.com/viftode4/trustchain) — portable identity, signed interaction history, and sidecar-managed coordination for agent networks.**\n\nUse the TypeScript SDK to start or connect to a TrustChain sidecar, record bilateral interactions, and add trust-aware discovery, delegation, audit, and routing primitives to existing agents. Zero runtime dependencies; the `trustchain-node` binary downloads automatically on first use.\n\n## Packages\n\n| Package | Description |\n|---------|-------------|\n| [`@trustchain/sdk`](./packages/sdk) | HTTP client + sidecar process management. Zero runtime deps. |\n| [`openclaw-trustchain`](./packages/openclaw) | OpenClaw plugin — 5 agent-facing coordination and trust tools. |\n\n## Quick Start\n\n```bash\nbun add @trustchain/sdk\n# or\nnpm install @trustchain/sdk\n```\n\n```typescript\nimport { init } from \"@trustchain/sdk\";\n\n// Starts sidecar, downloads binary if needed, sets HTTP_PROXY\nconst sidecar = await init({ name: \"my-agent\" });\n\n// Check trust\nconst trust = await sidecar.trustScore(peerPubkey);\nconsole.log(`Trust: ${trust.trust_score}`);\n\n// Record an interaction\nawait sidecar.propose(peerPubkey, { type: \"tool_call\", outcome: \"success\" });\n\n// Clean up\nsidecar.stop();\n```\n\n### Client-only (connect to existing node)\n\n```typescript\nimport { TrustChainClient } from \"@trustchain/sdk\";\n\nconst client = new TrustChainClient({ baseUrl: \"http://localhost:18202\" });\nconst status = await client.status();\n```\n\n### Delegation\n\n```typescript\nimport { initDelegate } from \"@trustchain/sdk\";\n\nconst sidecar = await initDelegate({\n  parentUrl: \"http://parent-node:18202\",\n  scope: [\"read\", \"write\"],\n  ttlSeconds: 3600,\n});\n```\n\n## How It Works\n\nEvery call to a known TrustChain peer triggers a bilateral handshake: both parties sign a half-block recording the interaction. Trust scores are computed from real interaction history using MeritRank (default) or NetFlow connectivity analysis, and the same history also supports audit, delegation, and trust-weighted discovery.\n\nThe sidecar proxy runs locally on port 8203. Agents set `HTTP_PROXY=http://127.0.0.1:8203` and all inter-agent HTTP calls are automatically instrumented. No code changes to agent logic required.\n\nTrust is a number between 0.0 and 1.0, computed as **(0.3 × structural + 0.7 × behavioral) × confidence_scale** (weighted-additive model, v4):\n- **structural** = connectivity × integrity — Sybil resistance × chain integrity\n- **behavioral** = recency (quality-weighted, λ=0.95) — recent interaction quality\n- **confidence_scale** = min(interactions / 5, 1.0) — new agents ramp up gradually\n- **connectivity** — MeritRank random walks (default) or NetFlow max-flow; `diversity` is evidence-only, not in final score\n\nProven fraud results in a permanent hard-zero trust score.\n\nWhen no TrustChain-aware peer exists, the SDK supports **single-player audit mode** — self-signed audit blocks as a cryptographic log.\n\n## Binary Auto-Download\n\nThe SDK automatically downloads the `trustchain-node` binary from [GitHub Releases](https://github.com/viftode4/trustchain/releases) on first use. No Rust toolchain required.\n\nSearch order: explicit path → PATH → `~/.trustchain/bin/` → auto-download.\n\nTo pre-download (e.g. in Docker):\n\n```typescript\nimport { ensureBinary } from \"@trustchain/sdk\";\nawait ensureBinary();\n```\n\n## Development\n\n```bash\nbun install\nbun run build\nbun test        # 165 tests\nbun run lint    # biome check\n```\n\n## Public Seed Node\n\nA public seed node is running at `http://5.161.255.238:8202`. It is the default bootstrap peer — agents connect automatically without any configuration.\n\n\u003e Early-access: not production-scale yet. Will be replaced with a domain and additional nodes as the network grows.\n\n## Protocol\n\nImplements [draft-pouwelse-trustchain-01](https://datatracker.ietf.org/doc/draft-pouwelse-trustchain/) (Pouwelse, TU Delft, 2018). Trust computation and NetFlow Sybil resistance are specified in draft-viftode-trustchain-trust-00 (filed March 2026). Wire format matches the Rust implementation exactly — same JSON field names, same timestamp convention (integer milliseconds), same constants.\n\n## Related Projects\n\n- [trustchain](https://github.com/viftode4/trustchain) — Rust core: sidecar binary, QUIC P2P, MCP server\n- [trustchain-py](https://github.com/viftode4/trustchain-py) — Python SDK: `pip install trustchain-py`\n- [trustchain-agent-os](https://github.com/viftode4/trustchain-agent-os) — Agent framework adapters\n- [trustchain-economy](https://github.com/viftode4/trustchain-economy) — mechanism-design and adversarial evaluation engine for agent networks\n\n## License\n\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviftode4%2Ftrustchain-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviftode4%2Ftrustchain-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviftode4%2Ftrustchain-js/lists"}