AcceptResult | interface | { added, duplicates, tipChanged, reorg?, error?, errorIndex?, last?, sideAdded } | Result of adding a batch of headers to a HeaderChain: how many were new, whether the tip or a reorg happened, and the first failure (later headers of the batch were not looked at). |
AddrEntry | interface | { time } | An address from an `addr` message: a network address plus the time the sender last saw it (Unix seconds). |
allowDigishieldMinDifficultyForBlock | function | allowDigishieldMinDifficultyForBlock(last: IndexView, newBlockTime: number, era: ConsensusEra, params: ChainParams): boolean; | AllowDigishieldMinDifficultyForBlock (dogecoin.cpp:26-39). |
AncestorFn | type | AncestorFn = (height: number) => IndexView; | Ancestor access on the same branch as `last` (CBlockIndex::GetAncestor / pprev). |
AuxPow | interface | { coinbaseTx, parentHash, merkleBranch, index, chainMerkleBranch, chainIndex, parentBlock } | Merged-mining proof (CAuxPow): the parent block's coinbase transaction and the two merkle branches that tie it to this block. |
AUXPOW_CHAIN_ID | const | AUXPOW_CHAIN_ID = 98 | chainparams.cpp:120, 276, 417: `consensus.nAuxpowChainId = 0x0062; // 98 - Josh Wise!` |
AuxPowAvailability | type | AuxPowAvailability = 'absent' | 'present' | 'missing'; | Whether a header's merged-mining proof was available: `absent` (not needed), `present`, or `missing` (flagged but only 80 bytes given, so its proof of work cannot be checked). |
AuxPowCheckParams | interface | { strictChainId } | Parameters of the AuxPoW check: whether the chain id in the version must match the network's (`strictChainId`). |
bigIntToHash | function | bigIntToHash(n: bigint): Uint8Array; | Inverse of hashToBigInt: 32 bytes little-endian. |
BlockHeader | interface | { auxpow? } | A Dogecoin block header as sent on the wire: 80 bytes plus AuxPoW when the version flag is set. |
blockProof | function | blockProof(bits: number): bigint; | GetBlockProof (chain.cpp:150-163): ~target / (target + 1) + 1, or 0 for an invalid target. |
buildPartialMerkleTree | function | buildPartialMerkleTree(txids: readonly Uint8Array[], match: readonly boolean[]): PartialMerkleTree; | Builds a tree the way gettxoutproof does (CPartialMerkleTree ctor + TraverseAndBuild, merkleblock.cpp:78-146). |
ByteReader | class | class: position, remaining, data, bytes(), slice(), u8(), u16(), u16be(), u32(), i32(), u64(), i64(), compactSize(), varBytes(), hashes(), end() | Strict little-endian reader: every read is bounds-checked and fails with PARSE_ERROR. |
bytesToHex | function | bytesToHex(bytes: Uint8Array): string; | Lowercase hex of `bytes`. |
bytesToIp | function | bytesToIp(b: Uint8Array): string; | Formats the 16-byte network form of an address as dotted IPv4 (for ::ffff:a.b.c.d) or colon- separated IPv6 groups. |
ByteWriter | class | class: bytes(), u8(), u16(), u16be(), u32(), i32(), u64(), i64(), compactSize(), varBytes(), hashes(), length, finish() | Little-endian serializer. |
calculateDogecoinNextWorkRequired | function | calculateDogecoinNextWorkRequired(last: IndexView, firstBlockTime: number, era: ConsensusEra, powLimit: bigint): number; | CalculateDogecoinNextWorkRequired (dogecoin.cpp:41-85). Note it never reads fPowNoRetargeting, unlike Bitcoin's CalculateNextWorkRequired. |
calculateNextWorkRequired | function | calculateNextWorkRequired(last: IndexView, firstBlockTime: number, era: ConsensusEra, powLimit: bigint): number; | Bitcoin's CalculateNextWorkRequired (pow.cpp:90-113). Dogecoin consensus never calls it (GetNextWorkRequired uses the Dogecoin function); it is ported only so Core's pow_tests.cpp vectors can be run. |
CHAIN_PARAMS | const | CHAIN_PARAMS: Readonly<Record<NetworkName, ChainParams>> | The parameters of every built-in network, by name. Frozen. |
ChainEntry | interface | { height, hash, hashHex, header, chainWork, powVerified } | A header in a HeaderChain with its height, hash, accumulated work and whether this node checked its proof of work. |
ChainOptions | interface | { trustCheckpoints?, now?, forkWindow?, maxSideHeaders? } | Options for HeaderChain.memory and HeaderChain.open: trust-checkpoints mode, clock, fork window and side-chain limit. |
ChainParams | interface | { name, coreName, magic, defaultPort, dnsSeeds, powLimit, auxpowChainId, strictChainId, minimumChainWork, genesis, checkpoints, consensusRoot, eras, newDifficultyProtocolHeight, digishieldMinDifficultyHeight } | Consensus and network parameters of one Dogecoin network: magic bytes, ports, DNS seeds, genesis block, checkpoints and difficulty eras. |
ChainStatus | interface | { network, height, tipHash, tipTime, chainWork, verifiedHeight, trustCheckpoints, minimumChainWorkReached, lastCheckpointHeight, sideHeaders } | Summary of a HeaderChain: network, height, tip, total work, how far verification reaches and whether the minimum chain work was reached. |
checkAuxPow | function | checkAuxPow(auxpow: AuxPow, hashAuxBlock: Uint8Array, chainId: number, params: AuxPowCheckParams): void; | Checks a merged-mining proof (AuxPoW) against the block it belongs to, step by step as Core does. Throws NodeError INVALID_HEADER on failure. |
checkAuxPowProofOfWork | function | checkAuxPowProofOfWork(block: BlockHeader, params: ChainParams, pow?: Uint8Array): void; | CheckAuxPowProofOfWork (dogecoin.cpp:87-123). Throws NodeError INVALID_HEADER with reason "high-hash" and DoS 50, which is what CheckBlockHeader turns any failure here into (validation.cpp:2932-2933). |
checkMerkleBranch | function | checkMerkleBranch(hash: Uint8Array, branch: readonly Uint8Array[], index: number): Uint8Array; | Folds a merkle branch from a leaf hash and its index up to the root (the AuxPoW merkle check). |
Checkpoint | interface | { height, hash } | A block hash that Dogecoin Core hard-codes for a height. |
checkpointAt | function | checkpointAt(params: ChainParams, height: number): Uint8Array | undefined; | Checkpoint hash at exactly `height`, if one exists (internal byte order). |
checkProofOfWork | function | checkProofOfWork(hash: Uint8Array, bits: number, powLimit: bigint): boolean; | CheckProofOfWork (pow.cpp:115-132). `hash` in internal byte order. |
CoinbaseInput | interface | { prevHash, prevIndex, scriptSig, sequence, witness } | The input of a parent block's coinbase transaction, as stored in an AuxPoW. |
CoinbaseOutput | interface | { value, script } | An output of a parent block's coinbase transaction: value in koinu and script. |
CompactResult | interface | { target, negative, overflow } | Result of decoding a compact difficulty value (nBits): the 256-bit target and the negative and overflow flags. |
compactToTarget | function | compactToTarget(compact: number): CompactResult; | arith_uint256::SetCompact (arith_uint256.cpp:204-222). |
ConsensusEra | interface | { heightEffective, powTargetTimespan, powTargetSpacing, digishield, allowMinDifficultyBlocks, allowDigishieldMinDifficultyBlocks, powNoRetargeting, allowLegacyBlocks, bip65Height, bip66Height } | One set of consensus parameters, valid from `heightEffective`. Core copies the whole Consensus::Params struct per era (chainparams.cpp:126-136, 282-300, 425-432); so does this file, field for field, for the fields that matter to header validation. |
ConsensusNode | interface | { era, left?, right? } | A node of the binary tree of consensus eras that selects the rules in force at a height. |
ContextOptions | interface | { ancestor, medianTimePast, now, highestCheckpointOnChain } | What a contextual header check needs to look back at the chain: ancestors by height, median time past and the clock. |
contextualCheckBlockHeader | function | contextualCheckBlockHeader(h: PureHeader, hash: Uint8Array, prev: IndexView, params: ChainParams, ctx: ContextOptions): void; | ContextualCheckBlockHeader (validation.cpp:3065-3118) for a header at `prev.height + 1`, followed by the DogeJS exact-checkpoint rule. Throws NodeError INVALID_HEADER with Core's reject reason. |
crc32 | function | crc32(data: Uint8Array, start?: number, end?: number): number; | CRC-32 (IEEE 802.3, as zlib). |
decodeAddr | function | decodeAddr(payload: Uint8Array): AddrEntry[]; | addr payload with nTime (protocol.h CAddress, version >= CADDR_TIME_VERSION). |
decodeGetHeaders | function | decodeGetHeaders(payload: Uint8Array): { version: number; locator: Uint8Array[]; hashStop: Uint8Array; }; | Decodes a `getheaders` payload: protocol version, block locator hashes and stop hash. Throws NodeError PARSE_ERROR on truncated data. |
decodeHeaders | function | decodeHeaders(payload: Uint8Array): HeadersEntry[]; | Decodes a headers payload (net_processing.cpp:2397-2408). More than MAX_HEADERS_RESULTS headers is a protocol violation (Core: Misbehaving 20). |
decodeInv | function | decodeInv(payload: Uint8Array): InvItem[]; | Decodes an `inv` payload into items. Throws NodeError PROTOCOL_ERROR for more than the allowed number of items and PARSE_ERROR for truncated data. |
decodeNonce | function | decodeNonce(payload: Uint8Array): bigint; | Decodes the 8-byte nonce of a `ping` or `pong` payload. |
decodeVersion | function | decodeVersion(payload: Uint8Array): VersionMessage; | Parses a version payload the way net_processing.cpp:1399-1437 reads it (later fields optional). |
DEFAULT_BANSCORE_THRESHOLD | const | DEFAULT_BANSCORE_THRESHOLD = 100 | validation.h:146 `DEFAULT_BANSCORE_THRESHOLD = 100;` |
DEFAULT_CONNECT_TIMEOUT | const | DEFAULT_CONNECT_TIMEOUT = 5000 | netbase.h:25 `DEFAULT_CONNECT_TIMEOUT = 5000;` ms |
difficulty | function | difficulty(bits: number): number; | Difficulty as Core's GetDifficulty prints it (rpc/blockchain.cpp:53-80), for display only. |
electrumMerkleRoot | function | electrumMerkleRoot(txid: string, merkle: readonly string[], pos: number): string; | Computes the merkle root from a txid and an Electrum-style merkle branch (displayed hex). Throws NodeError INVALID_PROOF on a malformed branch. |
encodeAddr | function | encodeAddr(list: readonly AddrEntry[]): Uint8Array; | Encodes an `addr` payload (with times) from a list of entries. |
encodeGetHeaders | function | encodeGetHeaders(locator: readonly Uint8Array[], hashStop?: Uint8Array, version?: number): Uint8Array; | getheaders payload: CBlockLocator (int32 version + vector<uint256>, block.h:142-146) then hashStop. |
encodeHeaders | function | encodeHeaders(entries: readonly (BlockHeader | HeadersEntry)[]): Uint8Array; | headers payload: CompactSize n, then n x (CBlockHeader incl. AuxPoW, CompactSize tx count). |
encodeInv | function | encodeInv(items: readonly InvItem[]): Uint8Array; | Encodes an `inv` payload from a list of items. |
encodeMessage | function | encodeMessage(magic: Uint8Array, command: string, payload?: Uint8Array): Uint8Array; | Builds one framed message. |
encodeNonce | function | encodeNonce(nonce: bigint): Uint8Array; | Encodes a `ping` or `pong` nonce as 8 little-endian bytes. |
encodeVersion | function | encodeVersion(v: VersionMessage): Uint8Array; | The fields PushNodeVersion sends (net_processing.cpp:285-286). |
extractMatches | function | extractMatches(tree: PartialMerkleTree): ExtractResult; | Reads a partial merkle tree: returns its merkle root and the transaction hashes it proves, or a null root if malformed. |
ExtractResult | interface | { root, matches, indexes } | Result of reading a partial merkle tree: the merkle root (null if the tree is malformed) and the matched transaction hashes. |
genesisHeader | function | genesisHeader(params: ChainParams): PureHeader; | The genesis header of `params` (chainparams.cpp CreateGenesisBlock fields). |
GenesisHeader | interface | { version, merkleRoot, time, bits, nonce, hash } | The fields of a network's genesis block header, as Core's chainparams.cpp states them. |
getBaseVersion | function | getBaseVersion(version: number): number; | pureheader.h:92-95 `return ver % VERSION_AUXPOW;` (C++ remainder: sign follows the dividend, like JS %). |
getChainId | function | getChainId(version: number): number; | pureheader.h:110-113 `return nVersion >> 16;` (arithmetic shift of an int32). |
getChainParams | function | getChainParams(name: NetworkName): ChainParams; | Returns the parameters of a built-in network by name. Throws an Error for an unknown name. |
getConsensus | function | getConsensus(params: ChainParams, height: number): ConsensusEra; | Returns the consensus era (rules and parameters) in force at `height`. |
getExpectedIndex | function | getExpectedIndex(nonce: number, chainId: number, h: number): number; | Expected position of a merge-mined block in the chain merkle tree, from the nonce, chain id and tree height. |
getNextWorkRequired | function | getNextWorkRequired(last: IndexView | null, newBlockTime: number, era: ConsensusEra, params: ChainParams, ancestor: AncestorFn): number; | GetNextWorkRequired (pow.cpp:32-88), ported line by line. |
hashHexToBigInt | function | hashHexToBigInt(hex: string): bigint; | Integer value of a displayed hash (for comparisons with targets). |
hashToBigInt | function | hashToBigInt(hash: Uint8Array): bigint; | Reads a 32-byte hash (little-endian, internal order) as a number. |
hashToHex | function | hashToHex(hash: Uint8Array): string; | Displayed (RPC / explorer) hex of a 32-byte hash stored in internal (wire) order. |
HEADER_SIZE | const | HEADER_SIZE = 80 | Size in bytes of a block header without AuxPoW (80). |
HeaderChain | class | class: params, lastOpen, memory(), open(), close(), tip, height, hashAt(), headerAt(), findMainHeight(), knows(), isInvalid(), verifiedHeight, minimumChainWorkReached, status(), locator(), locatorFrom(), medianTimePast(), acceptHeaders(), sideHeaders | A verified chain of block headers, in memory (HeaderChain.memory) or persisted in a directory (HeaderChain.open). Accepts headers in batches, applies Dogecoin's consensus header rules for every era (proof of work, difficulty, timestamps, checkpoints, AuxPoW) and follows the chain with the most work. |
headerHash | function | headerHash(h: PureHeader | Uint8Array): Uint8Array; | Block hash: SHA256d of the 80 bytes (pureheader.cpp:20-23 SerializeHash). Internal byte order. |
headerHashHex | function | headerHashHex(h: PureHeader | Uint8Array): string; | Displayed (RPC) block hash. |
HeadersEntry | interface | { header, txCount } | One entry of a `headers` message: the header and the transaction count that follows it on the wire. |
HeaderStore | class | class: dir, count, open(), read(), readRange(), candidates(), append(), truncate(), writeState(), close() | The on-disk file that persists a HeaderChain: fixed-size records, checksummed, recovered after a crash. Normally used through HeaderChain.open. |
HeaderSync | class | class: chain, banned, synced, start(), stop(), waitForSync(), progress(), headersReceived | Downloads headers from peers into a HeaderChain and cross-checks the tip with other peers. Emits `progress`, `synced`, `reorg`, `peer-connected`, `peer-closed` and `error`. Needs network access to Dogecoin peers. |
hexToBytes | function | hexToBytes(input: string, name?: string): Uint8Array; | Strict hex: even length, hex digits only, no prefix or whitespace. |
hexToHash | function | hexToHash(hex: string, name?: string): Uint8Array; | Internal (wire) order bytes of a displayed 64-hex-char hash. |
IndexView | interface | { height, time, bits } | Minimal view of a CBlockIndex used by the difficulty rules. |
InvItem | interface | { type, hash } | An inventory item of an `inv` message: its type number and 32-byte hash. |
ipToBytes | function | ipToBytes(ip: string): Uint8Array; | IPv4 / IPv6 text to the 16-byte form. |
isAuxpowVersion | function | isAuxpowVersion(version: number): boolean; | pureheader.h:129-132 `return nVersion & VERSION_AUXPOW;` |
isLegacyVersion | function | isLegacyVersion(version: number): boolean; | pureheader.h:150-155: version 1, or version 2 with chain ID 0 ("Dogecoin: We have a random v2 block with no AuxPoW, treat as legacy"). Note `nVersion == 2` already implies chain ID 0; the extra test is kept as in Core. |
lastCheckpoint | function | lastCheckpoint(params: ChainParams): Checkpoint; | Highest checkpoint (Core: the last entry of mapCheckpoints). |
LightFailureCode | type | LightFailureCode = /** Bytes could not be parsed. */ 'malformed' /** A header does not commit to the previous header's hash. */ | 'linkage' /** nBits is not a valid target, or it is easier than the network's powLimit. */ | 'bad-target' /** The scrypt hash (or the AuxPoW parent's) is above the target, or the AuxPoW proof is invalid. */ | 'pow' /** The header's target is easier than the caller's ... | Why verifyHeaderChain rejected a list of headers: malformed, linkage, bad-target, pow, below-floor, checkpoint, anchor, difficulty-rule, auxpow-missing or bad-input. |
LightHeaderReport | interface | { index, height?, hash, prevHash, merkleRoot, time, bits, version, auxpow, pow, work, difficultyRule, checkpoint? } | What verifyHeaderChain found out about one header: its index and hash and whether its proof of work was verified. |
LooseHeader | interface | { header, pure, auxpow, hash } | A header parsed on its own: the header, its 80 hashed bytes, its hash and whether its AuxPoW is present. |
mainnetParams | const | mainnetParams: ChainParams | Parameters of the Dogecoin main network. Frozen. |
makeTransaction | function | makeTransaction(fields: Pick<ParsedTransaction, 'version' | 'inputs' | 'outputs' | 'locktime'>): ParsedTransaction; | Builds a ParsedTransaction from fields (canonical bytes as `raw`). Used to construct test parent coinbases. |
makeVersion | function | makeVersion(baseVersion: number, chainId: number, auxpow?: boolean): number; | pureheader.cpp:13-18 SetBaseVersion (without the asserts it throws). |
MAX_ADDR_TO_SEND | const | MAX_ADDR_TO_SEND = 1000 | net.h:57 `MAX_ADDR_TO_SEND = 1000;` (also the addr receive limit, net_processing.cpp:1600) |
MAX_BLOCKS_TO_ANNOUNCE | const | MAX_BLOCKS_TO_ANNOUNCE = 8 | validation.h:154 `MAX_BLOCKS_TO_ANNOUNCE = 8;` |
MAX_CHAIN_MERKLE_BRANCH | const | MAX_CHAIN_MERKLE_BRANCH = 30 | auxpow.cpp:90 `if (vChainMerkleBranch.size() > 30)` |
MAX_FUTURE_BLOCK_TIME | const | MAX_FUTURE_BLOCK_TIME: number | validation.cpp:3106 `nAdjustedTime + 2 * 60 * 60` |
MAX_HEADERS_RESULTS | const | MAX_HEADERS_RESULTS = 2000 | validation.h:100 `MAX_HEADERS_RESULTS = 2000;` |
MAX_INV_SZ | const | MAX_INV_SZ = 50000 | net.h:53 `MAX_INV_SZ = 50000;` |
MAX_LIGHT_HEADERS | const | MAX_LIGHT_HEADERS = 2000 | Default cap on the number of headers verifyHeaderChain accepts in one call. |
MAX_LOCATOR_SZ | const | MAX_LOCATOR_SZ = 101 | net.h:55 `MAX_LOCATOR_SZ = 101;` |
MAX_PMT_TRANSACTIONS | const | MAX_PMT_TRANSACTIONS: number | consensus/consensus.h:17 `MAX_BLOCK_BASE_SIZE = 1000000`; merkleblock.cpp:156 divides by 60. |
MAX_PROTOCOL_MESSAGE_LENGTH | const | MAX_PROTOCOL_MESSAGE_LENGTH: number | net.h:59 `MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000;` |
MAX_SIZE | const | MAX_SIZE = 33554432 | Largest size accepted for a CompactSize value or message payload, in bytes (0x02000000). |
MAX_SUBVERSION_LENGTH | const | MAX_SUBVERSION_LENGTH = 256 | net.h:61 `MAX_SUBVERSION_LENGTH = 256;` |
MAX_UNCONNECTING_HEADERS | const | MAX_UNCONNECTING_HEADERS = 10 | validation.h:157 `MAX_UNCONNECTING_HEADERS = 10;` |
MEDIAN_TIME_SPAN | const | MEDIAN_TIME_SPAN = 11 | chain.h:284 `enum { nMedianTimeSpan=11 };` |
MERGED_MINING_HEADER | const | MERGED_MINING_HEADER: Uint8Array<ArrayBuffer> | auxpow.h:24 `pchMergedMiningHeader[] = { 0xfa, 0xbe, 'm', 'm' };` |
MerkleBlock | interface | { header, tree } | A parsed `merkleblock` (the format of Core's `gettxoutproof`): a header and a partial merkle tree. |
MerkleBlockProofResult | interface | { header, headerBytes, index, nTransactions } | Result of verifyMerkleBlockProof: the header as it came in the proof, its bytes, and the position of the transaction. |
merkleBranch | function | merkleBranch(leaves: readonly Uint8Array[], index: number): Uint8Array[]; | Merkle branch for leaf `index` (merkle_tests.cpp:42-54 BlockGetMerkleBranch). |
merkleRoot | function | merkleRoot(leaves: readonly Uint8Array[]): { root: Uint8Array; mutated: boolean; }; | Merkle root of `leaves` (internal byte order). Empty list gives 32 zero bytes, as Core. |
MESSAGE_HEADER_SIZE | const | MESSAGE_HEADER_SIZE = 24 | protocol.h:32-39 |
MessageDecoder | class | class: pending, push() | Incremental frame decoder. `push` returns complete messages and throws NodeError('PROTOCOL_ERROR') on anything Core would reject or this node bans. |
MIN_PEER_PROTO_VERSION | const | MIN_PEER_PROTO_VERSION = 70003 | version.h:23 `static const int MIN_PEER_PROTO_VERSION = 70003;` |
MSG_BLOCK | const | MSG_BLOCK = 2 | protocol.h:334 |
MSG_TX | const | MSG_TX = 1 | protocol.h:333 |
NetAddress | interface | { services, ip, port } | A peer network address: service bits, the 16-byte IP and the port. |
NODE_BLOOM | const | NODE_BLOOM: number | protocol.h:269 |
NODE_NETWORK | const | NODE_NETWORK = 1 | protocol.h:261 |
NodeError | class | class: code, reason, dos | Error thrown by every `@dogejs/node` function. Parsers never throw anything else on malformed input (this is checked by seeded fuzz tests). |
NodeErrorCode | type | NodeErrorCode = /** Bytes could not be parsed (truncated, non-canonical, trailing data, out of range). */ 'PARSE_ERROR' /** A caller passed a bad argument. */ | 'INVALID_ARGUMENT' /** A block header broke a consensus rule. `reason` holds Dogecoin Core's reject reason. */ | 'INVALID_HEADER' /** A merkle / txout proof did not verify. */ | 'INVALID_PROOF' /** A peer broke the P2P protocol (framing... | Machine-readable reason codes for NodeError. |
OpenResult | interface | { store, recovery, dropped, state } | Result of opening a HeaderStore: the store, how it was brought back to a consistent state, how many records were dropped and the cached state if valid. |
parentBlockHashHex | function | parentBlockHashHex(a: AuxPow): string; | Convenience: displayed hash of the parent block (its sha256d, not its PoW hash). |
parseBlockHeader | function | parseBlockHeader(bytes: Uint8Array): BlockHeader; | Parses one full header (80 bytes + optional AuxPoW), no trailing bytes allowed. |
ParsedTransaction | interface | { version, inputs, outputs, locktime, raw, txid } | A parent coinbase transaction as parsed inside an AuxPoW, with its raw bytes. |
parseHeaderLoose | function | parseHeaderLoose(input: Uint8Array | string): LooseHeader; | Parses a block header with or without its AuxPoW. Throws NodeError PARSE_ERROR on anything else. |
parseMerkleBlock | function | parseMerkleBlock(input: Uint8Array | string): MerkleBlock; | Parses a `merkleblock` (bytes or hex). Throws NodeError on malformed data. |
parsePureHeader | function | parsePureHeader(bytes: Uint8Array): PureHeader; | Parses exactly 80 bytes. |
parseTransaction | function | parseTransaction(bytes: Uint8Array): ParsedTransaction; | Parses exactly one transaction (no trailing bytes). |
PartialMerkleTree | interface | { nTransactions, hashes, flags, bitCount } | A partial merkle tree (CPartialMerkleTree): the number of transactions, the hashes and the flag bits. |
Peer | class | class: host, port, params, id, ready, remoteVersion, closed, connect(), send(), sendGetHeaders(), close() | One outbound connection. Emits 'ready' after version/verack, then 'headers', 'inv', 'addr' and 'message'; 'close' exactly once with the reason and whether the peer should be banned for the session. |
PeerAddress | interface | { host, port } | Host and port of a peer to connect to. |
PeerCloseReason | type | PeerCloseReason = { readonly message: string; readonly ban: boolean; }; | Why a peer connection was closed and whether the peer should be banned. |
PeerEvents | interface | { ready, headers, inv, addr, message, close } | Events a Peer emits and their payloads: `ready`, `headers`, `inv`, `addr`, `message` and `close`. |
PeerInfo | interface | { id, ready, userAgent, startHeight, bestKnownHeight, agrees, score } | What HeaderSync knows about a connected peer: user agent, start and best known height, agreement with our tip and misbehaviour score. |
PeerOptions | interface | { host, port, params, startHeight?, userAgent?, connectTimeoutMs?, handshakeTimeoutMs?, messageTimeoutMs?, idleTimeoutMs?, pingIntervalMs?, maxMessageSize?, socketFactory? } | Options for a Peer: host, port, network parameters, our height and timeouts. |
PING_INTERVAL | const | PING_INTERVAL: number | net.h:47 `PING_INTERVAL = 2 * 60;` seconds |
powHash | function | powHash(h: PureHeader | Uint8Array): Uint8Array; | Proof-of-work hash: scrypt with N=1024, r=1, p=1, 32-byte output, the 80-byte header as both password and salt. Core: pureheader.cpp:25-30 calls scrypt_1024_1_1_256(BEGIN(nVersion), ...); crypto/scrypt.cpp:187-218 runs PBKDF2_SHA256(input, 80, input, 80, 1, B, 128), 1024 rounds of the Salsa20/8 ROMix, then PBKDF2_SHA256(input, 80, B, 128, 1, output, 32), which is standard scrypt(N=1024, r=1, p=1, dkLen=32). Computed with node:crypto (OpenSSL); the tests cross-check it against `@noble/hashes` scrypt and Core's vectors. |
powHashAsync | function | powHashAsync(bytes: Uint8Array): Promise<Uint8Array>; | Same as powHash on the libuv thread pool, so many headers hash in parallel. |
powPreimage | function | powPreimage(block: BlockHeader): Uint8Array; | The 80 bytes whose scrypt hash must meet the target: the block itself, or its AuxPoW parent. |
ProofResult | interface | { txids, indexes, blockHash, height, confirmations, merkleRoot } | Result of verifyTxOutProof: the transaction ids proven to be in a block, their positions and the block hash. |
PROTOCOL_VERSION | const | PROTOCOL_VERSION = 70015 | version.h:14 `static const int PROTOCOL_VERSION = 70015;` |
PureHeader | interface | { version, prevHash, merkleRoot, time, bits, nonce } | The 80-byte part of a block header: version, previous hash, merkle root, time, bits and nonce. |
RawMessage | interface | { command, payload } | A framed peer-to-peer message: the command name and its payload. |
readAuxPow | function | readAuxPow(r: ByteReader): AuxPow; | Reads an AuxPoW from a ByteReader. Throws NodeError on malformed data. |
readBlockHeader | function | readBlockHeader(r: ByteReader): BlockHeader; | Reads a block header (80 bytes, plus the AuxPoW when the version flags one) from a ByteReader. |
readPartialMerkleTree | function | readPartialMerkleTree(r: ByteReader): PartialMerkleTree; | Reads a partial merkle tree from a ByteReader. |
readPureHeader | function | readPureHeader(r: ByteReader): PureHeader; | Reads the 80-byte header part from a ByteReader. |
readTransaction | function | readTransaction(r: ByteReader): ParsedTransaction; | Reads one transaction at the reader's position (witness allowed, as Core does on P2P streams). |
RECORD_SIZE | const | RECORD_SIZE = 88 | Size in bytes of one record in the header store file (88). |
regtestParams | const | regtestParams: ChainParams | Parameters of the Dogecoin regression-test network. Frozen. |
SENDHEADERS_VERSION | const | SENDHEADERS_VERSION = 70012 | version.h:39 `static const int SENDHEADERS_VERSION = 70012;` |
serializeAuxPow | function | serializeAuxPow(a: AuxPow): Uint8Array; | Serialises an AuxPoW. |
serializeBlockHeader | function | serializeBlockHeader(h: BlockHeader): Uint8Array; | Serialises a block header: 80 bytes, followed by the AuxPoW when the version flags one. |
serializeMerkleBlock | function | serializeMerkleBlock(mb: MerkleBlock): Uint8Array; | Serialises a `merkleblock`. |
serializePureHeader | function | serializePureHeader(h: PureHeader): Uint8Array; | Serialises the 80-byte header part. |
serializeTransaction | function | serializeTransaction(tx: Pick<ParsedTransaction, 'version' | 'inputs' | 'outputs' | 'locktime'>, withWitness?: boolean): Uint8Array; | Serialises a transaction canonically; the witness form is used only if asked and some input has a witness. |
sha256d | function | sha256d(data: Uint8Array): Uint8Array; | Double SHA-256, Core's Hash() (src/hash.h). |
StoredRecord | interface | { header, flags } | One record of the header store: the 80-byte header and its flags. |
StoreState | interface | { count, firstUnverified?, tipHash, chainWork } | Cached summary of a header store: record count, the lowest header whose proof of work was not checked (trust mode), tip hash and chain work. |
SyncEvents | interface | { progress, synced, reorg, 'peer-connected', 'peer-closed', error } | Events a HeaderSync emits and their payloads. |
SyncOptions | interface | { chain, peers?, maxPeers?, minAgreeing?, requestTimeoutMs?, maxSideHeadersPerPeer?, peerOptions?, resolve? } | Options for HeaderSync: the chain to fill, explicit peers (no DNS), connection count, peers that must agree and timeouts. |
SyncProgress | interface | { height, tipHash, verifiedHeight, headersPerSecond, peers, synced } | Sync progress: height, tip, verified height, speed, connected peers and whether the chain is synced. |
targetOf | function | targetOf(bits: number): bigint | undefined; | The target (as an integer) of a compact nBits, or undefined if invalid. |
targetToCompact | function | targetToCompact(target: bigint, negative?: boolean): number; | arith_uint256::GetCompact (arith_uint256.cpp:224-245). |
testnetParams | const | testnetParams: ChainParams | Parameters of the Dogecoin test network. Frozen. |
TIMEOUT_INTERVAL | const | TIMEOUT_INTERVAL: number | net.h:49 `TIMEOUT_INTERVAL = 20 * 60;` seconds |
USER_AGENT | const | USER_AGENT = "/dogejs-node:0.1.0/" | The user agent string sent to peers in the `version` message. |
verifyHeaderChain | function | verifyHeaderChain(headers: readonly (Uint8Array | string)[], opts: VerifyHeaderChainOptions): VerifyHeaderChainResult; | Verifies a short run of consecutive headers without the rest of the chain: linkage, proof of work, difficulty and checkpoints. Returns a result; does not throw for bad headers. |
VerifyHeaderChainOptions | interface | { network, firstHeight?, anchor?, maxTarget?, allowMissingAuxPow?, knownValid?, checkDifficulty?, maxHeaders?, powHash? } | Options for verifyHeaderChain: the network, the claimed first height, an optional trusted anchor, a target floor and limits. |
VerifyHeaderChainResult | type | VerifyHeaderChainResult = { readonly ok: true; readonly headers: readonly LightHeaderReport[]; /** Sum of GetBlockProof over the headers. */ readonly totalWork: bigint; /** Headers whose proof of work verified (now or `known`). */ readonly powVerified: number; /** Headers whose proof of work could not be checked (AuxPoW missing). */ readonly powUnchecked: number; readonly checkpoints: readonly ... | Result of verifyHeaderChain: `ok: true` with per-header reports and totals, or `ok: false` with a failure code, a reason and the index of the offending header. It does not throw for invalid headers. |
verifyMerkleBlockProof | function | verifyMerkleBlockProof(proof: Uint8Array | string, txid: string): MerkleBlockProofResult; | Checks that a `merkleblock` proof (Core's `gettxoutproof`) commits to a txid under its header. Throws NodeError INVALID_PROOF otherwise. |
VerifyProofOptions | interface | { rawTx?, requireVerified?, minConfirmations? } | Options for verifyTxOutProof: optionally the raw transaction that must be among the proven ones. |
verifyTxOutProof | function | verifyTxOutProof(proof: Uint8Array | string, chain: HeaderChain, opts?: VerifyProofOptions): ProofResult; | Checks a `gettxoutproof` result against the headers of a synced chain and reports the proven txids and confirmations. |
VERSION_AUXPOW | const | VERSION_AUXPOW: number | pureheader.h:23 `static const int32_t VERSION_AUXPOW = (1 << 8);` |
VERSION_CHAIN_START | const | VERSION_CHAIN_START: number | pureheader.h:26 `static const int32_t VERSION_CHAIN_START = (1 << 16);` |
VersionMessage | interface | { version, services, time, addrRecv, addrFrom, nonce, userAgent, startHeight, relay } | The `version` message of the peer handshake: protocol version, services, time, addresses, nonce, user agent and start height. |
workForBits | function | workForBits(bits: number): bigint; | Expected scrypt hashes for one header at this nBits (GetBlockProof). Re-exported for clarity. |
writeAuxPow | function | writeAuxPow(w: ByteWriter, a: AuxPow): ByteWriter; | Writes an AuxPoW to a ByteWriter and returns it. |
writeBlockHeader | function | writeBlockHeader(w: ByteWriter, h: BlockHeader): ByteWriter; | Writes a block header (with its AuxPoW when the version flags one) to a ByteWriter. Throws NodeError INVALID_ARGUMENT if the AuxPoW is missing. |
writePartialMerkleTree | function | writePartialMerkleTree(w: ByteWriter, t: PartialMerkleTree): ByteWriter; | Writes a partial merkle tree to a ByteWriter. |
writePureHeader | function | writePureHeader(w: ByteWriter, h: PureHeader): ByteWriter; | Writes the 80-byte header part to a ByteWriter. Throws NodeError INVALID_ARGUMENT unless both hashes are 32 bytes. |