Mainstay is a protocol that enables the creation of a cryptographic proof that a given system with changing state is unique and that the full history of that state is unique. This proof is generated from a series of cryptographic commitments made to a public blockchain which in turn derives its immutability and global state from a Proof-of-Work consensus algorithm. In this way, any independent system with history of state (for example a federated blockchain/sidechain or a Git repository) can be proven to be as immutable as the Proof-of-Work blockchain it is secured by. The proof of immutability (PoI) generated by the Mainstay protocol is trustless and independently verifiable.

The underlying construction of the Mainstay protocol requires no changes to the existing proof-of-work system (i.e. Bitcoin) and requires no cooperation of miners (unlike merge mining protocols). It is specifically designed to be space-efficient and censorship resistant due to the use of homomorphic commitments based on the pay-to-contract method (BIP175), and is compatible with Simplified Payment Verification (SPV) lightweight nodes. The Mainstay Connector protocol enables many separate systems to obtain independent proofs of immutability via a single sequence of Bitcoin commitments, by compressing sequences of commitments in a Merkel tree of slot-proofs. This enables the minimisation of burden on to the Bitcoin blockchain, and thousands of sidechains can be secured with just a single Bitcoin transaction per block. This enables the realisation of highly efficient, scalable and interoperable sidechain systems that can incorporate permissioned transacting and regulatory compliance while simultaneously exploiting the full security and immutability of the Bitcoin blockchain secured via proof-of-work.

This documentation describes the theory and implementation of the Mainstay protocol, as well as an explanation of the background, motivation and how the protocol differs from trustless timestamping (i.e. Proof of Existence - PoE). This documentation also includes detailed instructions on using CommerceBlock’s Mainstay implementation and tooling, CommerceBlock’s Mainstay service and API as well as step-by-step guides for sidechain integration.


All the Mainstay tooling and software is released under the terms of the MIT license.