Skip to content

Implementation of a zcash sidechain using the drivechain library.

License

Notifications You must be signed in to change notification settings

torkelrogstad/zcash-sidechain

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build from Source (Sidechain Version)

Non-Nix (Ubuntu)

First, install the Zcash build dependencies. These can be found on the official Zcash docs. Only install the dependencies listed in the apt-get block, and skip the rest of the instructions.

Once you have installed the build dependencies:

# build all dependencies
$ make -C ./depends/

$ ./autogen.sh
$ HOST=$(./depends/config.guess)

# Use the previously compiled dependencies instead of system libraries
$ export CONFIG_SITE="$PWD/depends/$HOST/share/config.site"  

# Configure the build
$ ./configure --disable-tests --disable-bench --disable-hardening --enable-online-rust

# Build the Rust C++ bindings + bridge
$ make -C src cargo-build-lib

# Find the location of the newly compiled Rust C++ bridge library
$ BRIDGE_LOCATION=$(dirname $(./contrib/devtools/find-libcxxbridge.sh))

# Instruct the linker to include the Rust C++ bridge library
$ export LDFLAGS="-L$BRIDGE_LOCATION -lcxxbridge1" 

# Reconfigure the build, taking our freshly compiled Rust C++ bridge into account.
$ ./configure --disable-tests --disable-bench --disable-hardening --enable-online-rust

# Run the actual build
$ make -j # omit the -j if running into memory issues

The observant reader will note that this requires a bit of back and forth, which might seem odd. Two calls to ./configure, what's this??

The issue boils down to the following:

  1. We're building a C++ library based on generated C++ code from Rust sources (in the make -C src cargo-build-lib step)
  2. This needs to have the same C++ toolchain configuration as the rest of the build
  3. The output of this (libcxxbridge1.a) must be included in the linker flags (LDFLAGS) for the build to succeed
  4. However, the Rust libraries have to be in place before we invoke ./configure... This leads to an awkward chicken-or-egg situation.
  5. The solution (it might be a strange one, perhaps there's better options) is to run ./configure twice, and doing the Rust build step in-between.

macOS

Building on macOS is not as well supported as on Linux. The upstream Zcash repo doesn't fully support macOS, and our support is monkey-patched in by a guy who doesn't fully know what he's doing.

Building upstream Zcash is not supported at all on ARM chips. However, macOS has very good support for running x86_64 binaries, through Rosetta. We therefore build for x86_64 chips, and use these binaries to run on both newer and older machine.

Install build dependencies:

$ brew install git pkgconfig automake autoconf libtool coreutils

The rest of the instructions are the same as for building for Linux, except that two environment variables need to be set:

export BUILD=x86_64-apple-darwin23.0.0
export HOST=$BUILD

These variables have been attempted to be set through the build system instead, without success. If someone more skilled at the build system than the previous author strolls along, please take a look.

Nix - currently not working

To install all dependencies and build zcash-sidechain on ubuntu (22.04) run:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git curl
# install nix package manager
sh <(curl -L https://nixos.org/nix/install) --daemon
# now follow the instructions and then close and open the terminal (to get nix initialized)
git clone git@github.com:nchashch/zcash-sidechain.git
cd zcash-sidechain
nix-shell # this will install all build tools and dependencies
./autogen.sh
./configure $configureFlags
make -j8 # or number of cores you want to use

Regtest Demo Script

A script for: activating this sidechain (on drivechain), mining blocks, depositing and withdrawing coins, generating t/z addresses and using them, is available here.


Zcash 5.0.0

What is Zcash?

Zcash is an implementation of the "Zerocash" protocol. Based on Bitcoin's code, Zcash intends to offer a far higher standard of privacy through a sophisticated zero-knowledge proving scheme that preserves confidentiality of transaction metadata. More technical details are available in our Protocol Specification.

This software is the Zcash client. It downloads and stores the entire history of Zcash transactions; depending on the speed of your computer and network connection, the synchronization process could take a day or more once the blockchain has reached a significant size.

🔒 Security Warnings

See important security warnings on the Security Information page.

Zcash is experimental and a work in progress. Use it at your own risk.

📒 Deprecation Policy

This release is considered deprecated 16 weeks after the release day. There is an automatic deprecation shutdown feature which will halt the node some time after this 16-week period. The automatic feature is based on block height.

Need Help?

  • 📘 See the documentation at the ReadTheDocs for help and more information.
  • 📨 Ask for help on the Zcash forum.
  • 💬 Join our community on Discord

Participation in the Zcash project is subject to a Code of Conduct.

License

For license information see the file COPYING.

About

Implementation of a zcash sidechain using the drivechain library.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 68.1%
  • Python 11.5%
  • C 11.2%
  • Rust 3.4%
  • Shell 2.1%
  • M4 1.7%
  • Other 2.0%