Go to file
Pili Guerra 78529bd009
Updates to README for Beta release (#2967)
* Update zebra beta goals

* Update known issues

* Fix NU5 missing validation

* Update future work

* Add issue numbers to link descriptions for known issues

* Add some more known issues

* Sprout-on-Groth16 came in NU1 (Sapling)

* Add in 'Validation of JoinSplit proofs using BCTV14 verifier' under Sprout, for clarity

* Update current features

* Update future work

* Add link to github releases

* minor formatting typo

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* Apply suggestions from code review

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
2021-10-29 17:43:29 +00:00
.github ZIP-401: weighted random mempool eviction (#2889) 2021-10-27 00:21:19 +00:00
book Update the documentation for value pools (#2919) 2021-10-21 20:30:11 +00:00
docker Use RUSTFLAGS=-O to optimize builds and make regenerating state faster (#2552) 2021-08-03 19:12:24 +00:00
grafana Add user agent metrics (#2957) 2021-10-28 19:23:09 +00:00
tower-batch Manually pin `Sleep` futures (#2914) 2021-10-22 16:06:03 -03:00
tower-fallback V1.0.0 alpha.19 (#2907) 2021-10-21 12:33:35 +02:00
zebra-chain ZIP-401: weighted random mempool eviction (#2889) 2021-10-27 00:21:19 +00:00
zebra-client Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
zebra-consensus Reject a mempool transaction if it has internal spend conflicts (#2843) 2021-10-28 02:49:28 +00:00
zebra-network Reduce outgoing peers demand (#2969) 2021-10-29 16:29:52 +00:00
zebra-rpc Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00
zebra-script V1.0.0 alpha.19 (#2907) 2021-10-21 12:33:35 +02:00
zebra-state Test multiple chain resets (#2897) 2021-10-22 02:54:08 +00:00
zebra-test V1.0.0 alpha.19 (#2907) 2021-10-21 12:33:35 +02:00
zebra-utils V1.0.0 alpha.19 (#2907) 2021-10-21 12:33:35 +02:00
zebrad add `compile_fail` instead of `ignore` for doc test (#2970) 2021-10-29 14:58:04 +00:00
.gitignore switch to source based coverage (#1293) 2020-12-03 13:36:40 -08:00
CHANGELOG.md V1.0.0 alpha.19 (#2907) 2021-10-21 12:33:35 +02:00
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md (#1097) 2021-03-25 10:54:08 +01:00
CONTRIBUTING.md Make the RFC TOC into a separate step (#2126) 2021-05-10 10:17:42 -03:00
Cargo.lock ZIP-401: weighted random mempool eviction (#2889) 2021-10-27 00:21:19 +00:00
Cargo.toml Upgrade to ed25519-zebra 3.0.0 (#2864) 2021-10-12 23:42:44 +00:00
LICENSE-APACHE Add copyright marks on each license 2019-11-14 11:50:49 -08:00
LICENSE-MIT Add copyright marks on each license 2019-11-14 11:50:49 -08:00
README.md Updates to README for Beta release (#2967) 2021-10-29 17:43:29 +00:00
SECURITY.md Explicitly allow unencrypted disclosures for alpha releases (#2127) 2021-05-11 14:41:33 +02:00
clippy.toml Apply clippy fixes 2020-02-05 12:42:32 -08:00
cloudbuild.yaml Pipe SHORT_SHA into container builds (#1451) 2020-12-03 22:51:42 -05:00
codecov.yml Disable CodeCov annotations via GitHub Checks 2020-09-10 14:52:01 -04:00
firebase.json Configure redirect for firebase hosting 2020-01-16 18:38:16 -05:00
katex-header.html Add KaTeX to rendered docs. (#832) 2020-08-05 17:34:30 -07:00
prometheus.yaml Tell Prometheus to scrape more aggressively 2020-02-14 20:14:05 -05:00

README.md

Zebra logotype


codecov License

About

Zebra is the Zcash Foundation's independent, consensus-compatible implementation of the Zcash protocol, currently under development. Please join us on Discord if you'd like to find out more or get involved!

Beta Releases

Every few weeks, we release a new Zebra beta release.

The goals of the beta release series are for Zebra to act as a fully validating Canopy and NU5 node, except for:

  • Mempool transactions
  • Block subsidies
  • Transaction fees
  • Some undocumented rules derived from Bitcoin
  • Some consensus rules removed before Canopy activation (Zebra checkpoints on Canopy activation)

Zebra's network stack is interoperable with zcashd. Zebra implements all the features required to reach Zcash network consensus.

Currently, Zebra does not validate the following Zcash consensus rules:

NU5

  • ZIP-155 - Parse addrv2 in Zebra
  • Full validation of Orchard transactions from NU5 onwards
    • Check that at least one of enableSpendsOrchard or enableOutputsOrchard is set
    • Validation of Orchard anchors
    • Validation of Halo2 proofs
    • Validation of orchard note commitment trees

NU4 - Canopy

  • Calculation of Block Subsidy and Funding streams
  • Validation of coinbase miner subsidy and miner fees
  • Validation of shielded outputs for coinbase transactions (ZIP-212/ZIP-213)

NU1 - Sapling

  • Validation of Sapling anchors
  • Validation of sapling note commitment trees
  • Validation of JoinSplit proofs using Groth16 verifier

NU0 - Overwinter

  • ZIP-203: Transaction Expiry consensus rules

Sprout

  • Validation of Sprout anchors
  • Validation of JoinSplit proofs using BCTV14 verifier
  • Validation of transaction lock times
  • Validation of sprout note commitment trees

It may be unreliable on Testnet, and under less-than-perfect network conditions. See our current features and roadmap for details.

Getting Started

Building zebrad requires Rust, libclang, and a C++ compiler.

Detailed Build and Run Instructions

  1. Install cargo and rustc.
    • Using rustup installs the stable Rust toolchain, which zebrad targets.
  2. Install Zebra's build dependencies:
    • libclang: the libclang, libclang-dev, llvm, or llvm-dev packages, depending on your package manager
    • clang or another C++ compiler: g++, Xcode, or MSVC
  3. Run cargo install --locked --git https://github.com/ZcashFoundation/zebra --tag v1.0.0-alpha.19 zebrad
  4. Run zebrad start

If you're interested in testing out zebrad please feel free, but keep in mind that there is a lot of key functionality still missing.

Build Troubleshooting

If you're having trouble with:

  • dependencies:
    • install both libclang and clang - they are usually different packages
    • use cargo install without --locked to build with the latest versions of each dependency
  • libclang: check out the clang-sys documentation
  • g++ or MSVC++: try using clang or Xcode instead
  • rustc: use rustc 1.48 or later
    • Zebra does not have a minimum supported Rust version (MSRV) policy yet

System Requirements

We usually build zebrad on systems with:

  • 2+ CPU cores
  • 7+ GB RAM
  • 14+ GB of disk space

On many-core machines (like, 32-core) the build is very fast; on 2-core machines it's less fast.

We continuously test that our builds and tests pass on:

  • Windows Server 2019
  • macOS Big Sur 11.0
  • Ubuntu 18.04 / the latest LTS
  • Debian Buster

We usually run zebrad on systems with:

  • 4+ CPU cores
  • 16+ GB RAM
  • 50GB+ available disk space for finalized state
  • 100+ Mbps network connections

zebrad might build and run fine on smaller and slower systems - we haven't tested its exact limits yet.

Network Ports and Data Usage

By default, Zebra uses the following inbound TCP listener ports:

  • 8233 on Mainnet
  • 18233 on Testnet

If Zebra is configured with a specific listen_addr, it will advertise this address to other nodes for inbound connections.

Zebra makes outbound connections to peers on any port. But zcashd prefers peers on the default ports, so that it can't be used for DDoS attacks on other networks.

zebrad's typical network usage is:

  • initial sync: 30 GB download
  • ongoing updates: 10-50 MB upload and download per day, depending on peer requests

The major constraint we've found on zebrad performance is the network weather, especially the ability to make good connections to other Zcash network peers.

Current Features

Network:

  • synchronize the chain from peers
  • maintain a transaction mempool
  • download gossiped blocks and transactions from peers
  • answer inbound peer requests for hashes, headers, blocks and transactions

State:

  • persist block, transaction, UTXO, and nullifier indexes
  • handle chain reorganizations

Proof of Work:

  • validate equihash, block difficulty threshold, and difficulty adjustment
  • validate transaction merkle roots

Validating proof of work increases the cost of creating a consensus split between zebrad and zcashd.

This release also implements some other Zcash consensus rules, to check that Zebra's validation architecture supports future work on a full validating node:

  • block and transaction structure
  • checkpoint-based verification up to and including Canopy activation
  • transaction validation (incomplete)
  • transaction cryptography (incomplete)
  • transaction scripts (incomplete)
  • batch verification (incomplete)

Dependencies

Zebra primarily depends on pure Rust crates, and some Rust/C++ crates:

Known Issues

There are a few bugs in Zebra that we're still working on fixing:

Zebra's state commits changes using database transactions. If you forcibly terminate it, or it panics, any incomplete changes will be rolled back the next time it starts.

Future Work

In 2021, we intend to finish NU5 validation, start adding RPC support and start adding wallet integrations. This phased approach allows us to test Zebra's independent implementation of the consensus rules, before asking users to entrust it with their funds.

Features:

  • full consensus rule validation
  • wallet functionality
  • RPC functionality

Performance and Reliability:

  • reliable syncing on Testnet
  • reliable syncing under poor network conditions
  • batch verification
  • performance tuning

Documentation

The Zebra website contains user documentation, such as how to run or configure Zebra, set up metrics integrations, etc., as well as developer documentation, such as design documents. We also render API documentation for the external API of our crates, as well as internal documentation for private APIs.

Architecture

Unlike zcashd, which originated as a Bitcoin Core fork and inherited its monolithic architecture, Zebra has a modular, library-first design, with the intent that each component can be independently reused outside of the zebrad full node. For instance, the zebra-network crate containing the network stack can also be used to implement anonymous transaction relay, network crawlers, or other functionality, without requiring a full node.

At a high level, the fullnode functionality required by zebrad is factored into several components:

  • zebra-chain, providing definitions of core data structures for Zcash, such as blocks, transactions, addresses, etc., and related functionality. It also contains the implementation of the consensus-critical serialization formats used in Zcash. The data structures in zebra-chain are defined to enforce structural validity by making invalid states unrepresentable. For instance, the Transaction enum has variants for each transaction version, and it's impossible to construct a transaction with, e.g., spend or output descriptions but no binding signature, or, e.g., a version 2 (Sprout) transaction with Sapling proofs. Currently, zebra-chain is oriented towards verifying transactions, but will be extended to support creating them in the future.

  • zebra-network, providing an asynchronous, multithreaded implementation of the Zcash network protocol inherited from Bitcoin. In contrast to zcashd, each peer connection has a separate state machine, and the crate translates the external network protocol into a stateless, request/response-oriented protocol for internal use. The crate provides two interfaces:

    • an auto-managed connection pool that load-balances local node requests over available peers, and sends peer requests to a local inbound service, and
    • a connect_isolated method that produces a peer connection completely isolated from all other node state. This can be used, for instance, to safely relay data over Tor, without revealing distinguishing information.
  • zebra-script provides script validation. Currently, this is implemented by linking to the C++ script verification code from zcashd, but in the future we may implement a pure-Rust script implementation.

  • zebra-consensus performs semantic validation of blocks and transactions: all consensus rules that can be checked independently of the chain state, such as verification of signatures, proofs, and scripts. Internally, the library uses tower-batch to perform automatic, transparent batch processing of contemporaneous verification requests.

  • zebra-state is responsible for storing, updating, and querying the chain state. The state service is responsible for contextual verification: all consensus rules that check whether a new block is a valid extension of an existing chain, such as updating the nullifier set or checking that transaction inputs remain unspent.

  • zebrad contains the full node, which connects these components together and implements logic to handle inbound requests from peers and the chain sync process.

  • zebra-rpc and zebra-client will eventually contain the RPC and wallet functionality, but as mentioned above, our goal is to implement replication of chain state first before asking users to entrust Zebra with their funds.

All of these components can be reused as independent libraries, and all communication between stateful components is handled internally by internal asynchronous RPC abstraction ("microservices in one process").

Security

Zebra has a responsible disclosure policy, which we encourage security researchers to follow.

License

Zebra is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT.