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 linked sequence of irreversible and provably unique cryptographic commitments made to the Bitcoin blockchain which in turn derives its immutability and global objective state from the Proof-of-Work consensus algorithm. In this way, any independent system with state (and a unique history of state changes) can be proven to be as immutable as the Proof-of-Work blockchain it is secured by. The proof of immutable state (PoIS) 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 cryptographic commitments based on the pay-to-contract method (BIP175), and is compatible with verification via Simplified Payment Verification (SPV). The Mainstay Connector protocol enables many separate systems to obtain independent proofs of immutabilite state via a single sequence of Bitcoin commitments, by compressing sequences of commitments in a Merkel tree of slot-proofs. This minimises the burden on to the Bitcoin blockchain, and thousands of separate systems can be secured with just a single sequence of Bitcoin transactions.

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 implementations and tooling, CommerceBlock’s Mainstay service and API as well as step-by-step guides for service integration.


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