Skip to content

hacash/fullnode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

307 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fullnode

Hacash Fullnode Software and SDK

Build

Ubuntu:

sudo apt update
sudo apt install build-essential cmake musl-tools 

#s udo apt install -y openssl libssl-dev libudev-dev cmake llvm clang musl-tools build-essential
# sudo ln -s /usr/bin/g++ /usr/bin/musl-g++
 
# rustup target add x86_64-pc-windows-gnu
# --features "db-sled"    --features "db-rusty-leveldb"    --features "db-leveldb-sys"
cargo build --target x86_64-unknown-linux-musl --no-default-features --features "db-sled"

# db features default: db-rusty-leveldb
--no-default-features --features "db-sled"               # rust
--no-default-features --features "db-rusty-leveldb"      # rust
--no-default-features --features "db-leveldb-sys"        # c++
--no-default-features --features "db-rocksdb"            # c++

# or
RUSTFLAGS="-C target-feature=-crt-static" RUST_BACKTRACE="full" cargo build --release --no-default-features --features "db-leveldb-sys"
cp target/release/fullnode   ./hacash_fullnode_ubuntu
cp target/release/poworker   ./hacash_poworker_ubuntu
cp target/release/diaworker ./hacash_diaworker_ubuntu


# or static linked
# edit chain/Cargo.toml and protocol/Cargo.toml, change features from "db-leveldb-sys" to "db-sled" or "db-rusty-leveldb"
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="-C target-feature=+crt-static" RUST_BACKTRACE="full" cargo build --release --target=x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/fullnode   ./hacash_fullnode_ubuntu_16.04
cp target/x86_64-unknown-linux-musl/release/poworker   ./hacash_poworker_ubuntu_16.04
cp target/x86_64-unknown-linux-musl/release/diaworker ./hacash_diaworker_ubuntu_16.04

# or for db-sled
RUSTFLAGS="-C target-feature=+crt-static" RUST_BACKTRACE="full" cargo build --bin fullnode --release --target=x86_64-unknown-linux-musl --no-default-features --features "db-sled"
cp target/x86_64-unknown-linux-musl/release/fullnode   ./hacash_fullnode_ubuntu_dbsled


# cross build for windows
sudo apt install mingw-w64
rustup target add x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-pc-windows-gnu
RUSTFLAGS="-C target-feature=+crt-static" RUST_BACKTRACE="full" cargo build --release --target x86_64-pc-windows-gnu
cp target/x86_64-pc-windows-gnu/release/fullnode.exe   ./hacash_fullnode_windows.exe
cp target/x86_64-pc-windows-gnu/release/poworker.exe   ./hacash_poworker_windows.exe
cp target/x86_64-pc-windows-gnu/release/diaworker.exe ./hacash_diaworker_windows.exe



# cross build for macos
# https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html/
sudo apt install clang gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev openssl libssl-dev
# install build osxcross
git clone https://github.com/tpoechtrager/osxcross
cd osxcross
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz
mv MacOSX10.10.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.6 ./build.sh
# build
rustup target add x86_64-apple-darwin
rustup toolchain install stable-x86_64-apple-darwin
./build_macos.sh

Windows:

## gnu
# download and install: https://cmake.org/download/
# download and install: https://www.msys2.org/
pacman -Sy && pacman -Syu
pacman -S mingw-w64-x86_64-toolchain

rustup target add x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-pc-windows-gnu
set RUSTFLAGS='-C target-feature=+crt-static'; set RUST_BACKTRACE='full'; cargo build --release --target x86_64-pc-windows-gnu;
cp target/x86_64-pc-windows-gnu/release/fullnode.exe   ./hacash_fullnode_windows.exe
cp target/x86_64-pc-windows-gnu/release/poworker.exe   ./hacash_poworker_windows.exe
cp target/x86_64-pc-windows-gnu/release/diaworker.exe ./hacash_diaworker_windows.exe

## or msvc
rustup target add x86_64-pc-windows-msvc
rustup toolchain install stable-x86_64-pc-windows-msvc
set RUSTFLAGS='-C target-feature=+crt-static'; set RUST_BACKTRACE='full'; cargo build --release --target x86_64-pc-windows-msvc --no-default-features --features "db-leveldb-sys";
cp target/x86_64-pc-windows-msvc/release/fullnode.exe   ./hacash_fullnode_windows.exe
cp target/x86_64-pc-windows-msvc/release/poworker.exe   ./hacash_poworker_windows.exe
cp target/x86_64-pc-windows-msvc/release/diaworker.exe ./hacash_diaworker_windows.exe

# dumpbin /dependents  ./hacash_fullnode_windows.exe

MacOS:

               
RUSTFLAGS='-C target-feature=+crt-static' RUST_BACKTRACE='full' cargo build --release --target x86_64-apple-darwin
cp target/x86_64-apple-darwin/release/fullnode   ./hacash_fullnode_macos 
cp target/x86_64-apple-darwin/release/poworker   ./hacash_poworker_macos
cp target/x86_64-apple-darwin/release/diaworker ./hacash_diaworker_macos


Run fullnode for dev

cp ./hacash.config.ini ./target/debug/   && RUST_BACKTRACE=1 cargo run
cp ./hacash.config.ini ./target/release/ && RUST_BACKTRACE=1 cargo run --release
## vm test
cp ./hacash.config.ini ./target/release/   && RUST_BACKTRACE=1 cargo run --release --no-default-features --features "db-leveldb-sys hvm"

start flow:

  1. protocol::action::hook extend action
  2. protocol::block::hook block hasher
  3. create mem kv db / disk kv db
  4. create mint checker
  5. create block scaner
  6. create chain engine
  7. create memory tx pool
  8. create p2p node
  9. do start

interface:

  1. block hasher
  2. kv disk database
  3. action adaptation
  4. chain engine
  5. minter
  6. scaner

About

Hacash Fullnode Software and SDK

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages