Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
| --- | --- | --- | --- | --- |
| [dash-num](./pkgs/num) | Hash blobs, 256-bit arithmetic, compact target encoding | [![dash-num](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_num.yml?style=flat&logo=github&logoColor=white&label=num)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_num.yml) | [![dash-num](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-num&style=flat&logo=codecov&logoColor=white&label=num)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fnum) | [![dash-num](https://img.shields.io/crates/v/dash-num?style=flat&logo=hackthebox&logoColor=white&label=num&color=teal)](https://crates.io/crates/dash-num) |
| [dash-p2p-core](./pkgs/p2p_core) | P2P message types and wire format | [![dash-p2p-core](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_p2p_core.yml?style=flat&logo=github&logoColor=white&label=p2p-core)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_p2p_core.yml) | [![dash-p2p-core](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-p2p-core&style=flat&logo=codecov&logoColor=white&label=p2p-core)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fp2p_core) | _Unreleased._ |
| [dash-params](./pkgs/params) | Chain parameters for `mainnet`, `testnet3`, and `regtest` | [![dash-params](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_params.yml?style=flat&logo=github&logoColor=white&label=params)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_params.yml) | [![dash-params](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-params&style=flat&logo=codecov&logoColor=white&label=params)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fparams) | _Unreleased._ |
| [dash-params](./pkgs/params) | Chain parameters for `mainnet`, `testnet3`, devnets and `regtest`, by release | [![dash-params](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_params.yml?style=flat&logo=github&logoColor=white&label=params)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_params.yml) | [![dash-params](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-params&style=flat&logo=codecov&logoColor=white&label=params)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fparams) | _Unreleased._ |
| [dash-pkc](./pkgs/pkc) | BLS (legacy + IETF) and secp256k1 operations | [![dash-pkc](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_pkc.yml?style=flat&logo=github&logoColor=white&label=pkc)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_pkc.yml) | [![dash-pkc](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-pkc&style=flat&logo=codecov&logoColor=white&label=pkc)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fpkc) | [![dash-pkc](https://img.shields.io/crates/v/dash-pkc?style=flat&logo=hackthebox&logoColor=white&label=pkc&color=teal)](https://crates.io/crates/dash-pkc) |
| [dash-pow](./pkgs/pow) | Proof of work scheme | [![dash-pow](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_pow.yml?style=flat&logo=github&logoColor=white&label=pow)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_pow.yml) | [![dash-pow](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-pow&style=flat&logo=codecov&logoColor=white&label=pow)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fpow) | [![dash-pow](https://img.shields.io/crates/v/dash-pow?style=flat&logo=hackthebox&logoColor=white&label=pow&color=teal)](https://crates.io/crates/dash-pow) |
| [dash-primitives](./pkgs/primitives) | Blocks, transactions, payloads, governance objects | [![dash-primitives](https://img.shields.io/github/actions/workflow/status/dashpay/base-sdk/pkg_primitives.yml?style=flat&logo=github&logoColor=white&label=primitives)](https://github.com/dashpay/base-sdk/actions/workflows/pkg_primitives.yml) | [![dash-primitives](https://img.shields.io/codecov/c/github/dashpay/base-sdk/develop?flag=dash-primitives&style=flat&logo=codecov&logoColor=white&label=primitives)](https://app.codecov.io/github/dashpay/base-sdk/tree/develop/pkgs%2Fprimitives) | _Unreleased._ |
Expand Down
28 changes: 28 additions & 0 deletions contrib/params/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
`pkgs/params/corpus/chainparams_v23_1.json5` and `chainparams_v24_0.json5` record the chain parameters of the reference
implementation at v23.1.8 and v24.0.0-rc.5, and `brr_payments.json5` its masternode payments around each block reward
reallocation period. `dash-params` checks its chain setup and its period table against them, and `dash-primitives`
checks the genesis block bytes. Every value comes from a dump program linked against the release's own libraries.

* [`chainparams_dump.cpp`](chainparams_dump.cpp) prints, as JSON, the release's parameters of a chain after the release
parses its options and selects the chain, or the masternode payment at a height.
* [`build.sh`](build.sh) builds a release from `git archive` of its tag in a fresh tree and links the dump program
against the libraries its node links.
* [`gen.py`](gen.py) runs the dump programs and writes the corpora.

## Regenerating

`build.sh` needs a checkout of [the reference implementation](https://github.com/dashpay/dash) and what its depends
build needs on Linux: autotools, `make`, `pkg-config`, a C++20 compiler and a network connection for the depends
sources. It builds depends without a GUI, wallet, ZMQ or port mapping, configures the release against them and builds
only the libraries its node links. `JOBS` sets the parallel jobs (default 4), and `SOURCES_PATH` a directory of
downloaded depends sources to reuse. Each output directory must be new.

```bash
contrib/params/build.sh ~/dash v23.1.8 /tmp/params-v23
contrib/params/build.sh ~/dash v24.0.0-rc.5 /tmp/params-v24
python3 contrib/params/gen.py --dump /tmp/params-v23 --dump /tmp/params-v24 --out pkgs/params/corpus
```

Each dump program records its tag, the tag's commit and the sha256 of `chainparams_dump.cpp`. `gen.py` refuses a dump
built from another `chainparams_dump.cpp`, and each corpus header names the release and the source's sha256. A v24
release before v24.0.0-rc.5 lacks the pruning depth the dump prints, so it does not build.
59 changes: 59 additions & 0 deletions contrib/params/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh
#
# Copyright (c) 2026-present, The Dash Core developers
# SPDX-License-Identifier: MIT
# See the accompanying file LICENSE or https://opensource.org/license/MIT
#
# Builds a reference implementation release from `git archive` of its tag and
# links chainparams_dump.cpp against the libraries its node links.
#
# build.sh <dash checkout> <tag> <output dir>
#
# Writes <output dir>/chainparams_dump and the release tree <output dir>/tree.
# The output dir must not hold an earlier build, which make could reuse. JOBS
# sets the parallel jobs (default 4) and SOURCES_PATH the depends download
# cache.
set -eu
here=$(cd "$(dirname "$0")" && pwd)
repo=$1 tag=$2 out=$3
mkdir -p "$out"
out=$(cd "$out" && pwd)
tree="$out/tree"
log="$out/build.log"
if [ -e "$tree" ]; then
echo "build.sh: $tree exists, use a new output dir" >&2
exit 1
fi
commit=$(git -C "$repo" rev-parse --verify "$tag^{commit}")
source_sha256=$(sha256sum "$here/chainparams_dump.cpp" | cut -d' ' -f1)
mkdir "$tree"
git -C "$repo" archive "$commit" | tar -x -C "$tree"
cp "$here/chainparams_dump.cpp" "$tree/src/chainparams_dump.cpp"
jobs=${JOBS:-4}
host=$("$tree/depends/config.guess")
trap 'echo "build.sh: failed, see $log" >&2' EXIT
# The node needs no GUI, wallet, ZMQ or port mapping.
(
cd "$tree"
make -C depends -j"$jobs" HOST="$host" NO_QT=1 NO_WALLET=1 NO_ZMQ=1 NO_UPNP=1 \
NO_NATPMP=1 NO_USDT=1
./autogen.sh
CONFIG_SITE="$tree/depends/$host/share/config.site" ./configure --prefix=/ \
--disable-wallet --without-gui --disable-zmq --without-miniupnpc \
--without-natpmp --disable-bench --disable-tests --disable-fuzz-binary \
--disable-man --disable-ccache
) >"$log" 2>&1
# The dump compiles and links with the node's own flags and libraries, from
# the release's src/Makefile. Make runs in src, so its paths are relative.
make -C "$tree/src" -j"$jobs" -f Makefile -f - chainparams_dump \
>>"$log" 2>&1 <<EOF
chainparams_dump.o: chainparams_dump.cpp
\$(CXX) \$(DEFS) \$(DEFAULT_INCLUDES) \$(dashd_CPPFLAGS) \$(CPPFLAGS) \\
\$(dashd_CXXFLAGS) \$(CXXFLAGS) -DDUMP_TAG='"$tag"' \\
-DDUMP_COMMIT='"$commit"' -DDUMP_SOURCE_SHA256='"$source_sha256"' \\
-c -o \$@ chainparams_dump.cpp
chainparams_dump: chainparams_dump.o \$(dashd_DEPENDENCIES)
\$(dashd_LINK) chainparams_dump.o \$(dashd_LDADD) \$(LIBS)
EOF
cp "$tree/src/chainparams_dump" "$out/chainparams_dump"
trap - EXIT
Loading
Loading