5.2 API

Languages
  • Spanish/Español

5.2 API


Zen is based on ZCash and Bitcoin, and has a superset of functionality, both in the protocol and the RPC interface.

Address Types

Zen supports two different kinds of addresses, a z-addr (which generally begins with zc and is 94 characters long) is an address that uses zero-knowledge proofs and other cryptography to protect user privacy. There are also t-addrs (which generally begin with zn (zs for multi-sig addresses) and are usually 35 characters long, but can be as few as 32 characters) that are similar to Bitcoin's addresses.

Bitcoin API

The Zen daemon, zend, presents the same kind of RPC interface as Bitcoin Core, and this interface (see Bitcoin RPC reference) provides very similar Bitcoin API calls, which we call the Bitcoin API. Transactions which do not involve Z-addresses (and thus the Zero-Knowledge 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.


Zen extends the Bitcoin compatible API with the following additional RPC commands:

./src/zen-cli listaddresses

This is simply an alias to:

./src/zen-cli getaddressesbyaccount ""

Zen Payment API

In addition, Zen adds the Payment API (see Zen 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;' http://127.0.0.1:8231/

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




© 2020 Horizen. All rights reserved.