Skip to content
Merged
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
10 changes: 4 additions & 6 deletions contrib/devtools/copyright_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,13 @@ def get_most_recent_git_change_year(filename):
################################################################################

def read_file_lines(filename):
f = open(filename, 'r', encoding="utf8")
file_lines = f.readlines()
f.close()
with open(filename, 'r', encoding="utf8") as f:
file_lines = f.readlines()
return file_lines

def write_file_lines(filename, file_lines):
f = open(filename, 'w', encoding="utf8")
f.write(''.join(file_lines))
f.close()
with open(filename, 'w', encoding="utf8") as f:
f.write(''.join(file_lines))

################################################################################
# update header years execution
Expand Down
37 changes: 18 additions & 19 deletions contrib/linearize/linearize-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def get_blk_dt(blk_hdr):
# When getting the list of block hashes, undo any byte reversals.
def get_block_hashes(settings):
blkindex = []
f = open(settings['hashlist'], "r", encoding="utf8")
for line in f:
line = line.rstrip()
if settings['rev_hash_bytes'] == 'true':
line = bytes.fromhex(line)[::-1].hex()
blkindex.append(line)
with open(settings['hashlist'], "r", encoding="utf8") as f:
for line in f:
line = line.rstrip()
if settings['rev_hash_bytes'] == 'true':
line = bytes.fromhex(line)[::-1].hex()
blkindex.append(line)

print("Read " + str(len(blkindex)) + " hashes")

Expand Down Expand Up @@ -249,19 +249,18 @@ def run(self):
print("Usage: linearize-data.py CONFIG-FILE")
sys.exit(1)

f = open(sys.argv[1], encoding="utf8")
for line in f:
# skip comment lines
m = re.search(r'^\s*#', line)
if m:
continue

# parse key=value lines
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
if m is None:
continue
settings[m.group(1)] = m.group(2)
f.close()
with open(sys.argv[1], encoding="utf8") as f:
for line in f:
# skip comment lines
m = re.search(r'^\s*#', line)
if m:
continue

# parse key=value lines
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
if m is None:
continue
settings[m.group(1)] = m.group(2)

# Force hash byte format setting to be lowercase to make comparisons easier.
# Also place upfront in case any settings need to know about it.
Expand Down
25 changes: 12 additions & 13 deletions contrib/linearize/linearize-hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,18 @@ def get_rpc_cookie():
print("Usage: linearize-hashes.py CONFIG-FILE")
sys.exit(1)

f = open(sys.argv[1], encoding="utf8")
for line in f:
# skip comment lines
m = re.search(r'^\s*#', line)
if m:
continue

# parse key=value lines
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
if m is None:
continue
settings[m.group(1)] = m.group(2)
f.close()
with open(sys.argv[1], encoding="utf8") as f:
for line in f:
# skip comment lines
m = re.search(r'^\s*#', line)
if m:
continue

# parse key=value lines
m = re.search(r'^(\w+)\s*=\s*(\S.*)$', line)
if m is None:
continue
settings[m.group(1)] = m.group(2)

if 'host' not in settings:
settings['host'] = '127.0.0.1'
Expand Down
15 changes: 10 additions & 5 deletions contrib/verify-commits/verify-commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ def main():
# get directory of this program and read data files
dirname = os.path.dirname(os.path.abspath(__file__))
print("Using verify-commits data from " + dirname)
verified_root = open(dirname + "/trusted-git-root", "r", encoding="utf8").read().splitlines()[0]
verified_sha512_root = open(dirname + "/trusted-sha512-root-commit", "r", encoding="utf8").read().splitlines()[0]
revsig_allowed = open(dirname + "/allow-revsig-commits", "r", encoding="utf-8").read().splitlines()
unclean_merge_allowed = open(dirname + "/allow-unclean-merge-commits", "r", encoding="utf-8").read().splitlines()
incorrect_sha512_allowed = open(dirname + "/allow-incorrect-sha512-commits", "r", encoding="utf-8").read().splitlines()
with open(dirname + "/trusted-git-root", "r", encoding="utf8") as f:
verified_root = f.read().splitlines()[0]
with open(dirname + "/trusted-sha512-root-commit", "r", encoding="utf8") as f:
verified_sha512_root = f.read().splitlines()[0]
with open(dirname + "/allow-revsig-commits", "r", encoding="utf8") as f:
revsig_allowed = f.read().splitlines()
with open(dirname + "/allow-unclean-merge-commits", "r", encoding="utf8") as f:
unclean_merge_allowed = f.read().splitlines()
with open(dirname + "/allow-incorrect-sha512-commits", "r", encoding="utf8") as f:
incorrect_sha512_allowed = f.read().splitlines()

# Set commit and branch and set variables
current_commit = args.commit
Expand Down
123 changes: 73 additions & 50 deletions doc/build-netbsd.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,118 @@
NetBSD Build Guide
======================
**Updated for NetBSD [8.0](https://www.netbsd.org/releases/formal-8/NetBSD-8.0.html)**
# NetBSD Build Guide

This guide describes how to build dashd and command-line utilities on NetBSD.
Updated for NetBSD [9.2](https://netbsd.org/releases/formal-9/NetBSD-9.2.html).

This guide does not contain instructions for building the GUI.
This guide describes how to build dashd, command-line utilities, and GUI on NetBSD.

**This guide has not been tested for building Dash Core and is expected to fail due to missing `bls_dash` and `backtrace`. Please report your results; contributions welcome.**

Preparation
-------------
## Preparation

You will need the following modules, which can be installed via pkgsrc or pkgin:
### 1. Install Required Dependencies

Install the required dependencies the usual way you [install software on NetBSD](https://www.netbsd.org/docs/guide/en/chap-boot.html#chap-boot-pkgsrc).
The example commands below use `pkgin`.

```bash
pkgin install autoconf automake libtool pkg-config git gmake boost libevent gmp

```
autoconf
automake
boost
git
gmake
gmp
libevent
libtool
pkg-config
python37

git clone https://github.com/dashpay/dash.git
NetBSD currently ships with an older version of `gcc` than is needed to build. You should upgrade your `gcc` and then pass this new version to the configure script.

For example, grab `gcc9`:
```
pkgin install gcc9
```

Then, when configuring, pass the following:
```bash
./configure
...
CC="/usr/pkg/gcc9/bin/gcc" \
CXX="/usr/pkg/gcc9/bin/g++" \
...
Comment on lines +30 to +34
Copy link

@coderabbitai coderabbitai bot Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix the multiline ./configure example.

As written, the first line lacks a trailing \, so copy/pasting runs ./configure immediately and the remaining lines execute as separate commands (CC=…, CXX=…) and fail. Please fold the environment variables into the same multiline command, e.g.:

-./configure
-    ...
-    CC="/usr/pkg/gcc9/bin/gcc" \
-    CXX="/usr/pkg/gcc9/bin/g++" \
-    ...
+./configure \
+    ...
+    CC="/usr/pkg/gcc9/bin/gcc" \
+    CXX="/usr/pkg/gcc9/bin/g++" \
+    ...
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
./configure
...
CC="/usr/pkg/gcc9/bin/gcc" \
CXX="/usr/pkg/gcc9/bin/g++" \
...
./configure \
...
CC="/usr/pkg/gcc9/bin/gcc" \
CXX="/usr/pkg/gcc9/bin/g++" \
...
🤖 Prompt for AI Agents
doc/build-netbsd.md around lines 30 to 34: the multiline example splits into
separate commands because the first line "./configure" lacks a trailing
backslash; change the snippet so the environment variables and ./configure are
part of the same multiline command (either put the environment assignments on
preceding lines each ending with "\" and then a final "./configure" line, or add
a trailing "\" to the "./configure" line and place the CC/CXX=... lines
following it) so copying runs a single combined command.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not working example, just mockup. Not expected to work after copy-paste. Also that's backported from bitcoin

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knst, understood! Thank you for clarifying that this is a mockup example from the Bitcoin backport and not intended to be copy-pasted as-is. I'll note this and won't press the issue further.


🧠 Learnings used
Learnt from: kwvg
PR: dashpay/dash#6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.

```

See [dependencies.md](dependencies.md) for a complete overview.

### Building Dash Core
### 2. Clone Dash Core Repo

**Important**: Use `gmake` (the non-GNU `make` will exit with an error).
Clone the Dash Core repository to a directory. All build scripts and commands will run from this directory.

#### With descriptor wallet:
```bash
git clone https://github.com/dashpay/dash.git
```

### 3. Install Optional Dependencies

#### Wallet Dependencies

It is not necessary to build wallet functionality to run dashd or the GUI.

###### Descriptor Wallet Support

`sqlite3` is required to enable support for [descriptor wallets](https://github.com/dashpay/dash/blob/master/doc/descriptors.md).

The descriptor wallet uses `sqlite3`. You can install it using:
```bash
pkgin install sqlite3
```

###### Legacy Wallet Support

`db4` is required to enable support for legacy wallets.

```bash
./autogen.sh
./configure --with-gui=no --without-bdb \
CPPFLAGS="-I/usr/pkg/include" \
LDFLAGS="-L/usr/pkg/lib" \
BOOST_CPPFLAGS="-I/usr/pkg/include" \
MAKE=gmake
pkgin install db4
```

#### With legacy wallet:

BerkeleyDB is use for legacy wallet functionality.
#### GUI Dependencies

It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
from ports.
You can use [the installation script included in contrib/](/contrib/install_db4.sh) like so:
Dash Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install `qt5`.

```bash
./contrib/install_db4.sh `pwd`
pkgin install qt5
```

from the root of the repository. Then set `BDB_PREFIX` for the next section:
The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `qrencode`.

```bash
export BDB_PREFIX="$PWD/db4"
pkgin install qrencode
```

#### Test Suite Dependencies

There is an included test suite that is useful for testing code changes when developing.
To run the test suite (recommended), you will need to have Python 3 installed:

```bash
./autogen.sh
./configure --with-gui=no CPPFLAGS="-I/usr/pkg/include" \
LDFLAGS="-L/usr/pkg/lib" \
BOOST_CPPFLAGS="-I/usr/pkg/include" \
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
BDB_CFLAGS="-I${BDB_PREFIX}/include" \
MAKE=gmake
pkgin install python37
```

#### Without wallet:
### Building Dash Core

**Note**: Use `gmake` (the non-GNU `make` will exit with an error).


### 1. Configuration

There are many ways to configure Dash Core. Here is an example that
explicitly disables the wallet and GUI:

```bash
./autogen.sh
./configure --with-gui=no --disable-wallet \
./configure --without-wallet --with-gui=no \
CPPFLAGS="-I/usr/pkg/include" \
LDFLAGS="-L/usr/pkg/lib" \
BOOST_CPPFLAGS="-I/usr/pkg/include" \
MAKE=gmake
```

For a full list of configuration options, see the output of `./configure --help`

### 2. Compile

Build and run the tests:

```bash
gmake # use "-j N" here for N parallel jobs
gmake check
gmake check # Run tests if Python 3 is available
```
11 changes: 7 additions & 4 deletions doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,10 @@ Threads
: Started from `main()` in `bitcoind.cpp`. Responsible for starting up and
shutting down the application.

- [ThreadImport (`d-loadblk`)](https://doxygen.bitcoincore.org/init_8cpp.html#ae9e290a0e829ec0198518de2eda579d1)
- [ThreadImport (`d-loadblk`)](https://doxygen.bitcoincore.org/namespacenode.html#ab4305679079866f0f420f7dbf278381d)
: Loads blocks from `blk*.dat` files or `-loadblock=<file>` on startup.

- [ThreadScriptCheck (`d-scriptch.x`)](https://doxygen.bitcoincore.org/validation_8cpp.html#a925a33e7952a157922b0bbb8dab29a20)
- [CCheckQueue::Loop (`d-scriptch.x`)](https://doxygen.bitcoincore.org/class_c_check_queue.html#a6e7fa51d3a25e7cb65446d4b50e6a987)
: Parallel script validation threads for transactions in blocks.

- [ThreadHTTP (`d-http`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#abb9f6ea8819672bd9a62d3695070709c)
Expand All @@ -631,7 +631,7 @@ Threads
: Does asynchronous background tasks like dumping wallet contents, dumping
addrman and running asynchronous validationinterface callbacks.

- [TorControlThread (`d-torcontrol`)](https://doxygen.bitcoincore.org/torcontrol_8cpp.html#a4faed3692d57a0d7bdbecf3b37f72de0)
- [TorControlThread (`d-torcontrol`)](https://doxygen.bitcoincore.org/torcontrol_8cpp.html#a52a3efff23634500bb42c6474f306091)
: Libevent thread for tor connections.

- Net threads:
Expand All @@ -643,7 +643,7 @@ Threads
- [ThreadDNSAddressSeed (`d-dnsseed`)](https://doxygen.bitcoincore.org/class_c_connman.html#aa7c6970ed98a4a7bafbc071d24897d13)
: Loads addresses of peers from the DNS.

- [ThreadMapPort (`d-upnp`)](https://doxygen.bitcoincore.org/net_8cpp.html#a63f82a71c4169290c2db1651a9bbe249)
- ThreadMapPort (`d-mapport`)
: Universal plug-and-play startup/shutdown.

- [ThreadSocketHandler (`d-net`)](https://doxygen.bitcoincore.org/class_c_connman.html#a765597cbfe99c083d8fa3d61bb464e34)
Expand All @@ -655,6 +655,9 @@ Threads
- [ThreadOpenConnections (`d-opencon`)](https://doxygen.bitcoincore.org/class_c_connman.html#a55e9feafc3bab78e5c9d408c207faa45)
: Initiates new connections to peers.

- [ThreadI2PAcceptIncoming (`d-i2paccept`)](https://doxygen.bitcoincore.org/class_c_connman.html#a57787b4f9ac847d24065fbb0dd6e70f8)
: Listens for and accepts incoming I2P connections through the I2P SAM proxy.

- ThreadOpenMasternodeConnections (`d-mncon`)
: Opens network connections to masternodes.

Expand Down
Loading
Loading