Skip to content

Commit 8369570

Browse files
hebastol0rincpablomartin4btc
authored andcommitted
doc: Update for CMake-based build system
Co-authored-by: Lőrinc <[email protected]> Co-authored-by: pablomartin4btc <[email protected]>
1 parent afae13b commit 8369570

18 files changed

+440
-497
lines changed

README.md

+59-189
Original file line numberDiff line numberDiff line change
@@ -1,192 +1,62 @@
1-
<!-- PROJECT LOGO -->
2-
<br />
3-
<p align="center">
4-
<a href="https://github.com/BitgesellOfficial/bitgesell">
5-
<img src="https://github.com/BitgesellOfficial/bitgesell/blob/master/share/pixmaps/BGL64.png" alt="Logo" width="80" height="80">
6-
</a>
7-
8-
<h3 align="center">Bitgesell (BGL)</h3>
9-
10-
<p align="center">
11-
Bitgesell (BGL) is a digital currency
12-
<br />
13-
<a href="https://bitgesell.ca/"><strong>Explore more about project »</strong></a>
14-
<br />
15-
<br />
16-
<a href="#">English</a>
17-
·
18-
<a href="https://github.com/BitgesellOfficial/bitgesell/blob/master/README-zh.md">Chinese</a>
19-
</p>
20-
</p>
21-
22-
23-
24-
<!-- TABLE OF CONTENTS -->
25-
<details open="open">
26-
<summary>Table of Contents</summary>
27-
<ol>
28-
<li>
29-
<a href="#about-the-project">About The Project</a>
30-
<ul>
31-
<li><a href="#built-with">Built With</a></li>
32-
</ul>
33-
</li>
34-
<li>
35-
<a href="#getting-started">Getting Started</a>
36-
<!-- <ul>
37-
<li><a href="#prerequisites">Prerequisites</a></li>
38-
<li><a href="#installation">Installation</a></li>
39-
</ul> -->
40-
</li>
41-
<li><a href="#roadmap">Roadmap</a></li>
42-
<li><a href="#contributing">Contributing</a></li>
43-
<li><a href="#license">License</a></li>
44-
<li><a href="#contact">Contact</a></li>
45-
<li><a href="#acknowledgements">Translations</a></li>
46-
</ol>
47-
</details>
48-
49-
50-
<!-- ABOUT THE PROJECT -->
51-
## About The Project
52-
53-
![Product Name Screen Shot](https://github.com/BitgesellOfficial/bitgesell/blob/master/share/pixmaps/BGL64.png)
54-
55-
56-
Features:
57-
* secp256k1 ECDSA signing/verification and key generation.
58-
* Additive and multiplicative tweaking of secret/public keys.
59-
* Serialization/parsing of secret keys, public keys, signatures.
60-
* Constant time, constant memory access signing and public key generation.
61-
* Derandomized ECDSA (via RFC6979 or with a caller provided function.)
62-
* Very efficient implementation.
63-
* Suitable for embedded systems.
64-
* Optional module for public key recovery.
65-
* Optional module for ECDH key exchange.
66-
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
67-
68-
<b>Bitgesell is a fork of Bitcoin with the following changes:</b> <br>
69-
* Block Reward [Burn rate is 90% of tx fees]
70-
```sh
71-
nFees*0.1 + GetBlockSubsidy()
72-
```
73-
* Block Weight [10 times smaller than Bitcoin]
74-
```sh
75-
<= 400,000
76-
```
77-
* 100% Segwit
78-
```sh
79-
Eliminates problems with legacy type of transactions
80-
```
81-
* Halving Interval [Halving cycle of Bitgesell is 1 year while that of Bitcoin is 4 years]
82-
```sh
83-
210000 blocks/4
84-
```
85-
* Block Subsidy [Max coins = 21,000,000] <br>
86-
`210000 blocks/4` <br> <hr>
87-
`Hashing algorithm for blocks is Keccak (sha-3).` <br> <hr>
88-
`The master branch is regularly built (see` [doc/build-*.md](https://github.com/BitgesellOfficial/bitgesell/tree/master/doc) `for instructions) and tested, but is not guaranteed to be completely stable.` <br> <hr>
89-
[tags](https://github.com/BitgesellOfficial/bitgesell/tags) `are created regularly to indicate new official, stable release versions of BGL Core.` <br>
90-
91-
92-
### Built With
93-
94-
* General
95-
* No runtime heap allocation.
96-
* Extensive testing infrastructure.
97-
* Structured to facilitate review and analysis.
98-
* Intended to be portable to any system with a C89 compiler and uint64_t support.
99-
* No use of floating types.
100-
* Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.")
101-
* Field operations
102-
* Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1).
103-
* Using 5 52-bit limbs
104-
* Using 10 26-bit limbs (including hand-optimized assembly for 32-bit ARM, by Wladimir J. van der Laan).
105-
* This is an experimental feature that has not received enough scrutiny to satisfy the standard of quality of this library but is made available for testing and review by the community.
106-
* Scalar operations
107-
* Optimized implementation without data-dependent branches of arithmetic modulo the curve's order.
108-
* Using 4 64-bit limbs (relying on __int128 support in the compiler).
109-
* Using 8 32-bit limbs.
110-
* Modular inverses (both field elements and scalars) based on [safegcd](https://gcd.cr.yp.to/index.html) with some modifications, and a variable-time variant (by Peter Dettman).
111-
* Group operations
112-
* Point addition formula specifically simplified for the curve equation (y^2 = x^3 + 7).
113-
* Use addition between points in Jacobian and affine coordinates where possible.
114-
* Use a unified addition/doubling formula where necessary to avoid data-dependent branches.
115-
* Point/x comparison without a field inversion by comparison in the Jacobian coordinate space.
116-
* Point multiplication for verification (a*P + b*G).
117-
* Use wNAF notation for point multiplicands.
118-
* Use a much larger window for multiples of G, using precomputed multiples.
119-
* Use Shamir's trick to do the multiplication with the public key and the generator simultaneously.
120-
* Use secp256k1's efficiently-computable endomorphism to split the P multiplicand into 2 half-sized ones.
121-
* Point multiplication for signing
122-
* Use a precomputed table of multiples of powers of 16 multiplied with the generator, so general multiplication becomes a series of additions.
123-
* Intended to be completely free of timing sidechannels for secret-key operations (on reasonable hardware/toolchains)
124-
* Access the table with branch-free conditional moves so memory access is uniform.
125-
* No data-dependent branches
126-
* Optional runtime blinding which attempts to frustrate differential power analysis.
127-
* The precomputed tables add and eventually subtract points for which no known scalar (secret key) is known, preventing even an attacker with control over the secret key used to control the data internally.
128-
129-
Building with Autotools
130-
-----------------------
131-
132-
$ ./autogen.sh
133-
$ ./configure
134-
$ make
135-
$ make check # run the test suite
136-
$ sudo make install # optional
137-
138-
To compile optional modules (such as Schnorr signatures), you need to run `./configure` with additional flags (such as `--enable-module-schnorrsig`). Run `./configure --help` to see the full list of available flags.
139-
140-
Building with CMake (experimental)
141-
----------------------------------
142-
143-
To maintain a pristine source tree, CMake encourages to perform an out-of-source build by using a separate dedicated build tree.
144-
145-
### Building on POSIX systems
146-
147-
$ mkdir build && cd build
148-
$ cmake ..
149-
$ cmake --build .
150-
$ ctest # run the test suite
151-
$ sudo cmake --install . # optional
152-
153-
To compile optional modules (such as Schnorr signatures), you need to run `cmake` with additional flags (such as `-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON`). Run `cmake .. -LH` to see the full list of available flags.
154-
155-
### Cross compiling
156-
157-
To alleviate issues with cross compiling, preconfigured toolchain files are available in the `cmake` directory.
158-
For example, to cross compile for Windows:
159-
160-
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-w64-mingw32.toolchain.cmake
161-
162-
To cross compile for Android with [NDK](https://developer.android.com/ndk/guides/cmake) (using NDK's toolchain file, and assuming the `ANDROID_NDK_ROOT` environment variable has been set):
163-
164-
$ cmake .. -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=28
165-
166-
### Building on Windows
167-
168-
To build on Windows with Visual Studio, a proper [generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators) must be specified for a new build tree.
169-
170-
The following example assumes using of Visual Studio 2022 and CMake v3.21+.
171-
172-
In "Developer Command Prompt for VS 2022":
173-
174-
>cmake -G "Visual Studio 17 2022" -A x64 -S . -B build
175-
>cmake --build build --config RelWithDebInfo
176-
177-
Usage examples
178-
-----------
179-
Usage examples can be found in the [examples](examples) directory. To compile them you need to configure with `--enable-examples`.
180-
* [ECDSA example](examples/ecdsa.c)
181-
* [Schnorr signatures example](examples/schnorr.c)
182-
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
183-
* [ElligatorSwift key exchange example](examples/ellswift.c)
184-
185-
To compile the Schnorr signature and ECDH examples, you also need to configure with `--enable-module-schnorrsig` and `--enable-module-ecdh`.
186-
187-
Benchmark
188-
------------
189-
If configured with `--enable-benchmark` (which is the default), binaries for benchmarking the libsecp256k1 functions will be present in the root directory after the build.
1+
Bitgesell Core integration/staging tree
2+
=====================================
3+
4+
https://bitcoincore.org
5+
6+
For an immediately usable, binary version of the Bitcoin Core software, see
7+
https://bitcoincore.org/en/download/.
8+
9+
What is Bitcoin Core?
10+
---------------------
11+
12+
Bitcoin Core connects to the Bitgesell peer-to-peer network to download and fully
13+
validate blocks and transactions. It also includes a wallet and graphical user
14+
interface, which can be optionally built.
15+
16+
Further information about Bitcoin Core is available in the [doc folder](/doc).
17+
18+
License
19+
-------
20+
21+
Bitcoin Core is released under the terms of the MIT license. See [COPYING](COPYING) for more
22+
information or see https://opensource.org/licenses/MIT.
23+
24+
Development Process
25+
-------------------
26+
27+
The `master` branch is regularly built (see `doc/build-*.md` for instructions) and tested, but it is not guaranteed to be
28+
completely stable. [Tags](https://github.com/BitgesellOfficial/bitgesell/tags) are created
29+
regularly from release branches to indicate new official, stable release versions of Bitcoin Core.
30+
31+
The https://github.com/bitcoin-core/gui repository is used exclusively for the
32+
development of the GUI. Its master branch is identical in all monotree
33+
repositories. Release branches and tags do not exist, so please do not fork
34+
that repository unless it is for development reasons.
35+
36+
The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md)
37+
and useful hints for developers can be found in [doc/developer-notes.md](doc/developer-notes.md).
38+
39+
Testing
40+
-------
41+
42+
Testing and code review is the bottleneck for development; we get more pull
43+
requests than we can review and test on short notice. Please be patient and help out by testing
44+
other people's pull requests, and remember this is a security-critical project where any mistake might cost people
45+
lots of money.
46+
47+
### Automated Testing
48+
49+
Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to
50+
submit new unit tests for old code. Unit tests can be compiled and run
51+
(assuming they weren't disabled during the generation of the build system) with: `ctest`. Further details on running
52+
and extending unit tests can be found in [/src/test/README.md](/src/test/README.md).
53+
54+
There are also [regression and integration tests](/test), written
55+
in Python.
56+
These tests can be run (if the [test dependencies](/test) are installed) with: `test/functional/test_runner.py`
57+
58+
The CI (Continuous Integration) systems make sure that every pull request is built for Windows, Linux, and macOS,
59+
and that unit/sanity tests are run automatically.
19060

19161
Facebook: [Bitgesell](https://www.facebook.com/Bitgesell)
19262

contrib/guix/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ details.
261261

262262
- `guix` build commands as in `guix shell --cores="$JOBS"`
263263
- `make` as in `make --jobs="$JOBS"`
264+
- `cmake` as in `cmake --build build -j "$JOBS"`
264265
- `xargs` as in `xargs -P"$JOBS"`
265266

266267
See [here](#controlling-the-number-of-threads-used-by-guix-build-commands) for

depends/README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@ For example:
1212

1313
make HOST=x86_64-w64-mingw32 -j4
1414

15-
**BGL Core's `configure` script by default will ignore the depends output.** In
15+
**When configuring Bitgesell Core, CMake by default will ignore the depends output.** In
1616
order for it to pick up libraries, tools, and settings from the depends build,
17-
you must set the `CONFIG_SITE` environment variable to point to a `config.site` settings file.
18-
Make sure that `CONFIG_SITE` is an absolute path.
19-
In the above example, a file named `depends/x86_64-w64-mingw32/share/config.site` will be
20-
created. To use it during compilation:
17+
you must specify the toolchain file.
18+
In the above example, a file named `depends/x86_64-w64-mingw32/toolchain.cmake` will be
19+
created. To use it during configuring Bitcoin Core:
2120

22-
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure
23-
24-
The default install prefix when using `config.site` is `--prefix=depends/<host-platform-triplet>`,
25-
so depends build outputs will be installed in that location.
21+
cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake
2622

2723
Common `host-platform-triplet`s for cross compilation are:
2824

@@ -90,9 +86,13 @@ For linux S390X cross compilation:
9086

9187
pkg install bash
9288

89+
### Install the required dependencies: NetBSD
90+
91+
pkgin install bash gmake
92+
9393
### Install the required dependencies: OpenBSD
9494

95-
pkg_add bash gtar
95+
pkg_add bash gmake gtar
9696

9797
### Dependency Options
9898

@@ -125,8 +125,8 @@ The following can be set when running make: `make FOO=bar`
125125
- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.
126126
- `NO_HARDEN=1`: Don't use hardening options when building packages
127127

128-
If some packages are not built, for example `make NO_WALLET=1`, the appropriate
129-
options will be passed to BGL's configure. In this case, `--disable-wallet`.
128+
If some packages are not built, for example `make NO_WALLET=1`, the appropriate CMake cache
129+
variables will be set when generating the Bitgesell Core buildsystem. In this case, `-DENABLE_WALLET=OFF`.
130130

131131
### Additional targets
132132

doc/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The following are developer notes on how to build BGL Core on your native platfo
4141
- [Dependencies](dependencies.md)
4242
- [macOS Build Notes](build-osx.md)
4343
- [Unix Build Notes](build-unix.md)
44-
- [Windows Build Notes](build-windows.md)
44+
- [Windows Build Notes](build-windows-msvc.md)
4545
- [FreeBSD Build Notes](build-freebsd.md)
4646
- [OpenBSD Build Notes](build-openbsd.md)
4747
- [NetBSD Build Notes](build-netbsd.md)

doc/benchmarking.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ thread queue, wallet balance.
88
Running
99
---------------------
1010

11-
For benchmarking, you only need to compile `BGL_bench`. The bench runner
12-
warns if you configure with `--enable-debug`, but consider if building without
11+
For benchmarking, you only need to compile `bench_BGL`. The bench runner
12+
warns if you configure with `-DCMAKE_BUILD_TYPE=Debug`, but consider if building without
1313
it will impact the benchmark(s) you are interested in by unlatching log printers
1414
and lock analysis.
1515

16-
make -C src BGL_bench
16+
cmake -B build -DBUILD_BENCH=ON
17+
cmake --build build -t bench_BGL
1718

1819
After compiling BGL-core, the benchmarks can be run with:
1920

20-
src/bench/bench_BGL
21+
build/src/bench/bench_BGL
2122

2223
The output will look similar to:
2324
```
@@ -39,7 +40,7 @@ The output will look similar to:
3940
Help
4041
---------------------
4142

42-
src/bench/bench_BGL -?
43+
build/src/bench/bench_BGL -?
4344

4445
To print the various options, like listing the benchmarks without running them
4546
or using a regex filter to only run certain benchmarks.

0 commit comments

Comments
 (0)