Packages: core (BIP39/32/44/49/84/86 derivation, WIF), keystore (PBKDF2 + AES-GCM), psbt, p2p (BIP157/158 SPV daemon, Dandelion++ broadcast with relay-echo verification), blockbook, rpc, electrum, net, bns, web-ui (React/Vite), mobile (Expo). ops/ holds the nginx vhost, systemd unit and push.sh deploy script for digibyte.x/web.
49 lines
1.7 KiB
Markdown
49 lines
1.7 KiB
Markdown
# @dgb-wallet/p2p
|
|
|
|
DigiByte P2P client for the Maximum Privacy backend. Client-side chain data via BIP157/158 compact block filters — the wallet does its own address matching locally, so peers never learn which addresses it cares about.
|
|
|
|
Current status: **Milestone 1 (peer connect + version handshake)**.
|
|
|
|
Planned milestones:
|
|
1. ✅ Peer connect + version handshake
|
|
2. Peer discovery via DNS seeds + `getaddr`
|
|
3. Header sync (`getheaders` / `headers`)
|
|
4. BIP157 filter negotiation + BIP158 filter download
|
|
5. Filter probing (address → scripthash → filter match)
|
|
6. Block fetching for filter hits
|
|
7. Transaction broadcast (`inv` / `tx`)
|
|
8. Dandelion++ integration
|
|
9. Persistent cache
|
|
|
|
## Milestone 1 demo
|
|
|
|
```bash
|
|
cd "D:\Dev\SilentCode\Digibyte"
|
|
npm install # first time only
|
|
npm run build -w @dgb-wallet/core
|
|
npm run handshake -w @dgb-wallet/p2p
|
|
```
|
|
|
|
Resolves DGB DNS seeds → connects to real live peers on port 12024 → performs the version/verack handshake → reports each peer's protocol version, user agent, service flags, and chain tip height.
|
|
|
|
To target a specific peer IP:
|
|
```bash
|
|
npm run handshake -w @dgb-wallet/p2p -- 1.2.3.4
|
|
```
|
|
|
|
## Layout
|
|
|
|
```
|
|
src/
|
|
hash.ts — double-SHA256 for message checksums
|
|
varint.ts — Bitcoin/DGB compact-size int encoding
|
|
framing.ts — 24-byte header + payload + checksum, multi-frame parsing
|
|
version.ts — version/verack message encode/decode, service flag bits
|
|
peer.ts — per-peer TCP + handshake state machine
|
|
index.ts — re-exports
|
|
|
|
scripts/
|
|
handshake-demo.ts — Milestone 1 end-to-end demo
|
|
```
|
|
|
|
Depends on `@dgb-wallet/core` for network parameters (`DGB_P2P.magic`, `defaultPort`, `dnsSeeds`).
|