Code for zChain and build instructions can be found at https://github.com/zer0-os/zChain. Agent-centric data in Zero is stored in a local encrypted and append-only log called a zChain. zChain is designed to serve as an abstraction layer for multiple web3 protocols, including but not limited to Hypercore, Ethereum, and IPFS.
zChain is complementary to blockchain protocols and can be thought of as a 'multi-blockchain', or ‘meta-chain’, that aggregates identities, authentication keys, and chain data that originates outside of zOS. This enables Members to integrate third-party services, chains and dApps into a single location while maintaining data integrity, security and decentralization.
A zChain is a chain of Messages. Each Message contains a hash as a reference to the prior Message in the chain, that can be used to reconstruct the chain back to the initial Message. Each zChain maintains a unique public key for identification (zId) and holds a private key for Message signatures. zChains utilize the append-only log from the Hypercore library.
zChain Message Structure
zChains are verified through a Merkle tree that utilizes the BLAKE2b-256 hash function. This append-only structure enables Nodes to only download relevant portions of other Node zChains to their local machine, while cryptographically proving that the chain has not been tampered with.
Asymmetric cryptography is used to sign the root of a merkle tree when Messages are added to a zChain. Unlike typical append-only logs and blockchains, the introduction of asymmetric cryptography enables historical Messages to remain verifiable and be modified in the future by the owner of the private key. This is particularly useful for typical web applications where historical content editing is often required.
zChain is designed to serve as a complement and extension to existing Blockchain systems, such as Ethereum, Cardano or Polkadot. zChain can be thought of as a local blockchain that runs on a Member’s device that is agent-centric, compared to existing blockchains where data is object-centric. Together, these two design patterns elegantly support the handling of local data, such as private messages and feed posts, and global data, such as namespaces and financial transactions, respectively.
The following diagram illustrates the relationship of between multiple zChains and a Blockchain:
zChain and Blockchain