Skip to content

Commit

Permalink
docs: updated tools.md for spvnode
Browse files Browse the repository at this point in the history
  • Loading branch information
edtubbs committed Nov 7, 2023
1 parent dc2998c commit 844b082
Showing 1 changed file with 91 additions and 1 deletion.
92 changes: 91 additions & 1 deletion doc/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

If you are looking to just explore the functionality of Libdogecoin without building a complicated project yourself, look no further than the CLI tools provided in this repo. The first tool, `such`, is an interactive CLI application that allows you to perform all Essential address and transaction operations with prompts to guide you through the process. The second tool, `sendtx`, handles the process of broadcasting a transaction built using Libdogecoin to eventually push it onto the blockchain.
If you are looking to just explore the functionality of Libdogecoin without building a complicated project yourself, look no further than the CLI tools provided in this repo. The first tool, `such`, is an interactive CLI application that allows you to perform all Essential address and transaction operations with prompts to guide you through the process. The second tool, `sendtx`, handles the process of broadcasting a transaction built using Libdogecoin to eventually push it onto the blockchain. The third tool, `spvnode`, run a Simple Payment Verification (SPV) node for the Dogecoin blockchain. It enables users to interact with the Dogecoin network, verify transactions, and stay in sync with the blockchain without the need for a full node's resource requirements.

This document goes over the usage of these tools along with examples of how to use them.

Expand Down Expand Up @@ -234,3 +234,93 @@ Below are some examples on how to use the `sendtx` tool in practice.
##### Send a raw transaction to at most 5 random peers on mainnet

./sendtx -m 5 <tx_hex>


## The `spvnode` Tool

`spvnode` is a command-line tool that runs a Simple Payment Verification (SPV) node for the Dogecoin blockchain. It enables users to interact with the Dogecoin network, verify transactions, and stay in sync with the blockchain without the need for a full node's resource requirements.

### Usage

To use `spvnode`, execute it from the top level of the Libdogecoin directory. Start the tool by running `./spvnode` followed by the `scan` command. There are several flags that can be used to customize the behavior of `spvnode`:

Each flag is accompanied by a description and usage example. To view the version of `spvnode`, simply run:

./spvnode -v


| Flag | Name | Required Arg? | Usage |
|------|------|---------------|-------|
| `-t`, `--testnet` | Testnet Mode | No | Activate testnet: `./spvnode -t scan` |
| `-r`, `--regtest` | Regtest Mode | No | Activate regtest network: `./spvnode -r scan` |
| `-i`, `--ips` | Initial Peers | Yes | Specify initial peers: `./spvnode -i 127.0.0.1:22556 scan` |
| `-d`, `--debug` | Debug Mode | No | Enable debug output: `./spvnode -d scan` |
| `-m`, `--maxnodes` | Max Peers | No | Set max peers: `./spvnode -m 8 scan` |
| `-n`, `--mnemonic` | Mnemonic Seed | Yes | Use BIP39 mnemonic: `./spvnode -n "your mnemonic here" scan` |
| `-s`, `--pass_phrase` | Passphrase | Yes | Passphrase for BIP39 seed: `./spvnode -s "your passphrase" scan` |
| `-f`, `--dbfile` | Database File | No | Headers DB file: `./spvnode -f ./headers.db scan` |
| `-c`, `--continuous` | Continuous Mode | No | Run continuously: `./spvnode -c scan` |
| `-b`, `--full_sync` | Full Sync | No | Perform a full sync: `./spvnode -b scan` |
| `-p`, `--checkpoint` | Checkpoint | No | Enable checkpoint sync: `./spvnode -p scan` |
| `-w`, `--wallet_file` | Wallet File | Yes | Specify wallet file: `./spvnode -w "./wallets/wallet.db" scan` |
| `-h`, `--headers_file` | Headers File | Yes | Specify headers DB file: `./spvnode -h "./headers/headers.db" scan` |
| `-y`, `--encrypted_file` | Encrypted File | Yes | Use encrypted file: `./spvnode -y 0 scan` |
| `-j`, `--use_tpm` | Use TPM | No | Utilize TPM for decryption: `./spvnode -j scan` |
| `-k`, `--master_key` | Master Key | No | Use master key decryption: `./spvnode -k scan` |
| `-z`, `--daemon` | Daemon Mode | No | Run as a daemon: `./spvnode -z scan` |

### Commands

The primary command for `spvnode` is `scan`, which syncs the blockchain headers:

#### `scan`
Connects to the Dogecoin network and synchronizes the blockchain headers to the local database.

### Callback Functions

The tool provides several callbacks for custom integration:

- `spv_header_message_processed`: Triggered when a header is processed.
- `spv_sync_completed`: Invoked upon completion of the sync process.


## Examples

#### Sync up to the chain tip and stores all headers in `headers.db` (quit once synced):
spvnode scan

#### Sync up to the chain tip and give some debug output during that process:
spvnode -d scan

#### Sync up, show debug info, don't store headers in file (only in memory), wait for new blocks:
spvnode -d -f 0 -c scan

#### Sync up, with a wallet file (ex. ./wallets/main_wallet.db), show debug info, don't store headers in file, wait for new blocks:
spvnode -d -f 0 -c -w "./wallets/main_wallet.db" scan

#### Sync up, with a wallet file (ex. ./wallets/main_wallet.db), show debug info, with a headers file (ex. ./headers/main_headers.db), wait for new blocks:
spvnode -d -c -w "./wallets/main_wallet.db" -h "./headers/main_headers.db" scan

#### Sync up, with encrypted mnemonic 0, show debug info, don't store headers in file, wait for new blocks:
spvnode -d -f 0 -c -y 0 scan

#### Sync up, with encrypted mnemonic 0, pass phrase 'test', show debug info, don't store headers in file, wait for new blocks:
spvnode -d -f 0 -c -y 0 -a "test" scan

#### Sync up, with encrypted mnemonic 0, pass phrase 'test', show debug info, don't store headers in file, wait for new blocks, use TPM:
spvnode -d -f 0 -c -y 0 -a "test" -j scan

#### Sync up, with encrypted key 0, show debug info, don't store headers in file, wait for new blocks, use master key:
spvnode -d -f 0 -c -y 0 -k scan

#### Sync up, with encrypted key 0, show debug info, don't store headers in file, wait for new blocks, use master key, use TPM:
spvnode -d -f 0 -c -y 0 -k -j scan

#### Sync up, with mnemonic 'test', pass phrase 'test', show debug info, don't store headers in file, wait for new blocks:
spvnode -d -f 0 -c -n "test" -a "test" scan

#### Sync up, with a wallet file (ex. ./wallets/main_wallet.db), with encrypted mnemonic 0, show debug info, don't store headers in file, wait for new blocks:
spvnode -d -f 0 -c -w "./wallets/main_wallet.db" -y 0 scan

#### Sync up, with a wallet file (ex. ./wallets/main_wallet.db), with encrypted mnemonic 0, show debug info, with a headers file (ex. ./headers/main_headers.db), wait for new blocks:
spvnode -d -c -w "./wallets/main_wallet.db" -h "./headers/main_headers.db" -y 0 scan

0 comments on commit 844b082

Please sign in to comment.