💠 Mosaic Contracts
Mosaic is a parallelization schema for decentralized applications. It composes heterogeneous blockchain systems into one another. Decentralized applications can use Mosaic to compute over a composed network of multiple blockchain systems in parallel.
Mosaic enables building scalable blockchain token economies through the bidirectional transposition of ERC20 tokens on one blockchain, the origin chain, and a utility token representation on another blockchain, the auxiliary chain.
The protocol defines a set of actions that together perform atomic token transfers across two blockchains using gateway contracts. A gateway for a given EIP20 token is comprised of a
EIP20Gateway contract on origin, a corresponding
EIP20CoGateway contract on auxiliary, and and an ERC20 utility token contract on auxiliary that mints and burns utility tokens to atomically mirror tokens staked and unstaked on the origin chain.
Atomicity is achieved using a 2-phase message passing architecture between the chains. Messages are declared on the source chain, and confirmed on the target chain with Patricia Merkle proofs once the source chain is finalized. Once messages are confirmed on the target chain, they can efficiently progressed with a hashlock. Messages can also be reverted if they are not yet completed on the target chain.
For JS Consumers
npm install @openstfoundation/mosaic-contracts
// Load the contracts' meta-data from the package:constAnchorCoGatewayUtilityTokenInterfaceEIP20CoGatewayEIP20GatewayEIP20InterfaceEIP20TokenGatewayLibMerklePatriciaProofMessageBusOrganizationOrganizationInterfaceOrganizedOSTPrimeStateRootInterfaceUtilityTokenUtilityTokenInterface= ;// Access the ABIs and BINs directly on the contracts. For example:const anchorAbi = Anchorabi;const anchorBinary = Anchorbin;
For Direct Users
This section is only required if you want to set up a new mosaic chain.
git clone email@example.com:OpenSTFoundation/mosaic-contracts.gitcd mosaic-contractsnpm installnpm run compile-all
There is a deployment tool available for deployment and set-up:
⚠️ Note that this feature is still very experimental ⚠️
git clone firstname.lastname@example.org:OpenSTFoundation/mosaic-contracts.gitcd mosaic-contractsnpm installnpm run compile-allnpm run ganachenpm run test# Requires docker, stop ganache first:npm run test:integration
There are multiple ways to contribute to this project. However, before contributing, please first review the Code of Conduct.
We track our issues on GitHub.
To contribute code, please ensure that your submissions adhere to the Style Guide; please also be aware that this project is under active development and we have not yet established firm contribution guidelines or acceptance criteria.