Zcash Integration Guide

Updated on: 2017-07-21

Related Documents:


Zcash is based on Bitcoin, and has a superset of functionality, both in the protocol and the RPC interface. This document describes Zcash integration into services and products. For help building and testing Zcash, see the User Guide.

Address Types

Zcash transparent addresses, aka T-addrs, are very similar to Bitcoin addresses. Zcash also provides Z-addrs which are used for sending and receiving private funds, with transactions cryptographically protected with Zero-Knowledge proofs. T-addrs all begin with a t… prefix whereas Z-addrs always begin with a z… prefix.

Bitcoin API

The zcash daemon, zcashd, presents the same kind of RPC interface as Bitcoin Core, and this interface (see Bitcoin RPC reference) provides a very similar Bitcoin API calls, which we call the Bitcoin API. Transactions which do not involve Z-addrs (and thus the zeroknowledge privacy layer) can be created with this API just as for Bitcoin.

This API can be used for advanced Bitcoin transactions, just as in Bitcoin Core, such as multisig transactions.

Zcash Payment API

In addition, zcashd adds the Payment API (see Zcash Payment API reference), which is documented in our repository along with each release. This is a high-level API that simplifies the common use cases of transfers. This API can send from or to (some) T-addrs and Z-addrs through the z_sendmany call.

Example of using curl to make a z_sendmany call:

curl –user $USER –data-binary ‘{“jsonrpc”: “1.0”, “id”:”curltest”, “method”: “z_sendmany”, “params”: [“$FROM_ADDR”, [{“address”: “$TO_ADDR” ,”amount”: $AMOUNT}]] }’ -H ‘content-type: text/plain;’

This API does not yet support advanced Bitcoin transaction types, such as multisig.

Integration Path

There are two approaches to integrating a service or product with Zcash: the Bitcoin-compatible approach, and the Zcash API approach. The Bitcoin-compatible approach is convenient for deployments that already use Bitcoin Core, because the API is (almost) identical. Alternatively, if new integrations are being developed, using the Zcash API may be simpler for most use-cases.

Services that use the Zcash API can send to- and receive from- both Z-addrs and T-addrs. One current drawback is that this API does not support multisig transactions. Services that use the Bitcoin-compatibility approach can only send or receive to/from T-addrs. Users can still maintain privacy even in this case, so the primary drawback is one of usability.

A service that supports both Z-addrs and multisig will use the Zcash API for all transactions except multisig, in which case it will use the Bitcoin API.

Designation Features To Support
Level Description Transparent Transactions Transparent Multi-Sig Private Transactions Encrypted Memo
1 Bitcoin-compatible Bitcoin API Bitcoin API
2 Zcash Bitcoin API / Zcash Payment API Bitcoin API Zcash Payment API Zcash Payment API

Bitcoin API (JSON-RPC)

  • Backwards compatible with Bitcoin-Core 0.11.2. Minor modifications to JSON output e.g. vjoinsplit.
  • Recommended for: time to market for existing Bitcoin applications, familiarity with Bitcoin, multi-sig

Zcash Payment API

  • For sending both transparent and private payments. Extends the existing Bitcoin API with new commands.
  • Recommended for: new applications which do not need multisig support, private transactions, encrypted memo field.

Private Transaction Performance

On a quad-core benchmark server, generating a private transaction consumes ~3.2 GB of memory and ~50 seconds of compute time. On a 32-core Amazon EC2 server, compute time is around ~30 seconds.

These figures have changed during development. Graphs of recent performance are available at the Zcash benchmarking site: time benchmark and RAM benchmark.

Contact Us

A low-level JSON-RPC API to support Zcash primitives is expected in Q1 2017. If you currently use the Bitcoin transaction or blockchain formats/protocol directly instead of bitcoind, or if you use a different bitcoin node/library such as Bitcore, please contact our engineering team for technical assistance.