This commit is contained in:
Raven Scott
2026-05-20 23:36:32 -04:00
parent a020270cb1
commit be94546cd3
218 changed files with 9189 additions and 3078 deletions
@@ -1,35 +1,38 @@
# hyper-p2p-credit-ledger
Gossip-replicated credit accounts: open, credit, debit, and peer-to-peer transfer.
Gossip-synchronized credit accounts: open, credit, debit, transfer, and balance queries on a shared Hyperswarm topic.
**Category:** Applications (economy)
**Composes with:** `hyper-p2p-bandwidth-broker`, `hyper-p2p-auction-gossip`
**Composes with:** `hyper-p2p-auction-gossip`, `hyper-p2p-marketplace-listing`
**Protocol:** `credit-ledger/v1`
## When to use
Apps that track balances or credits across peers on a shared Hyperswarm topic.
Soft-currency or reputation balances that should converge across peers without a central server.
## When not to use
Authoritative financial ledgers requiring strong consistency (use dedicated consensus).
Strong consistency, double-spend safety, or audit-grade accounting (add consensus or signed operation logs).
## Quick start
```js
const { HyperP2PCreditLedger } = require('hyper-p2p-credit-ledger')
const ledger = new HyperP2PCreditLedger({ topic: 'credits' })
const ledger = new HyperP2PCreditLedger({ topic: 'credits-demo' })
await ledger.ready()
ledger.openAccount('alice', 100)
ledger.transfer('alice', 'bob', 25)
console.log(ledger.balance('bob')) // 25
await ledger.close()
```
## Docs
- [docs/api.md](docs/api.md)
- [docs/architecture.md](docs/architecture.md)
- [examples/basic.js](examples/basic.js)
## Test