Skip to content

Commit

Permalink
Add the batch of release v3.4.0 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-at-bcn committed Feb 7, 2019
1 parent f99781a commit 07b8bf2
Show file tree
Hide file tree
Showing 74 changed files with 6,128 additions and 3,207 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ file(GLOB SRC_COMMON src/common/*.cpp src/common/*.hpp)
file(GLOB SRC_SERIA src/seria/*.cpp src/seria/*.hpp)
file(GLOB SRC_LOGGING src/logging/*.cpp src/logging/*.hpp)
file(GLOB SRC_P2P src/p2p/*.cpp src/p2p/*.hpp)
file(GLOB SRC_CORE src/Core/*.cpp src/Core/*.hpp src/CryptoNote.hpp src/CryptoNote.cpp src/rpc_api.hpp src/rpc_api.cpp)
file(GLOB SRC_CORE src/Core/*.cpp src/Core/*.hpp src/Core/hw/*.cpp src/Core/hw/*.hpp src/CryptoNote.hpp src/CryptoNote.cpp src/rpc_api.hpp src/rpc_api.cpp)
file(GLOB SRC_HTTP src/http/*.cpp src/http/*.hpp)
file(GLOB SRC_PLATFORM
src/platform/ExclusiveLock.cpp src/platform/ExclusiveLock.hpp
Expand Down Expand Up @@ -147,7 +147,7 @@ add_executable(tests src/main_tests.cpp tests/io.hpp tests/Random.hpp
tests/hash/test_hash.cpp tests/hash/test_hash.hpp
tests/json/test_json.cpp tests/json/test_json.hpp
tests/wallet_state/test_wallet_state.cpp tests/wallet_state/test_wallet_state.hpp
tests/wallet_file/test_wallet_file.cpp tests/wallet_file/test_wallet_file.hpp)
tests/wallet_file/test_wallet_file.cpp tests/wallet_file/test_wallet_file.hpp tests/crypto/benchmarks.cpp tests/crypto/benchmarks.hpp)
set(Boost_USE_STATIC_LIBS ON)
add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS=1 -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE=1) # boost::_1 conflicts with std::_1
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY=1 -DBOOST_SYSTEM_NO_DEPRECATED=1) # required for header-only compilation
Expand Down Expand Up @@ -179,3 +179,4 @@ if(NOT WIN32)
target_link_libraries(${CRYPTONOTE_NAME}d ${LINK_OPENSSL} dl pthread)
target_link_libraries(tests ${LINK_OPENSSL} dl pthread)
endif()

159 changes: 71 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Contents

## Building on Linux 64-bit

All commands below are adapted for Ubuntu, other distributions may need an other command set.
All commands below work on Ubuntu 18.*, other distributions may need different command set.

### Building with standard options

Expand All @@ -29,24 +29,27 @@ To go futher you have to have a number of packages and utilities. You need at le
$bcndev> sudo apt-get install build-essential
```

* CMake (3.5 or newer):
* CMake (3.0 or newer):
```
$bcndev> sudo apt-get install cmake
$bcndev> cmake --version
```
If version is too old, follow instructions on [the official site](https://cmake.org/download/).

* Boost (1.62 or newer):
You need boost in `bcndev` folder. We do not configure to use boost installed by `apt-get`, because it is sometimes updated without your control by installing some unrelated packages. Also some users reported crashes after `find_package` finds headers from one version of boost and libraries from different version, or if installed boost uses dynamic linking.
* Boost (1.65 or newer):
We use boost as a header-only library via find_boost package. So, if your system has boost installed and set up, it will be used automatically.

Note - there is a bug in `boost::asio` 1.66 that affects `bytecoind`. Please use either version 1.65 or 1.67+.
```
$bcndev> wget -c 'http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.bz2/download'
$bcndev> tar xf download
$bcndev> rm download
$bcndev> mv boost_1_67_0 boost
$bcndev> cd boost
$bcndev/boost> ./bootstrap.sh
$bcndev/boost> ./b2 link=static -j 8 --build-dir=build64 --stagedir=stage
cd ..
$bcndev> sudo apt-get install libboost-dev
```
If the latest boost installed is too old (e.g. for Ubuntu 16.*), then you need to download and unpack boost into the `bcndev/boost` folder.

```
$bcndev> wget -c 'https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz'
$bcndev> tar -xzf ./boost_1_69_0.tar.gz
$bcndev> rm ./boost_1_69_0.tar.gz
$bcndev> mv ./boost_1_69_0/ ./boost/
```

* OpenSSL (1.1.1 or newer):
Expand All @@ -55,46 +58,45 @@ To go futher you have to have a number of packages and utilities. You need at le
$bcndev> git clone https://github.com/openssl/openssl.git
$bcndev> cd openssl
$bcndev/openssl> ./Configure linux-x86_64 no-shared
$bcndev/openssl> time make -j4
$bcndev/openssl> make -j4
$bcndev/openssl> cd ..
```

* SQLite (3.1 or newer)
Download amalgamated [SQLite 3](https://www.sqlite.org/download.html) and unpack it into `bcndev/sqlite` folder (source files are referenced via relative paths, so you do not need to separately build it).
Please, note the direct download link is periodically updated with old versions removed, so you might need to tweak instructions below
```
$bcndev> wget -c https://www.sqlite.org/2018/sqlite-amalgamation-3260000.zip
$bcndev> unzip ./sqlite-amalgamation-3260000.zip
$bcndev> rm ./sqlite-amalgamation-3260000.zip
$bcndev> mv ./sqlite-amalgamation-3260000/ ./sqlite/
```

* LMDB
Source files are referenced via relative paths, so you do not need to separately build it:
Please note, we use LMDB only when building 64-bit daemons. For 32-bit daemons SQLite is used instead.
```
$bcndev> git clone https://github.com/bcndev/lmdb.git
```

Git-clone (or git-pull) Bytecoin source code in that folder:
```
$bcndev> git clone https://github.com/bcndev/bytecoin.git
```

Put LMDB source code in `bcndev` folder (source files are referenced via relative paths, so you do not need to separately build it):
```
$bcndev> git clone https://github.com/LMDB/lmdb.git
```

Create build directory inside bytecoin, go there and run CMake and Make:
```
$bcndev> mkdir bytecoin/build
$bcndev> mkdir -p bytecoin/build
$bcndev> cd bytecoin/build
$bcndev/bytecoin/build> cmake ..
$bcndev/bytecoin/build> time make -j4
$bcndev/bytecoin/build> make -j4
```

Check built binaries by running them from `../bin` folder
```
$bcndev/bytecoin/build> ../bin/bytecoind -v
```

### Building with specific options

Download amalgamated [SQLite 3](https://www.sqlite.org/download.html) and unpack it into `bcndev/sqlite` folder (source files are referenced via relative paths, so you do not need to separately build it).

Below are the commands which remove OpenSSL support and switch from LMDB to SQLite by providing options to CMake:

```
$bcndev> mkdir bytecoin/build
$bcndev> cd bytecoin/build
$bcndev/bytecoin/build> cmake -DUSE_SSL=0 -DUSE_SQLITE=1 ..
$bcndev/bytecoin/build> time make -j4
```

## Building on Mac OSX

### Building with standard options (10.11 El Capitan or newer)
Expand All @@ -119,37 +121,7 @@ $bcndev> git clone https://github.com/bcndev/bytecoin.git

Put LMDB source code in `bcndev` folder (source files are referenced via relative paths, so you do not need to separately build it):
```
$bcndev> git clone https://github.com/LMDB/lmdb.git
```

Create build directory inside bytecoin, go there and run CMake and Make:
```
$bcndev> mkdir bytecoin/build
$bcndev> cd bytecoin/build
$bcndev/bytecoin/build> cmake -DUSE_SSL=0 ..
$bcndev/bytecoin/build> time make -j4
```

Check built binaries by running them from `../bin` folder:
```
$bcndev/bytecoin/build> ../bin/bytecoind -v
```

### Building with specific options

Binaries linked with Boost installed by Homebrew will work only on your computer's OS X version or newer, but not on older versions like El Capitan.

If you need binaries to run on all versions of OS X starting from El Capitan, you need to build boost yourself targeting El Capitan SDK.

Download [Mac OSX 10.11 SDK](https://github.com/phracker/MacOSX-SDKs/releases) and unpack to it into `Downloads` folder

Download and unpack [Boost](https://boost.org) to `Downloads` folder.

Then build and install Boost:
```
$~> cd ~/Downloads/boost_1_67_0/
$~/Downloads/boost_1_67_0> ./bootstrap.sh
$~/Downloads/boost_1_67_0> ./b2 -a -j 4 cxxflags="-stdlib=libc++ -std=c++14 -mmacosx-version-min=10.11 -isysroot/Users/user/Downloads/MacOSX10.11.sdk" install`
$~/Downloads/bcndev> git clone https://github.com/bcndev/lmdb.git
```

Install OpenSSL to `bcndev/openssl` folder:
Expand All @@ -160,27 +132,38 @@ $~/Downloads/bcndev> cd openssl

If you need binaries to run on all versions of OS X starting from El Capitan, you need to build OpenSSL targeting El Capitan SDK.
```
$bcndev/openssl> ./Configure darwin64-x86_64-cc no-shared -mmacosx-version-min=10.11 -isysroot/Users/user/Downloads/MacOSX10.11.sdk
$~/Downloads/bcndev/openssl> ./Configure darwin64-x86_64-cc no-shared -mmacosx-version-min=10.11 -isysroot/Users/user/Downloads/MacOSX10.11.sdk
```
Otherwise just use
```
$bcndev/openssl> ./Configure darwin64-x86_64-cc no-shared
$~/Downloads/bcndev/openssl> ./Configure darwin64-x86_64-cc no-shared
```

```
$bcndev/openssl> time make -j4
$bcndev/openssl> cd ..
$~/Downloads/bcndev/openssl> make -j4
$~/Downloads/bcndev/openssl> cd ..
```

Download amalgamated [SQLite 3](https://www.sqlite.org/download.html) and unpack it into `bcndev/sqlite` folder (source files are referenced via relative paths, so you do not need to separately build it).
Please, note the direct download link is periodically updated with old versions removed, so you might need to tweak instructions below
```
$~/Downloads/bcndev> wget -c https://www.sqlite.org/2018/sqlite-amalgamation-3260000.zip
$~/Downloads/bcndev> unzip sqlite-amalgamation-3260000.zip
$~/Downloads/bcndev> rm sqlite-amalgamation-3260000.zip
$~/Downloads/bcndev> mv sqlite-amalgamation-3260000 sqlite
```

You add OpenSSL support or switch from LMDB to SQLite by providing options to CMake:
Create build directory inside bytecoin, go there and run CMake and Make:
```
$~/Downloads/bcndev> mkdir bytecoin/build
$~/Downloads/bcndev> cd bytecoin/build
$~/Downloads/bcndev/bytecoin/build> cmake ..
$~/Downloads/bcndev/bytecoin/build> make -j4
```

Check built binaries by running them from `../bin` folder:
```
$bcndev> mkdir bytecoin/build
$bcndev> cd bytecoin/build
$bcndev/bytecoin/build> cmake -DUSE_SSL=1 -DUSE_SQLITE=1 ..
$bcndev/bytecoin/build> time make -j4
$bcndev/bytecoin/build> ../bin/bytecoind -v
```

## Building on Windows
Expand All @@ -194,16 +177,8 @@ $C:\> mkdir bcndev
$C:\> cd bcndev
```

Get [Boost](https://boost.org) and unpack it into a folder inside `bcndev` and rename it from `boost_1_66_0` or similar to just `boost`.

Build boost (build 32-bit boost version only if you need 32-bit bytecoin binaries).
```
$> cd boost
$C:\bcndev\boost> bootstrap.bat
$C:\bcndev\boost> b2.exe address-model=64 link=static -j 8 --build-dir=build64 --stagedir=stage
$C:\bcndev\boost> b2.exe address-model=32 link=static -j 8 --build-dir=build32 --stagedir=stage32
cd ..
```
Boost (1.65 or newer):
We use boost as a header-only library via find_boost package. So, if your system has boost installed and set up, it will be used automatically. If not, you need to download and unpack boost into bcndev/boost folder.

Git-clone (or git-pull) Bytecoin source code in that folder:
```
Expand All @@ -212,9 +187,11 @@ $C:\bcndev> git clone https://github.com/bcndev/bytecoin.git

Put LMDB in the same folder (source files are referenced via relative paths, so you do not need to separately build it):
```
$C:\bcndev> git clone https://github.com/LMDB/lmdb.git
$C:\bcndev> git clone https://github.com/bcndev/lmdb.git
```

Download amalgamated [SQLite 3](https://www.sqlite.org/download.html) and unpack it into the same folder (source files are referenced via relative paths, so you do not need to separately build it).

You need to build openssl, first install ActivePerl (select "add to PATH" option, then restart console):
```
$C:\bcndev> git clone https://github.com/openssl/openssl.git
Expand All @@ -236,21 +213,27 @@ Now launch Visual Studio, in File menu select `Open Folder`, select `C:\bcndev\b
Wait until CMake finishes running and `Build` appears in main menu.
Select `x64-Debug` or `x64-Release` from standard toolbar, and then `Build/Build Solution` from the main menu.

You cannot add options to CMake running inside Visual Studio so just edit `CMakeLists.txt` and set `USE_SSL` or `USE_SQLITE` to `ON` if you wish to build with them.
## Building with options

You can build daemons that use SQLite istead of LMDB on any platform by providing options to CMake.
You may need to clean 'build' folder, if you built with default options before, due to cmake aggressive caching.

```
$bytecoin/build> cmake -DUSE_SQLITE=1 ..
$bytecoin/build> time make -j8
```

## Building on 32-bit x86 platforms, iOS, Android and other ARM platforms

Bytecoin works on 32-bit systems if SQLite is used instead of LMDB (we've experienced lots of problems building and running with lmdb in 32-bit compatibility mode, especially on iOS).

Therefore SQLite option is automatically selected by CMake on 32-bit platforms and you must have SQLite downloaded as explained in appropriate sections above.

We build official x86 32-bit version for Windows only, because there is zero demand for 32-bit version for Linux or Mac.

Building source code for iOS, Android, Raspberry PI, etc is possible (we have experimental `bytecoind` and `walletd` running on ARM64 iPhone) but requires major skills on your part. __TBD__

## Building on Big-Endian platforms

Currently it is impossible to run Bytecoin on any Big-Endian platform, due to lots of endianess-dependent code. This may be fixed in the future. If you wish to run on Big-Endian platform, please contact us.
Currently bytecoin does not work out of the box on any Big-Endian platform, due to some endianess-dependent code. This may be fixed in the future. If you wish to run on Big-Endian platform, please contact us.

## Building with parameters

Expand Down
34 changes: 33 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
## Release Notes

### v3.4.0 (Amethyst)

- Sendproofs are now in base58 format, which eases copying and sharing.
- New addresses now start from `bcnZ` prefix.

*Command line changes/additions*

- New walletd command-line parameter `--wallet-type` to create legacy wallets (`--create-wallet` by default creates new HD wallet).

*API removal*

- Removed `amethyst_only` flag in the `get_random_outputs` bytecoind method.


### v3.4.0-beta-20190123

*Strong support for audit-compatible wallets*

- All new unlinkable addresses are now auditable, so separate auditable address type removed from system.
- View-only HD wallet is now guaranteed to have the same balance as original wallet. So owner of HD wallet cannot spend any funds in a way that view-only version of the same wallet does not see the fact.
- If view-only HD wallet was exported with --view-outgoing-addresses, it can also see all destination addresses in transactions that spend funds. If spender is sending to some address, he cannot make auditor see different destination address for this transaction. If spender is using sophisticated "out-of-blockchain shared secret" fraud, auditor will see random address, and spender will not be able to provide valid sendproof for this transaction.

*Consensus update (hard fork)*
- New crypto for legacy addresses (unlinkable-inspired), which prevents "burning bug" attacks on crypto level. This is important because such attacks cannot be reliably fixed on operational level.

*API additions*
- `amethyst_only` flag in `get_random_outputs` bytecoind method.

*Incompatible API changes (likely to affect only developers of block explorers)*

- In all raw block objects `output_indexes` renamed to `stack_indexes`.

### v3.4.0-beta-20181218

- Signatures are now fully prunable (but not yet pruned) via modification to transaction hash calculations.
Expand All @@ -19,7 +51,7 @@
- New auditable addresses, guaranteed to always have balance exactly equal to what view-only version of the same wallet shows (useful for public deposits).
- Signatures are now half size.
- The requirement that coinbase transactions are locked for 10 blocks is removed from consensus.
- Creating dust (or other not round output amounts) are now prohibited by consensus rules.
- Creating 6-digit dust (or other not round output amounts) are now prohibited by consensus rules.
- Minimum anonymity is now 3 (4 output references per input). This does not apply to dust or not round outputs.
- `bytecoind` now calculates output obfuscation value, and does not use less-than-ideal outputs for mix-in

Expand Down
2 changes: 1 addition & 1 deletion src/Core/BlockChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using namespace cn;
using namespace platform;

const std::string BlockChain::version_current = "6";
const std::string BlockChain::version_current = "8";
// We increment when making incompatible changes to indices.

// We use suffixes so all keys related to the same block are close to each other in DB
Expand Down
6 changes: 4 additions & 2 deletions src/Core/BlockChainFileFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@ void LegacyBlockChainWriter::write_block(const RawBlock &raw_block) {
m_indexes_file.write(&si, sizeof si);
}

bool LegacyBlockChainWriter::export_blockchain2(
const std::string &index_file_name, const std::string &item_file_name, const BlockChainState &block_chain) {
bool LegacyBlockChainWriter::export_blockchain2(const std::string &index_file_name, const std::string &item_file_name,
const BlockChainState &block_chain, Height max_height) {
auto idea_start = std::chrono::high_resolution_clock::now();
std::cout << "Start exporting blocks" << std::endl;
LegacyBlockChainWriter writer(index_file_name, item_file_name, block_chain.get_tip_height() + 1);
for (Height ha = 0; ha != block_chain.get_tip_height() + 1; ++ha) {
if (ha >= max_height)
break;
Hash bid{};
BinaryArray block_data;
RawBlock raw_block;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/BlockChainFileFormat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class LegacyBlockChainWriter {
LegacyBlockChainWriter(const std::string &index_file_name, const std::string &item_file_name, uint64_t count);
void write_block(const RawBlock &raw_block);

static bool export_blockchain2(
const std::string &index_file_name, const std::string &item_file_name, const BlockChainState &block_chain);
static bool export_blockchain2(const std::string &index_file_name, const std::string &item_file_name,
const BlockChainState &block_chain, Height max_height = std::numeric_limits<Height>::max());
};

} // namespace cn
Loading

0 comments on commit 07b8bf2

Please sign in to comment.