diff --git a/autogen.sh b/autogen.sh
index 0c05626c..b5a63381 100644
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,16 +1,29 @@
#!/bin/sh
# Copyright (c) 2013-2016 The Bitcoin Core developers
+# Copyright (c) 2026 Agrarian Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C
-set -e
-srcdir="$(dirname $0)"
+
+# Fail fast on errors and undefined vars. (Note: 'pipefail' is not POSIX sh.)
+set -eu
+
+srcdir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)"
cd "$srcdir"
-if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then
- LIBTOOLIZE="${GLIBTOOLIZE}"
- export LIBTOOLIZE
+
+# Prefer glibtoolize on macOS if LIBTOOLIZE isn't already set.
+if [ -z "${LIBTOOLIZE:-}" ]; then
+ GLIBTOOLIZE="$(command -v glibtoolize 2>/dev/null || true)"
+ if [ -n "$GLIBTOOLIZE" ]; then
+ LIBTOOLIZE="$GLIBTOOLIZE"
+ export LIBTOOLIZE
+ fi
fi
-which autoreconf >/dev/null || \
- (echo "configuration failed, please install autoconf first" && exit 1)
+
+if ! command -v autoreconf >/dev/null 2>&1; then
+ echo "configuration failed: please install autoconf first" >&2
+ exit 1
+fi
+
autoreconf --install --force --warnings=all
diff --git a/configure.ac b/configure.ac
index a438328c..655f34b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,3 +1,7 @@
+dnl Copyright (c) 2026 Agrarian Developers
+dnl Distributed under the MIT/X11 software license, see the accompanying
+dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
@@ -5,7 +9,7 @@ define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
-define(_COPYRIGHT_YEAR, 2022)
+define(_COPYRIGHT_YEAR, 2026)
AC_INIT([Agrarian Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[www.agrarian.org],[agrarian])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/agrarian-config.h])
diff --git a/doc/build-unix.md b/doc/build-unix.md
index da1a2b41..c68a7c64 100644
--- a/doc/build-unix.md
+++ b/doc/build-unix.md
@@ -1,283 +1,123 @@
-UNIX BUILD NOTES
-====================
-Some notes on how to build Agrarian Core in Unix.
+Copyright (c) 2026 Agrarian Developers
-Note
----------------------
-Always use absolute paths to configure and compile Agrarian Core and the dependencies,
-For example, when specifying the path of the dependency:
+UNIX Build Notes
- ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
+These notes describe how to build Agrarian Core on Unix-based systems.
-Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures
-the usage of the absolute path.
+IMPORTANT
-To Build
----------------------
+Always use absolute paths when configuring and compiling Agrarian Core
+and its dependencies.
-```bash
-./autogen.sh
-./configure
-make
-make install # optional
-```
+Example:
-This will build agrarian-qt as well, if the dependencies are met.
+ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
-Dependencies
----------------------
+$BDB_PREFIX must be an absolute path. Using $(pwd) ensures an absolute
+path is used.
-These dependencies are required:
+STANDARD BUILD
- Library | Purpose | Description
- ------------|--------------------|----------------------
- libssl | Crypto | Random Number Generation, Elliptic Curve Cryptography
- libboost | Utility | Library for threading, data structures, etc
- libevent | Networking | OS independent asynchronous networking
- libgmp | Bignum Arithmetic | Precision arithmetic
+ ./autogen.sh
+ ./configure
+ make
+ make install (optional)
-Optional dependencies:
+If dependencies are satisfied, this will build agrarian-qt as well.
- Library | Purpose | Description
- ------------|------------------|----------------------
- miniupnpc | UPnP Support | Firewall-jumping support
- libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled)
- qt | GUI | GUI toolkit (only needed when GUI enabled)
- protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when GUI enabled)
- libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
- univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
- libzmq3 | ZMQ notification | Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.0.0)
+DEPENDENCIES
-For the versions used, see [dependencies.md](dependencies.md)
+Required: - libssl : Crypto (RNG, ECC) - libboost : Utility (threading,
+data structures) - libevent : Networking (async networking) - libgmp :
+Bignum arithmetic
-Memory Requirements
---------------------
+Optional: - miniupnpc : UPnP support - libdb4.8 : Berkeley DB (wallet
+builds only) - qt : GUI support - protobuf : GUI payment protocol -
+libqrencode: QR code support - univalue : JSON parsing (bundled by
+default) - libzmq3 : ZMQ notifications (>= 4.0.0)
-C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of
-memory available when compiling Agrarian Core. On systems with less, gcc can be
-tuned to conserve memory with additional CXXFLAGS:
+See dependencies.md for version details.
+MEMORY REQUIREMENTS
+
+Minimum recommended: 1.5 GB RAM.
+
+Low memory systems:
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
+UBUNTU / DEBIAN
-## Linux Distribution Specific Instructions
-
-### Ubuntu & Debian
-
-#### Dependency Build Instructions
-
-Build requirements:
+Build tools:
sudo apt-get install build-essential libtool bsdmainutils autotools-dev autoconf pkg-config automake python3
-Now, you can either build from self-compiled [depends](/depends/README.md) or install the required dependencies:
+Libraries:
sudo apt-get install libssl-dev libgmp-dev libevent-dev libboost-all-dev
-**Note:** For Ubuntu versions starting with Bionic (18.04), or Debian versions starting with Stretch, use `libssl1.0-dev`
-above instead of `libssl-dev`. Agrarian Core does not support the use of OpenSSL 1.1, though compilation is still possible
-by passing `--with-incompatible-ssl` to configure (NOT RECOMMENDED!).
+OpenSSL Note: For Ubuntu >= 18.04 or Debian >= Stretch use
+libssl1.0-dev. OpenSSL 1.1 is not officially supported.
-BerkeleyDB is required for the wallet.
-
- **For Ubuntu only:** db4.8 packages are available [here](https://launchpad.net/~bitcoin/+archive/bitcoin).
- You can add the repository using the following command:
+Berkeley DB 4.8 (wallet support):
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
-Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install
-BerkeleyDB 5.1 or later. This will break binary wallet compatibility with the distributed executables, which
-are based on BerkeleyDB 4.8. If you do not care about wallet compatibility,
-pass `--with-incompatible-bdb` to configure.
-
-Otherwise, you can build from self-compiled `depends` (see above).
-
-To build Agrarian Core without wallet, see [*Disable-wallet mode*](/doc/build-unix.md#disable-wallet-mode)
-
-
-Optional (see --with-miniupnpc and --enable-upnp-default):
+Optional:
sudo apt-get install libminiupnpc-dev
-
-ZMQ dependencies (provides ZMQ API):
-
sudo apt-get install libzmq3-dev
-GUI dependencies:
+Qt GUI:
-If you want to build agrarian-qt, make sure that the required packages for Qt development
-are installed. Qt 5 is necessary to build the GUI.
-To build without GUI pass `--without-gui`.
+ sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
-To build with Qt 5 you need the following:
+Disable GUI:
- sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
+ ./configure --without-gui
-libqrencode (optional) can be installed with:
+FEDORA
- sudo apt-get install libqrencode-dev
+Build tools:
-Once these are installed, they will be found by configure and a agrarian-qt executable will be
-built by default.
-
-
-### Fedora
-
-#### Dependency Build Instructions
-
-Build requirements:
-
- sudo dnf install which gcc-c++ libtool make autoconf automake compat-openssl10-devel libevent-devel boost-devel libdb4-devel libdb4-cxx-devel gmp-devel python3
+ sudo dnf install which gcc-c++ libtool make autoconf automake compat-openssl10-devel libevent-devel boost-devel libdb4-devel libdb4-cxx-devel gmp-devel python3
Optional:
sudo dnf install miniupnpc-devel zeromq-devel
-To build with Qt 5 you need the following:
+Qt:
sudo dnf install qt5-qttools-devel qt5-qtbase-devel protobuf-devel
-libqrencode (optional) can be installed with:
+HARDENING
- sudo dnf install qrencode-devel
+Enable:
-Notes
------
-The release is built with GCC and then "strip agrariand" to strip the debug
-symbols, which reduces the executable size by about 90%.
+ ./configure --enable-hardening
+Disable:
-miniupnpc
----------
+ ./configure --disable-hardening
-[miniupnpc](http://miniupnp.free.fr/) may be used for UPnP port mapping. It can be downloaded from [here](
-http://miniupnp.tuxfamily.org/files/). UPnP support is compiled in and
-turned off by default. See the configure options for upnp behavior desired:
+Verify:
- --without-miniupnpc No UPnP support miniupnp not required
- --disable-upnp-default (the default) UPnP support turned off by default at runtime
- --enable-upnp-default UPnP support turned on by default at runtime
+ scanelf -e ./agrariand
-To build:
-
- tar -xzvf miniupnpc-1.6.tar.gz
- cd miniupnpc-1.6
- make
- sudo su
- make install
-
-
-Berkeley DB
------------
-It is recommended to use Berkeley DB 4.8. If you have to build it yourself,
-you can use [the installation script included in contrib/](/contrib/install_db4.sh)
-like so:
-
-```shell
-./contrib/install_db4.sh `pwd`
-```
-
-from the root of the repository.
-
-**Note**: You only need Berkeley DB if the wallet is enabled (see [*Disable-wallet mode*](/doc/build-unix.md#disable-wallet-mode)).
-
-Boost
------
-If you need to build Boost yourself:
-
- sudo su
- ./bootstrap.sh
- ./bjam install
-
-
-Security
---------
-To help make your Agrarian Core installation more secure by making certain attacks impossible to
-exploit even if a vulnerability is found, binaries are hardened by default.
-This can be disabled with:
-
-Hardening Flags:
-
- ./configure --enable-hardening
- ./configure --disable-hardening
-
-
-Hardening enables the following features:
-* _Position Independent Executable_: Build position independent code to take advantage of Address Space Layout Randomization
- offered by some kernels. Attackers who can cause execution of code at an arbitrary memory
- location are thwarted if they don't know where anything useful is located.
- The stack and heap are randomly located by default, but this allows the code section to be
- randomly located as well.
-
- On an AMD64 processor where a library was not compiled with -fPIC, this will cause an error
- such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
-
- To test that you have built PIE executable, install scanelf, part of paxutils, and use:
-
- scanelf -e ./agrariand
-
- The output should contain:
-
- TYPE
- ET_DYN
-
-* _Non-executable Stack_: If the stack is executable then trivial stack-based buffer overflow exploits are possible if
- vulnerable buffers are found. By default, Agrarian Core should be built with a non-executable stack
- but if one of the libraries it uses asks for an executable stack or someone makes a mistake
- and uses a compiler extension which requires an executable stack, it will silently build an
- executable without the non-executable stack protection.
-
- To verify that the stack is non-executable after compiling use:
- `scanelf -e ./agrariand`
-
- The output should contain:
- STK/REL/PTL
- RW- R-- RW-
-
- The STK RW- means that the stack is readable and writeable but not executable.
-
-Disable-wallet mode
---------------------
-**Note:** This functionality is not yet completely implemented, and compilation using the below option will currently fail.
-
-When the intention is to run only a P2P node without a wallet, Agrarian Core may be compiled in
-disable-wallet mode with:
+DISABLE WALLET MODE
./configure --disable-wallet
-In this case there is no dependency on Berkeley DB 4.8.
-
-
-Additional Configure Flags
---------------------------
-A list of additional configure flags can be displayed with:
-
- ./configure --help
-
-
-ARM Cross-compilation
--------------------
-These steps can be performed on, for example, an Ubuntu VM. The depends system
-will also work on other Linux distributions, however the commands for
-installing the toolchain will be different.
-
-Make sure you install the build requirements mentioned above.
-Then, install the toolchain and curl:
+ARM CROSS COMPILATION
sudo apt-get install g++-arm-linux-gnueabihf curl
-To build executables for ARM:
-
cd depends
make HOST=arm-linux-gnueabihf NO_QT=1
cd ..
./autogen.sh
- ./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++
+ ./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++
make
-
-
-For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
diff --git a/doc/build-windows.md b/doc/build-windows.md
index 97f24599..06b67e1d 100644
--- a/doc/build-windows.md
+++ b/doc/build-windows.md
@@ -1,151 +1,198 @@
-WINDOWS BUILD NOTES
-====================
+Copyright (c) 2026 Agrarian Developers
-Below are some notes on how to build Agrarian Core for Windows.
+============================================================
+ Agrarian Core – Windows Build Notes
+============================================================
-The options known to work for building Agrarian Core on Windows are:
+This document describes how to build Agrarian Core for Windows.
-* On Linux, using the [Mingw-w64](https://mingw-w64.org/doku.php) cross compiler tool chain. Ubuntu Bionic 18.04 is required
-and is the platform used to build the Agrarian Core Windows release binaries.
-* On Windows, using [Windows
-Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about) and the Mingw-w64 cross compiler tool chain.
-
-Other options which may work, but which have not been extensively tested are (please contribute instructions):
-
-* On Windows, using a POSIX compatibility layer application such as [cygwin](http://www.cygwin.com/) or [msys2](http://www.msys2.org/).
-* On Windows, using a native compiler tool chain such as [Visual Studio](https://www.visualstudio.com).
-
-Installing Windows Subsystem for Linux
----------------------------------------
-
-With Windows 10, Microsoft has released a new feature named the [Windows
-Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about). This
-feature allows you to run a bash shell directly on Windows in an Ubuntu-based
-environment. Within this environment you can cross compile for Windows without
-the need for a separate Linux VM or server. Note that while WSL can be installed with
-other Linux variants, such as OpenSUSE, the following instructions have only been
-tested with Ubuntu.
-
-This feature is not supported in versions of Windows prior to Windows 10 or on
-Windows Server SKUs. In addition, it is available [only for 64-bit versions of
-Windows](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide).
-
-Full instructions to install WSL are available on the above link.
-To install WSL on Windows 10 with Fall Creators Update installed (version >= 16215.0) do the following:
-
-1. Enable the Windows Subsystem for Linux feature
- * Open the Windows Features dialog (`OptionalFeatures.exe`)
- * Enable 'Windows Subsystem for Linux'
- * Click 'OK' and restart if necessary
-2. Install Ubuntu
- * Open Microsoft Store and search for "Ubuntu 18.04" or use [this link](https://www.microsoft.com/store/productId/9N9TNGVNDL3Q)
- * Click Install
-3. Complete Installation
- * Open a cmd prompt and type "Ubuntu1804"
- * Create a new UNIX user account (this is a separate account from your Windows account)
-
-After the bash shell is active, you can follow the instructions below, starting
-with the "Cross-compilation" section. Compiling the 64-bit version is
-recommended, but it is possible to compile the 32-bit version.
-
-Cross-compilation for Ubuntu and Windows Subsystem for Linux
+------------------------------------------------------------
+SUPPORTED BUILD METHODS
------------------------------------------------------------
-The steps below can be performed on Ubuntu (including in a VM) or WSL. The depends system
-will also work on other Linux distributions, however the commands for
-installing the toolchain will be different.
+The following methods are known to work:
-First, install the general dependencies:
+1. Linux (Ubuntu 18.04 Bionic recommended)
+ Using the Mingw-w64 cross-compilation toolchain.
+ This is the method used to produce official Windows release binaries.
+
+2. Windows 10+
+ Using Windows Subsystem for Linux (WSL) with Mingw-w64.
+
+------------------------------------------------------------
+UNTESTED / PARTIALLY TESTED OPTIONS
+------------------------------------------------------------
+
+The following may work but are not officially supported:
+
+• Cygwin
+• MSYS2
+• Native Visual Studio toolchain
+
+Contributions for these methods are welcome.
+
+============================================================
+WINDOWS SUBSYSTEM FOR LINUX (WSL)
+============================================================
+
+WSL allows running a Linux environment directly on Windows without a VM.
+
+Requirements:
+• Windows 10 (64-bit only)
+• Not supported on Windows Server
+• Ubuntu recommended (tested on Ubuntu 18.04)
+
+------------------------------------------------------------
+INSTALLING WSL
+------------------------------------------------------------
+
+1. Enable WSL
+ - Run: OptionalFeatures.exe
+ - Enable "Windows Subsystem for Linux"
+ - Restart if prompted
+
+2. Install Ubuntu
+ - Open Microsoft Store
+ - Install "Ubuntu 18.04"
+
+3. Complete Setup
+ - Open command prompt
+ - Run: Ubuntu1804
+ - Create a UNIX user account
+
+Once WSL is active, continue with cross-compilation instructions below.
+
+============================================================
+CROSS-COMPILATION (Ubuntu or WSL)
+============================================================
+
+The steps below work on:
+• Native Ubuntu
+• Ubuntu VM
+• WSL
+
+------------------------------------------------------------
+GENERAL DEPENDENCIES
+------------------------------------------------------------
sudo apt update
sudo apt upgrade
- sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git
+ sudo apt install build-essential libtool autotools-dev \
+ automake pkg-config bsdmainutils curl git
-A host toolchain (`build-essential`) is necessary because some dependency
-packages (such as `protobuf`) need to build host utilities that are used in the
-build process.
+A host toolchain (build-essential) is required because some dependencies
+(e.g., protobuf) build host utilities during the process.
-See [dependencies.md](dependencies.md) for a complete overview.
-
-If you want to build the windows installer with `make deploy` you need [NSIS](https://nsis.sourceforge.io/Main_Page):
+If building the Windows installer (`make deploy`):
sudo apt install nsis
-Acquire the source in the usual way:
+------------------------------------------------------------
+SOURCE CODE
+------------------------------------------------------------
git clone https://github.com/agrarian-project/agrarian.git
cd agrarian
-## Building for 64-bit Windows
+============================================================
+BUILDING FOR 64-BIT WINDOWS
+============================================================
-The first step is to install the mingw-w64 cross-compilation tool chain:
+Install Mingw-w64 toolchain:
sudo apt install g++-mingw-w64-x86-64
-Ubuntu Bionic 18.04 [1](#footnote1):
+Ubuntu 18.04:
- sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
+ sudo update-alternatives --config x86_64-w64-mingw32-g++
-Once the toolchain is installed the build steps are common:
+Select the POSIX thread model (required).
-Note that for WSL the Agrarian Core source path MUST be somewhere in the default mount file system, for
-example /usr/src/agrarian, AND not under /mnt/d/. If this is not the case the dependency autoconf scripts will fail.
-This means you cannot use a directory that is located directly on the host Windows file system to perform the build.
+------------------------------------------------------------
+IMPORTANT (WSL USERS)
+------------------------------------------------------------
-Build using:
+The source directory MUST reside inside the Linux filesystem
+(e.g., /usr/src/agrarian).
- PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
+DO NOT build from /mnt/c or any mounted Windows path.
+Autoconf scripts will fail.
+
+------------------------------------------------------------
+BUILD COMMANDS
+------------------------------------------------------------
+
+ PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')
cd depends
make HOST=x86_64-w64-mingw32
cd ..
- ./autogen.sh # not required when building from tarball
- CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
+ ./autogen.sh
+ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site \
+ ./configure --prefix=/
make
-## Building for 32-bit Windows
+============================================================
+BUILDING FOR 32-BIT WINDOWS
+============================================================
-To build executables for Windows 32-bit, install the following dependencies:
+Install toolchain:
sudo apt install g++-mingw-w64-i686 mingw-w64-i686-dev
-Ubuntu Bionic 18.04 [1](#footnote1):
+Ubuntu 18.04:
- sudo update-alternatives --config i686-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
+ sudo update-alternatives --config i686-w64-mingw32-g++
-Build using:
+Select the POSIX thread model.
- PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
+------------------------------------------------------------
+BUILD COMMANDS
+------------------------------------------------------------
+
+ PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')
cd depends
make HOST=i686-w64-mingw32
cd ..
- ./autogen.sh # not required when building from tarball
- CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site ./configure --prefix=/
+ ./autogen.sh
+ CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site \
+ ./configure --prefix=/
make
-## Depends system
+============================================================
+DEPENDS SYSTEM
+============================================================
-For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
+For additional documentation, see:
-Installation
--------------
+ depends/README.md
-After building using the Windows subsystem it can be useful to copy the compiled
-executables to a directory on the Windows drive in the same directory structure
-as they appear in the release `.zip` archive. This can be done in the following
-way. This will install to `c:\workspace\agrarian`, for example:
+============================================================
+INSTALLATION
+============================================================
+
+To install into a Windows-accessible directory:
make install DESTDIR=/mnt/c/workspace/agrarian
-You can also create an installer using:
+To build a Windows installer:
make deploy
-Footnotes
----------
+============================================================
+THREAD MODEL NOTE
+============================================================
-1: Starting from Ubuntu Xenial 16.04, both the 32 and 64 bit Mingw-w64 packages install two different
-compiler options to allow a choice between either posix or win32 threads. The default option is win32 threads which is the more
-efficient since it will result in binary code that links directly with the Windows kernel32.lib. Unfortunately, the headers
-required to support win32 threads conflict with some of the classes in the C++11 standard library, in particular std::mutex.
-It's not possible to build the Agrarian Core code using the win32 version of the Mingw-w64 cross compilers (at least not without
-modifying headers in the Agrarian Core source code).
+Ubuntu Mingw-w64 packages include two thread models:
+
+• win32 (default)
+• posix
+
+The win32 model conflicts with certain C++11 headers
+(e.g., std::mutex) used by Agrarian Core.
+
+You MUST select the POSIX thread model when prompted by
+update-alternatives.
+
+============================================================
+END OF DOCUMENT
+============================================================
diff --git a/src/agrarian-cli-res.rc b/src/agrarian-cli-res.rc
index 078b49eb..d92e4d1d 100644
--- a/src/agrarian-cli-res.rc
+++ b/src/agrarian-cli-res.rc
@@ -1,3 +1,4 @@
+// Copyright (c) 2026 Agrarian Developers
#include // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information
@@ -32,4 +33,4 @@ BEGIN
BEGIN
VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal)
END
-END
+END
\ No newline at end of file
diff --git a/src/agrarian-cli.cpp b/src/agrarian-cli.cpp
index e54ed61f..1249a51a 100644
--- a/src/agrarian-cli.cpp
+++ b/src/agrarian-cli.cpp
@@ -2,6 +2,7 @@
// Copyright (c) 2009-2015 The Bitcoin developers
// Copyright (c) 2009-2015 The Dash developers
// Copyright (c) 2015-2018 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -23,9 +24,6 @@
#include
#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */
-
-using namespace std;
-
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
std::string HelpMessageCli()
@@ -116,13 +114,12 @@ struct HTTPReply
std::string body;
};
-static void http_request_done(struct evhttp_request *req, void *ctx)
+static void http_request_done(struct evhttp_request* req, void* ctx)
{
- HTTPReply *reply = static_cast(ctx);
+ HTTPReply* reply = static_cast(ctx);
- if (req == NULL) {
- /* If req is NULL, it means an error occurred while connecting, but
- * I'm not sure how to find out which one. We also don't really care.
+ if (req == nullptr) {
+ /* If req is nullptr, it means an error occurred while connecting, but* I'm not sure how to find out which one. We also don't really care.
*/
reply->status = 0;
return;
@@ -130,11 +127,11 @@ static void http_request_done(struct evhttp_request *req, void *ctx)
reply->status = evhttp_request_get_response_code(req);
- struct evbuffer *buf = evhttp_request_get_input_buffer(req);
+ struct evbuffer* buf = evhttp_request_get_input_buffer(req);
if (buf)
{
size_t size = evbuffer_get_length(buf);
- const char *data = (const char*)evbuffer_pullup(buf, size);
+ const char* data = (const char*)evbuffer_pullup(buf, size);
if (data)
reply->body = std::string(data, size);
evbuffer_drain(buf, size);
@@ -147,19 +144,19 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
int port = GetArg("-rpcport", BaseParams().RPCPort());
// Create event base
- struct event_base *base = event_base_new(); // TODO RAII
+ struct event_base* base = event_base_new(); // TODO RAII
if (!base)
throw runtime_error("cannot create event_base");
// Synchronously look up hostname
- struct evhttp_connection *evcon = evhttp_connection_base_new(base, NULL, host.c_str(), port); // TODO RAII
- if (evcon == NULL)
+ struct evhttp_connection* evcon = evhttp_connection_base_new(base, nullptr, host.c_str(), port); // TODO RAII
+ if (evcon == nullptr)
throw runtime_error("create connection failed");
evhttp_connection_set_timeout(evcon, GetArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT));
HTTPReply response;
- struct evhttp_request *req = evhttp_request_new(http_request_done, (void*)&response); // TODO RAII
- if (req == NULL)
+ struct evhttp_request* req = evhttp_request_new(http_request_done, (void*)&response); // TODO RAII
+ if (req == nullptr)
throw runtime_error("create http request failed");
// Get credentials
@@ -176,7 +173,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
}
- struct evkeyvalq *output_headers = evhttp_request_get_output_headers(req);
+ struct evkeyvalq* output_headers = evhttp_request_get_output_headers(req);
assert(output_headers);
evhttp_add_header(output_headers, "Host", host.c_str());
evhttp_add_header(output_headers, "Connection", "close");
@@ -184,7 +181,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
// Attach request data
std::string strRequest = JSONRPCRequest(strMethod, params, 1);
- struct evbuffer * output_buffer = evhttp_request_get_output_buffer(req);
+ struct evbuffer* output_buffer = evhttp_request_get_output_buffer(req);
assert(output_buffer);
evbuffer_add(output_buffer, strRequest.data(), strRequest.size());
@@ -280,7 +277,7 @@ int CommandLineRPC(int argc, char* argv[])
strPrint = string("error: ") + e.what();
nRet = EXIT_FAILURE;
} catch (...) {
- PrintExceptionContinue(NULL, "CommandLineRPC()");
+ PrintExceptionContinue(nullptr, "CommandLineRPC()");
throw;
}
@@ -305,7 +302,7 @@ int main(int argc, char* argv[])
PrintExceptionContinue(&e, "AppInitRPC()");
return EXIT_FAILURE;
} catch (...) {
- PrintExceptionContinue(NULL, "AppInitRPC()");
+ PrintExceptionContinue(nullptr, "AppInitRPC()");
return EXIT_FAILURE;
}
@@ -315,7 +312,7 @@ int main(int argc, char* argv[])
} catch (std::exception& e) {
PrintExceptionContinue(&e, "CommandLineRPC()");
} catch (...) {
- PrintExceptionContinue(NULL, "CommandLineRPC()");
+ PrintExceptionContinue(nullptr, "CommandLineRPC()");
}
return ret;
}
diff --git a/src/agrarian-tx-res.rc b/src/agrarian-tx-res.rc
index e12a5ac8..7d255126 100644
--- a/src/agrarian-tx-res.rc
+++ b/src/agrarian-tx-res.rc
@@ -1,3 +1,5 @@
+// Copyright (c) 2026 Agrarian Developers
+
#include // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information
diff --git a/src/agrarian-tx.cpp b/src/agrarian-tx.cpp
index 93fc22e2..befddfaf 100644
--- a/src/agrarian-tx.cpp
+++ b/src/agrarian-tx.cpp
@@ -1,5 +1,6 @@
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -24,8 +25,6 @@
#include
using namespace boost::assign;
-using namespace std;
-
static bool fCreateBlank;
static map registers;
CClientUIInterface uiInterface;
@@ -605,7 +604,7 @@ static int CommandLineRawTx(int argc, char* argv[])
strPrint = string("error: ") + e.what();
nRet = EXIT_FAILURE;
} catch (...) {
- PrintExceptionContinue(NULL, "CommandLineRawTx()");
+ PrintExceptionContinue(nullptr, "CommandLineRawTx()");
throw;
}
@@ -626,7 +625,7 @@ int main(int argc, char* argv[])
PrintExceptionContinue(&e, "AppInitRawTx()");
return EXIT_FAILURE;
} catch (...) {
- PrintExceptionContinue(NULL, "AppInitRawTx()");
+ PrintExceptionContinue(nullptr, "AppInitRawTx()");
return EXIT_FAILURE;
}
@@ -636,7 +635,7 @@ int main(int argc, char* argv[])
} catch (std::exception& e) {
PrintExceptionContinue(&e, "CommandLineRawTx()");
} catch (...) {
- PrintExceptionContinue(NULL, "CommandLineRawTx()");
+ PrintExceptionContinue(nullptr, "CommandLineRawTx()");
}
return ret;
}
diff --git a/src/agrariand-res.rc b/src/agrariand-res.rc
index 51e58de6..49e2f463 100644
--- a/src/agrariand-res.rc
+++ b/src/agrariand-res.rc
@@ -1,3 +1,5 @@
+// Copyright (c) 2026 Agrarian Developers
+
#include // needed for VERSIONINFO
#include "clientversion.h" // holds the needed client version information
diff --git a/src/agrariand.cpp b/src/agrariand.cpp
index 4e6a49ae..9e4a8437 100644
--- a/src/agrariand.cpp
+++ b/src/agrariand.cpp
@@ -2,6 +2,7 @@
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -29,13 +30,11 @@
* \section intro_sec Introduction
*
* This is the developer documentation of the reference client for an experimental new digital currency called Agrarian (http://www.agrarian.org),
- * which enables instant payments to anyone, anywhere in the world. Agrarian uses peer-to-peer technology to operate
- * with no central authority: managing transactions and issuing money are carried out collectively by the network.
+ * which enables instant payments to anyone, anywhere in the world. Agrarian uses peer-to-peer technology to operate* with no central authority: managing transactions and issuing money are carried out collectively by the network.
*
* The software is a community-driven open source project, released under the MIT license.
*
- * \section Navigation
- * Use the buttons Namespaces, Classes or Files at the top of the page to start navigating the code.
+ * \section Navigation* Use the buttons Namespaces, Classes or Files at the top of the page to start navigating the code.
*/
static bool fDaemon;
@@ -144,7 +143,7 @@ bool AppInit(int argc, char* argv[])
} catch (std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");
} catch (...) {
- PrintExceptionContinue(NULL, "AppInit()");
+ PrintExceptionContinue(nullptr, "AppInit()");
}
if (!fRet) {
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 65ba3a87..1e6cc1b5 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -2,11 +2,14 @@
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "libzerocoin/Params.h"
+
#include "chainparams.h"
+#include "chainparamsseeds.h"
#include "random.h"
#include "util.h"
#include "utilstrencodings.h"
@@ -23,8 +26,6 @@ struct SeedSpec6 {
uint16_t port;
};
-#include "chainparamsseeds.h"
-
/**
* Main network
*/
@@ -57,9 +58,9 @@ static Checkpoints::MapCheckpoints mapCheckpoints =
static const Checkpoints::CCheckpointData data = {
&mapCheckpoints,
1643790201, // * UNIX timestamp of last checkpoint block
- 0, // * total number of transactions between genesis and last checkpoint
+ 0, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
- 0 // * estimated number of transactions per day after checkpoint
+ 0 // * estimated number of transactions per day after checkpoint
};
static Checkpoints::MapCheckpoints mapCheckpointsTestnet =
@@ -69,7 +70,8 @@ static const Checkpoints::CCheckpointData dataTestnet = {
&mapCheckpointsTestnet,
1643790201,
0,
- 0};
+ 0
+};
static Checkpoints::MapCheckpoints mapCheckpointsRegtest =
boost::assign::map_list_of(0, uint256("0x001"));
@@ -77,24 +79,24 @@ static const Checkpoints::CCheckpointData dataRegtest = {
&mapCheckpointsRegtest,
1643790201,
0,
- 0};
+ 0
+};
libzerocoin::ZerocoinParams* CChainParams::Zerocoin_Params(bool useModulusV1) const
{
assert(this);
+
static CBigNum bnHexModulus = 0;
if (!bnHexModulus)
bnHexModulus.SetHex(zerocoinModulus);
static libzerocoin::ZerocoinParams ZCParamsHex = libzerocoin::ZerocoinParams(bnHexModulus);
+
static CBigNum bnDecModulus = 0;
if (!bnDecModulus)
bnDecModulus.SetDec(zerocoinModulus);
static libzerocoin::ZerocoinParams ZCParamsDec = libzerocoin::ZerocoinParams(bnDecModulus);
- if (useModulusV1)
- return &ZCParamsHex;
-
- return &ZCParamsDec;
+ return useModulusV1 ? &ZCParamsHex : &ZCParamsDec;
}
class CMainParams : public CChainParams
@@ -130,26 +132,33 @@ public:
/** Height or Time Based Activations **/
nLastPOWBlock = 100;
- nModifierUpdateBlock = 2; //The block at which PoS rules activate
+
+ // Hybrid consensus: PoW mining and PoS staking are both permitted beginning at block 2.
+ // PoW remains permitted until nLastPOWBlock.
+ nFirstPoSBlock = 2;
+
+ // PIVX-style modifier upgrade: keep aligned with PoS activation.
+ nModifierUpdateBlock = 2;
+
nZerocoinStartHeight = 0;
nZerocoinStartTime = 1643790201;
- nBlockEnforceSerialRange = 1; //Enforce serial range starting this block
- nBlockRecalculateAccumulators = 999999999; //Trigger a recalculation of accumulators
- nBlockFirstFraudulent = 999999999; //First block that bad serials emerged
- nBlockLastGoodCheckpoint = 999999999; //Last valid accumulator checkpoint
- nBlockEnforceInvalidUTXO = 999999999; //Start enforcing the invalid UTXO's
- nInvalidAmountFiltered = 0; //Amount of invalid coins filtered through exchanges, that should be considered valid
+ nBlockEnforceSerialRange = 1; // Enforce serial range starting this block
+ nBlockRecalculateAccumulators = 999999999; // Trigger a recalculation of accumulators
+ nBlockFirstFraudulent = 999999999; // First block that bad serials emerged
+ nBlockLastGoodCheckpoint = 999999999; // Last valid accumulator checkpoint
+ nBlockEnforceInvalidUTXO = 999999999; // Start enforcing the invalid UTXO's
+ nInvalidAmountFiltered = 0; // Amount of invalid coins filtered through exchanges, that should be considered valid
nBlockZerocoinV2 = 999999999;
nBlockDoubleAccumulated = 999999999;
nEnforceNewSporkKey = 1643790201;
- nRejectOldSporkKey = 1527811200;
+ nRejectOldSporkKey = 1527811200;
// Public coin spend enforcement
nPublicZCSpends = 1;
// Fake Serial Attack
nFakeSerialBlockheightEnd = 0;
- nSupplyBeforeFakeSerial = 0; // zerocoin supply at block nFakeSerialBlockheightEnd
+ nSupplyBeforeFakeSerial = 0; // zerocoin supply at block nFakeSerialBlockheightEnd
/**
* Build the genesis block. Note that the output of the genesis coinbase cannot
@@ -165,7 +174,9 @@ public:
CMutableTransaction txNew;
txNew.vin.resize(1);
txNew.vout.resize(1);
- txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
+ txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4)
+ << vector((const unsigned char*)pszTimestamp,
+ (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = 50 * COIN;
txNew.vout[0].scriptPubKey = CScript() << ParseHex("04fe3d7e5608ebba6d822948eff929c822ad35b5f8ecd00977d0e59ed67da697bd88e0ed8bd58797bde6fe6750236f5dae4cf403af0925c8339f0a91b682254b39") << OP_CHECKSIG;
genesis.vtx.push_back(txNew);
@@ -211,22 +222,22 @@ public:
/** Zerocoin */
zerocoinModulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
- "4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
- "6507761337985909570009733045974880842840179742910064245869181719511874612151517265463228221686998754918242243363"
- "7259085141865462043576798423387184774447920739934236584823824281198163815010674810451660377306056201619676256133"
- "8441436038339044149526344321901146575444541784240209246165157233507787077498171257724679629263863563732899121548"
- "31438167899885040445364023527381951378636564391212010397122822120720357";
- nMaxZerocoinSpendsPerTransaction = 7; // Assume about 20kb each
+ "4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
+ "6507761337985909570009733045974880842840179742910064245869181719511874612151517265463228221686998754918242243363"
+ "7259085141865462043576798423387184774447920739934236584823824281198163815010674810451660377306056201619676256133"
+ "8441436038339044149526344321901146575444541784240209246165157233507787077498171257724679629263863563732899121548"
+ "31438167899885040445364023527381951378636564391212010397122822120720357";
+ nMaxZerocoinSpendsPerTransaction = 7; // Assume about 20kb each
nMaxZerocoinPublicSpendsPerTransaction = 637; // Assume about 220 bytes each input
- nMinZerocoinMintFee = 1 * CENT; //high fee required for zerocoin mints
- nMintRequiredConfirmations = 20; //the maximum amount of confirmations until accumulated in 19
+ nMinZerocoinMintFee = 1 * CENT; // high fee required for zerocoin mints
+ nMintRequiredConfirmations = 20; // the maximum amount of confirmations until accumulated in 19
nRequiredAccumulation = 1;
- nDefaultSecurityLevel = 100; //full security level for accumulators
- nZerocoinHeaderVersion = 4; //Block headers must be this version once zerocoin is active
- nZerocoinRequiredStakeDepth = 200; //The required confirmations for a zagr to be stakable
+ nDefaultSecurityLevel = 100; // full security level for accumulators
+ nZerocoinHeaderVersion = 4; // Block headers must be this version once zerocoin is active
+ nZerocoinRequiredStakeDepth = 200; // The required confirmations for a zagr to be stakable
- nBudget_Fee_Confirmations = 6; // Number of confirmations for the finalization fee
- nProposalEstablishmentTime = 60 * 60 * 24; // Proposals must be at least a day old to make it into a budget
+ nBudget_Fee_Confirmations = 6; // Number of confirmations for the finalization fee
+ nProposalEstablishmentTime = 60 * 60 * 24; // Proposals must be at least a day old to make it into a budget
}
const Checkpoints::CCheckpointData& Checkpoints() const
@@ -258,22 +269,30 @@ public:
nMinerThreads = 0;
nTargetTimespan = 10 * 60;
nTargetSpacing = 10 * 60;
+
nLastPOWBlock = 200;
+
+ // Hybrid consensus: PoS staking permitted from block 2 in testnet as well.
+ nFirstPoSBlock = 2;
+
nMaturity = 15;
nMasternodeCountDrift = 4;
- nModifierUpdateBlock = 0;
+
+ // Keep aligned with PoS activation in this chain.
+ nModifierUpdateBlock = 2;
+
nMaxMoneyOut = 43199500 * COIN;
nZerocoinStartHeight = 0;
nZerocoinStartTime = 1643790201;
- nBlockEnforceSerialRange = 1; //Enforce serial range starting this block
- nBlockRecalculateAccumulators = 999999999; //Trigger a recalculation of accumulators
- nBlockFirstFraudulent = 999999999; //First block that bad serials emerged
- nBlockLastGoodCheckpoint = 999999999; //Last valid accumulator checkpoint
- nBlockEnforceInvalidUTXO = 999999999; //Start enforcing the invalid UTXO's
- nInvalidAmountFiltered = 0; //Amount of invalid coins filtered through exchanges, that should be considered valid
- nBlockZerocoinV2 = 999999999; //!> The block that zerocoin v2 becomes active
+ nBlockEnforceSerialRange = 1; // Enforce serial range starting this block
+ nBlockRecalculateAccumulators = 999999999; // Trigger a recalculation of accumulators
+ nBlockFirstFraudulent = 999999999; // First block that bad serials emerged
+ nBlockLastGoodCheckpoint = 999999999; // Last valid accumulator checkpoint
+ nBlockEnforceInvalidUTXO = 999999999; // Start enforcing the invalid UTXO's
+ nInvalidAmountFiltered = 0; // Amount of invalid coins filtered through exchanges, that should be considered valid
+ nBlockZerocoinV2 = 999999999; //!> The block that zerocoin v2 becomes active
nEnforceNewSporkKey = 1643790201;
- nRejectOldSporkKey = 1522454400;
+ nRejectOldSporkKey = 1522454400;
// Public coin spend enforcement
nPublicZCSpends = 1;
@@ -292,12 +311,12 @@ public:
vFixedSeeds.clear();
vSeeds.clear();
- base58Prefixes[PUBKEY_ADDRESS] = std::vector(1, 38);
- base58Prefixes[SCRIPT_ADDRESS] = std::vector(1, 39);
- base58Prefixes[SECRET_KEY] = std::vector(1, 166);
-
+ base58Prefixes[PUBKEY_ADDRESS] = std::vector(1, 38);
+ base58Prefixes[SCRIPT_ADDRESS] = std::vector(1, 39);
+ base58Prefixes[SECRET_KEY] = std::vector(1, 166);
+
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x3a)(0x80)(0x61)(0xa0).convert_to_container >();
-
+
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x3a)(0x80)(0x58)(0x37).convert_to_container >();
// Testnet agrarian BIP44 coin type is '1' (All coin's testnet default)
base58Prefixes[EXT_COIN_TYPE] = boost::assign::list_of(0x80)(0x00)(0x00)(0x01).convert_to_container >();
@@ -322,6 +341,7 @@ public:
nProposalEstablishmentTime = 60 * 5; // Proposals must be at least 5 mns old to make it into a test budget
}
+
const Checkpoints::CCheckpointData& Checkpoints() const
{
return dataTestnet;
@@ -352,18 +372,26 @@ public:
nTargetTimespan = 24 * 60 * 60; // Agrarian: 1 day
nTargetSpacing = 1 * 60; // Agrarian: 1 minutes
bnProofOfWorkLimit = ~uint256(0) >> 1;
+
nLastPOWBlock = 250;
+
+ // Hybrid consensus: PoS staking permitted from block 2 in regtest as well.
+ nFirstPoSBlock = 2;
+
nMaturity = 20;
nMasternodeCountDrift = 4;
- nModifierUpdateBlock = 0; //approx Mon, 17 Apr 2017 04:00:00 GMT
+
+ // Keep aligned with PoS activation in this chain.
+ nModifierUpdateBlock = 2;
+
nMaxMoneyOut = 43199500 * COIN;
nZerocoinStartHeight = 300;
nBlockZerocoinV2 = 300;
nZerocoinStartTime = 1643790201;
- nBlockEnforceSerialRange = 1; //Enforce serial range starting this block
- nBlockRecalculateAccumulators = 999999999; //Trigger a recalculation of accumulators
- nBlockFirstFraudulent = 999999999; //First block that bad serials emerged
- nBlockLastGoodCheckpoint = 999999999; //Last valid accumulator checkpoint
+ nBlockEnforceSerialRange = 1; // Enforce serial range starting this block
+ nBlockRecalculateAccumulators = 999999999; // Trigger a recalculation of accumulators
+ nBlockFirstFraudulent = 999999999; // First block that bad serials emerged
+ nBlockLastGoodCheckpoint = 999999999; // Last valid accumulator checkpoint
// Public coin spend enforcement
nPublicZCSpends = 350;
@@ -390,6 +418,7 @@ public:
fSkipProofOfWorkCheck = true;
fTestnetToBeDeprecatedFieldRPC = false;
}
+
const Checkpoints::CCheckpointData& Checkpoints() const
{
return dataRegtest;
@@ -434,7 +463,6 @@ public:
};
static CUnitTestParams unitTestParams;
-
static CChainParams* pCurrentParams = 0;
CModifiableParams* ModifiableParams()
diff --git a/src/chainparams.h b/src/chainparams.h
index 376cdf55..e9faa989 100644
--- a/src/chainparams.h
+++ b/src/chainparams.h
@@ -2,6 +2,7 @@
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -15,6 +16,7 @@
#include "uint256.h"
#include "libzerocoin/Params.h"
+
#include
typedef unsigned char MessageStartChars[MESSAGE_START_SIZE];
@@ -63,7 +65,7 @@ public:
/** Make miner wait to have peers to avoid wasting work */
bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
/** Headers first syncing is disabled */
- bool HeadersFirstSyncingActive() const { return fHeadersFirstSyncingActive; };
+ bool HeadersFirstSyncingActive() const { return fHeadersFirstSyncingActive; }
/** Default value for -checkmempool and -checkblockindex argument */
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
/** Allow mining of a min-difficulty block */
@@ -119,7 +121,13 @@ public:
/** Height or Time Based Activations **/
int ModifierUpgradeBlock() const { return nModifierUpdateBlock; }
+
+ // Hybrid consensus activations.
+ // - PoS blocks are permitted starting at FIRST_POS_BLOCK().
+ // - PoW blocks are permitted up to and including LAST_POW_BLOCK().
+ int FIRST_POS_BLOCK() const { return nFirstPoSBlock; }
int LAST_POW_BLOCK() const { return nLastPOWBlock; }
+
int Zerocoin_StartHeight() const { return nZerocoinStartHeight; }
int Zerocoin_Block_EnforceSerialRange() const { return nBlockEnforceSerialRange; }
int Zerocoin_Block_RecalculateAccumulators() const { return nBlockRecalculateAccumulators; }
@@ -134,7 +142,7 @@ public:
CAmount GetSupplyBeforeFakeSerial() const { return nSupplyBeforeFakeSerial; }
int Zerocoin_Block_Double_Accumulated() const { return nBlockDoubleAccumulated; }
- CAmount InvalidAmountFiltered() const { return nInvalidAmountFiltered; };
+ CAmount InvalidAmountFiltered() const { return nInvalidAmountFiltered; }
int Zerocoin_Block_Public_Spend_Enabled() const { return nPublicZCSpends; }
@@ -154,7 +162,11 @@ protected:
int nToCheckBlockUpgradeMajority;
int64_t nTargetTimespan;
int64_t nTargetSpacing;
+
+ // Hybrid PoW/PoS window controls.
+ int nFirstPoSBlock;
int nLastPOWBlock;
+
int nMasternodeCountDrift;
int nMaturity;
int nModifierUpdateBlock;
@@ -216,7 +228,6 @@ protected:
* to test specific features more easily. Test cases should always restore the previous
* values after finalization.
*/
-
class CModifiableParams
{
public:
@@ -230,7 +241,6 @@ public:
virtual void setSkipProofOfWorkCheck(bool aSkipProofOfWorkCheck) = 0;
};
-
/**
* Return the currently selected parameters. This won't change after app startup
* outside of the unit tests.
diff --git a/src/kernel.cpp b/src/kernel.cpp
index b9286120..a46d3682 100644
--- a/src/kernel.cpp
+++ b/src/kernel.cpp
@@ -1,5 +1,6 @@
// Copyright (c) 2012-2013 The PPCoin developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -13,9 +14,6 @@
#include "stakeinput.h"
#include "utilmoneystr.h"
#include "zagrchain.h"
-
-using namespace std;
-
bool fTestNet = false; // Params().NetworkID() == CBaseChainParams::TESTNET;
// Modifier interval: time to elapse before new modifier is computed
@@ -313,7 +311,7 @@ bool stakeTargetHit(const uint256& hashProofOfStake, const int64_t& nValueIn, co
uint256 bnCoinDayWeight = uint256(nValueIn) / 100;
// Check if proof-of-stake hash meets the target protocol
- return hashProofOfStake < (bnCoinDayWeight * bnTargetPerCoinDay);
+ return hashProofOfStake < (bnCoinDayWeight* bnTargetPerCoinDay);
}
bool CheckStake(const CDataStream& ssUniqueID, CAmount nValueIn, const uint64_t nStakeModifier, const uint256& bnTarget,
diff --git a/src/kernel.h b/src/kernel.h
index 12ffc115..0fb6767d 100644
--- a/src/kernel.h
+++ b/src/kernel.h
@@ -1,13 +1,15 @@
// Copyright (c) 2012-2013 The PPCoin developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_KERNEL_H
-#define BITCOIN_KERNEL_H
-
+#ifndef AGRARIAN_BITCOIN_KERNEL_H
+#define AGRARIAN_BITCOIN_KERNEL_H
#include "main.h"
#include "stakeinput.h"
+#include
+#include
+#include
// MODIFIER_INTERVAL: time to elapse before new modifier is computed
@@ -46,4 +48,4 @@ int64_t GetWeight(int64_t nIntervalBeginning, int64_t nIntervalEnd);
bool ContextualCheckZerocoinStake(int nPreviousBlockHeight, CStakeInput* stake);
-#endif // BITCOIN_KERNEL_H
+#endif // AGRARIAN_BITCOIN_KERNEL_H
diff --git a/src/main.cpp b/src/main.cpp
index e1f3f164..33e8d1bb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,6 +2,7 @@
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 The Agrarian developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -1986,23 +1987,41 @@ double ConvertBitsToDouble(unsigned int nBits)
return dDiff;
}
+int64_t GetBlockValue(int nHeight, bool fProofOfStake)
+{
+ // NOTE:
+ // - Height 0 is genesis and uses the special, pre-mined value.
+ // - During the hybrid window, both PoW and PoS blocks may be created.
+ // Subsidy policy is therefore selected by block type, not by height alone.
+ //
+ // Current Agrarian policy:
+ // * PoW blocks (height > 0 && height <= LAST_POW_BLOCK): 50 AGR
+ // * PoS blocks (height >= FIRST_POS_BLOCK): 10 AGR
+ // * PoW blocks are not valid beyond LAST_POW_BLOCK (enforced elsewhere).
+ if (nHeight == 0) {
+ return 5000000000 * COIN;
+ }
+
+ if (fProofOfStake) {
+ return 10 * COIN;
+ }
+
+ if (nHeight > 0 && nHeight <= Params().LAST_POW_BLOCK()) {
+ return 50 * COIN;
+ }
+
+ // Should not be reachable for valid blocks (PoW is disallowed beyond LAST_POW_BLOCK).
+ return 0;
+}
+
+// Backward-compatible wrapper for call sites that only know height.
+// Prefer GetBlockValue(height, isPoS) when block type is available.
int64_t GetBlockValue(int nHeight)
{
- int64_t nSubsidy = 0;
-
- if (nHeight == 0) {
- nSubsidy = 5000000000 * COIN;
- }
- else if (nHeight <= Params().LAST_POW_BLOCK() && nHeight > 0) {
- nSubsidy = 50 * COIN;
- }
- else if (nHeight > Params().LAST_POW_BLOCK()) {
- nSubsidy = 10 * COIN;
- }
-
- return nSubsidy;
+ return GetBlockValue(nHeight, false);
}
+
CAmount GetSeeSaw(const CAmount& blockValue, int nMasternodeCount, int nHeight)
{
//if a mn count is inserted into the function we are looking for a specific result for a masternode count
@@ -2911,15 +2930,17 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return true;
}
- if (pindex->nHeight <= Params().LAST_POW_BLOCK() && block.IsProofOfStake())
- return state.DoS(100, error("ConnectBlock() : PoS period not active"),
- REJECT_INVALID, "PoS-early");
+ // Hybrid consensus:
+// - PoS blocks are permitted starting at Params().FIRST_POS_BLOCK().
+// - PoW blocks are permitted up to and including Params().LAST_POW_BLOCK().
+if (block.IsProofOfStake() && pindex->nHeight < Params().FIRST_POS_BLOCK())
+ return state.DoS(100, error("ConnectBlock() : PoS period not active"),
+ REJECT_INVALID, "PoS-early");
- if (pindex->nHeight > Params().LAST_POW_BLOCK() && block.IsProofOfWork())
- return state.DoS(100, error("ConnectBlock() : PoW period ended"),
- REJECT_INVALID, "PoW-ended");
-
- bool fScriptChecks = pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate();
+if (block.IsProofOfWork() && pindex->nHeight > Params().LAST_POW_BLOCK())
+ return state.DoS(100, error("ConnectBlock() : PoW period ended"),
+ REJECT_INVALID, "PoW-ended");
+bool fScriptChecks = pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate();
// If scripts won't be checked anyways, don't bother seeing if CLTV is activated
bool fCLTVHasMajority = false;
@@ -3132,7 +3153,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime1 - nTimeStart) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart) / (nInputs - 1), nTimeConnect * 0.000001);
//PoW phase redistributed fees to miner. PoS stage destroys fees.
- CAmount nExpectedMint = GetBlockValue(pindex->pprev->nHeight);
+ CAmount nExpectedMint = GetBlockValue(pindex->nHeight, block.IsProofOfStake());
if (block.IsProofOfWork())
nExpectedMint += nFees;
diff --git a/src/main.h b/src/main.h
index 12e9cc08..5997a936 100644
--- a/src/main.h
+++ b/src/main.h
@@ -2,6 +2,7 @@
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -20,8 +21,6 @@
#include "pow.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
-#include "zagr/zerocoin.h"
-#include "zagr/zagrmodule.h"
#include "script/script.h"
#include "script/sigcache.h"
#include "script/standard.h"
@@ -30,6 +29,8 @@
#include "txmempool.h"
#include "uint256.h"
#include "undo.h"
+#include "zagr/zerocoin.h"
+#include "zagr/zagrmodule.h"
#include
#include
@@ -108,7 +109,7 @@ static const unsigned int DATABASE_WRITE_INTERVAL = 3600;
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
/** Enable bloom filter */
- static const bool DEFAULT_PEERBLOOMFILTERS = true;
+static const bool DEFAULT_PEERBLOOMFILTERS = true;
static const bool DEFAULT_PEERBLOOMFILTERS_ZC = false;
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
@@ -175,7 +176,7 @@ extern int64_t nReserveBalance;
extern std::map mapRejectedBlocks;
extern std::map mapHashedBlocks;
-extern std::map mapZerocoinspends; //txid, time received
+extern std::map mapZerocoinspends; // txid, time received
/** Best header we've seen so far (used for getheaders queries' starting points). */
extern CBlockIndex* pindexBestHeader;
@@ -241,11 +242,16 @@ std::string GetWarnings(std::string strFor);
bool GetTransaction(const uint256& hash, CTransaction& tx, uint256& hashBlock, bool fAllowSlow = false, CBlockIndex* blockIndex = nullptr);
/** Retrieve an output (from memory pool, or from disk, if possible) */
bool GetOutput(const uint256& hash, unsigned int index, CValidationState& state, CTxOut& out);
-/** Find the best known block, and make it the tip of the block chain */
-// ***TODO***
+/** TODO (legacy) */
double ConvertBitsToDouble(unsigned int nBits);
int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCount, bool isZAGRStake);
+
+/**
+ * Hybrid difficulty selection.
+ * Implementations should route to the correct target calculation (PoW vs PoS)
+ * based on the fProofOfStake flag rather than height-era assumptions.
+ */
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader* pblock, bool fProofOfStake);
bool ActivateBestChain(CValidationState& state, CBlock* pblock = NULL, bool fAlreadyChecked = false);
@@ -262,7 +268,6 @@ void Misbehaving(NodeId nodeid, int howmuch);
/** Flush all state, indexes and buffers to disk. */
void FlushStateToDisk();
-
/** (try to) add transaction to memory pool **/
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransaction& tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee = false, bool ignoreFees = false);
@@ -291,14 +296,8 @@ struct CDiskTxPos : public CDiskBlockPos {
READWRITE(VARINT(nTxOffset));
}
- CDiskTxPos(const CDiskBlockPos& blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn)
- {
- }
-
- CDiskTxPos()
- {
- SetNull();
- }
+ CDiskTxPos(const CDiskBlockPos& blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {}
+ CDiskTxPos() { SetNull(); }
void SetNull()
{
@@ -307,22 +306,9 @@ struct CDiskTxPos : public CDiskBlockPos {
}
};
-
CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree);
bool MoneyRange(CAmount nValueOut);
-/**
- * Check transaction inputs, and make sure any
- * pay-to-script-hash transactions are evaluating IsStandard scripts
- *
- * Why bother? To avoid denial-of-service attacks; an attacker
- * can submit a standard HASH... OP_EQUAL transaction,
- * which will get accepted into blocks. The redemption
- * script can be anything; an attacker could use a very
- * expensive-to-check-upon-redemption script like:
- * DUP CHECKSIG DROP ... repeated 100 times... OP_1
- */
-
/**
* Check for standard transaction types
* @param[in] mapInputs Map of previous transactions that have outputs we're spending
@@ -346,7 +332,6 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx);
*/
unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& mapInputs);
-
/**
* Check whether all inputs of this transaction are valid (no double spends, scripts & sigs, amounts)
* This does not modify the UTXO set. If pvChecks is not NULL, script checks are pushed onto it
@@ -413,7 +398,6 @@ public:
bool ReadFromDisk(const CDiskBlockPos& pos, const uint256& hashBlock);
};
-
/**
* Closure representing one script verification
* Note that this stores references to the spending transaction
@@ -430,8 +414,15 @@ private:
public:
CScriptCheck() : ptxTo(0), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR) {}
- CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn) : scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
- ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR) {}
+ CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn)
+ : scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
+ ptxTo(&txToIn),
+ nIn(nInIn),
+ nFlags(nFlagsIn),
+ cacheStore(cacheIn),
+ error(SCRIPT_ERR_UNKNOWN_ERROR)
+ {
+ }
bool operator()();
@@ -448,13 +439,11 @@ public:
ScriptError GetScriptError() const { return error; }
};
-
/** Functions for disk access for blocks */
bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos);
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos);
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex);
-
/** Functions for validating blocks and updating the block tree */
/** Undo the effects of this block (with given index) on the UTXO set represented by coins.
@@ -479,13 +468,12 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindexPrev);
/** Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) */
-bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
+bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true, bool fCheckSig = true);
/** Store block on disk. If dbp is provided, the file is known to already reside on disk */
bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** pindex, CDiskBlockPos* dbp = NULL, bool fAlreadyCheckedBlock = false);
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex** ppindex = NULL);
-
class CBlockFileInfo
{
public:
@@ -522,10 +510,7 @@ public:
nTimeLast = 0;
}
- CBlockFileInfo()
- {
- SetNull();
- }
+ CBlockFileInfo() { SetNull(); }
std::string ToString() const;
@@ -560,6 +545,7 @@ private:
public:
CValidationState() : mode(MODE_VALID), nDoS(0), chRejectCode(0), corruptionPossible(false) {}
+
bool DoS(int level, bool ret = false, unsigned char chRejectCodeIn = 0, std::string strRejectReasonIn = "", bool corruptionIn = false)
{
chRejectCode = chRejectCodeIn;
@@ -571,12 +557,12 @@ public:
mode = MODE_INVALID;
return ret;
}
- bool Invalid(bool ret = false,
- unsigned char _chRejectCode = 0,
- std::string _strRejectReason = "")
+
+ bool Invalid(bool ret = false, unsigned char _chRejectCode = 0, std::string _strRejectReason = "")
{
return DoS(0, ret, _chRejectCode, _strRejectReason);
}
+
bool Error(std::string strRejectReasonIn = "")
{
if (mode == MODE_VALID)
@@ -584,23 +570,17 @@ public:
mode = MODE_ERROR;
return false;
}
+
bool Abort(const std::string& msg)
{
AbortNode(msg);
return Error(msg);
}
- bool IsValid() const
- {
- return mode == MODE_VALID;
- }
- bool IsInvalid() const
- {
- return mode == MODE_INVALID;
- }
- bool IsError() const
- {
- return mode == MODE_ERROR;
- }
+
+ bool IsValid() const { return mode == MODE_VALID; }
+ bool IsInvalid() const { return mode == MODE_INVALID; }
+ bool IsError() const { return mode == MODE_ERROR; }
+
bool IsInvalid(int& nDoSOut) const
{
if (IsInvalid()) {
@@ -609,10 +589,8 @@ public:
}
return false;
}
- bool CorruptionPossible() const
- {
- return corruptionPossible;
- }
+
+ bool CorruptionPossible() const { return corruptionPossible; }
unsigned char GetRejectCode() const { return chRejectCode; }
std::string GetRejectReason() const { return strRejectReason; }
};
diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp
index 6e031ace..d854e732 100644
--- a/src/masternode-budget.cpp
+++ b/src/masternode-budget.cpp
@@ -1,5 +1,6 @@
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2019 The PIVX developers
+// Copyright (c) 2026 Agrarian Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -16,6 +17,17 @@
#include "util.h"
#include
+#include
+#include
+#include
+#include