A command-line tool for managing Dogecoin block headers. Sync headers from the peer network, export them for bundling into the Avocadoge app, and verify/inspect header cache files.
cd Tools/DogecoinNodeSync
swift build -c releaseThe built binary will be at .build/release/DogecoinNodeSync.
| Command | Description |
|---|---|
sync |
Download headers from Dogecoin peers (default) |
export |
Export headers to a portable bundle file |
verify |
Validate a header cache file |
inspect |
Print info about a header cache file |
Download block headers from the Dogecoin peer-to-peer network using SPV.
swift run DogecoinNodeSync sync [OPTIONS]| Option | Description | Default |
|---|---|---|
--network <network> |
Network to sync (mainnet or testnet) |
mainnet |
-s, --storage <path> |
Directory to store synced headers | ~/Library/Caches/DogecoinKit/headers/<network> |
# Sync mainnet to default location
swift run DogecoinNodeSync sync
# Sync mainnet to a custom directory
swift run DogecoinNodeSync sync --storage ~/Desktop/dogecoin-headers
# Sync testnet
swift run DogecoinNodeSync sync --network testnet
# Sync testnet to custom location (short form)
swift run DogecoinNodeSync sync --network testnet -s /path/to/headers- The initial sync downloads ~6 million headers and takes several hours
- Progress is saved incrementally - interrupt with Ctrl+C and resume later
- The system will not sleep during sync
- After 10 consecutive errors or 5 minutes without progress, sync stops automatically
Export synced headers to a portable bundle file for use in the Avocadoge iOS app.
swift run DogecoinNodeSync export --output <path> [OPTIONS]| Option | Description | Default |
|---|---|---|
--output <path> |
Output directory for exported files (required) | — |
--network <network> |
Network to export (mainnet or testnet) |
mainnet |
--storage <path> |
Source header cache location | ~/Library/Caches/DogecoinKit/headers/<network> |
--format <format> |
Export format (sqlite or lzfse) |
sqlite |
# Export mainnet headers to SQLite format
swift run DogecoinNodeSync export --output ./headers
# Export to LZFSE compressed format (smaller file size)
swift run DogecoinNodeSync export --output ./headers --format lzfse
# Export testnet headers
swift run DogecoinNodeSync export --network testnet --output ./testnet-headers
# Export from a custom source location
swift run DogecoinNodeSync export --output ./headers --storage ~/Desktop/dogecoin-headersThe export creates two files in the output directory:
headers.sqlite(orheaders.bin.lzfse) — The header datametadata.json— Metadata including header count, tip hash, and checksum
Validate a header cache file to ensure integrity.
swift run DogecoinNodeSync verify <path>| Argument | Description |
|---|---|
<path> |
Path to headers.sqlite, headers.bin.lzfse, or their directory |
# Verify a header cache directory
swift run DogecoinNodeSync verify ./headers
# Verify a specific file
swift run DogecoinNodeSync verify ./headers/headers.sqlite- File size matches metadata
- SHA256 checksum matches
- Header count matches
- Tip height and hash match
- Chain linkage is valid (sampled verification)
Print basic information about a header cache file.
swift run DogecoinNodeSync inspect <path>| Argument | Description |
|---|---|
<path> |
Path to headers.sqlite, headers.bin.lzfse, or their directory |
swift run DogecoinNodeSync inspect ./headersHeader cache:
Format: SQLite
Version: 2
Network: mainnet
Headers: 6,123,456
Tip: 6123455 82a1b3c4d5e6f7...
Generated: 2024-01-15T10:30:00Z
Database size: 523456789 bytes
Checksum SHA256: abc123...
-
Sync headers from the Dogecoin network:
swift run DogecoinNodeSync sync
-
Export headers for bundling into the iOS app:
swift run DogecoinNodeSync export --output ./headers -
Verify the export (optional but recommended):
swift run DogecoinNodeSync verify ./headers
-
Inspect the export to check details:
swift run DogecoinNodeSync inspect ./headers
| Type | Default Path |
|---|---|
| Synced headers | ~/Library/Caches/DogecoinKit/headers/<network>/ |
| Exported files | User-specified via --output |
| Format | File | Best For |
|---|---|---|
sqlite |
headers.sqlite |
Fast loading, random access, larger size |
lzfse |
headers.bin.lzfse |
Smaller bundle size, sequential access only |
SQLite is recommended for the iOS app due to faster load times.