Skip to content
Mosaic is a set of meta-blockchains on top of Ethereum to scale DApps
Branch: develop
Clone or download
Latest commit fa436b0 Feb 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts Fixed formating and documentation Feb 20, 2019
dist Updated year of copyright Jan 25, 2019
docs Deleted unused files Jan 31, 2019
migrations Merge branch 'develop' into js_styling Feb 5, 2019
test
test_integration
tools
.eslintrc.json Merge branch 'develop' into js_styling Feb 5, 2019
.gitattributes Rename .gitattribute to .gitattributes Aug 22, 2018
.gitignore Provides NPM package to access contracts' metadata Jan 24, 2019
.solcover.js Changed all references of core in the constructor Dec 18, 2018
.soliumignore
.soliumrc.json Added solium Aug 3, 2018
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
LICENSE initial commit Jun 25, 2018
README.md Add info about the deployment tool Feb 8, 2019
SOLIDITY_STYLE_GUIDE.md
VERSION.md
package-lock.json
package.json Update version to 0.10.0-beta.2 Feb 20, 2019
truffle.js Made changes based on PR feedback Jan 31, 2019

README.md

💠 Mosaic Contracts

Build master Build develop npm version Discuss on Discourse Chat on Gitter

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.

You can read the draft of the mosaic whitepaper or the original OpenST whitepaper.

Instructions

For JS Consumers

Installation

npm install @openstfoundation/mosaic-contracts

Usage

// Load the contracts' meta-data from the package:
const {
  Anchor,
  CoGatewayUtilityTokenInterface,
  EIP20CoGateway,
  EIP20Gateway,
  EIP20Interface,
  EIP20Token,
  GatewayLib,
  MerklePatriciaProof,
  MessageBus,
  Organization,
  OrganizationInterface,
  Organized,
  OSTPrime,
  StateRootInterface,
  UtilityToken,
  UtilityTokenInterface,
} = require('@openstfoundation/mosaic-contracts');

// Access the ABIs and BINs directly on the contracts. For example:
const anchorAbi = Anchor.abi;
const anchorBinary = Anchor.bin;

For Direct Users

This section is only required if you want to set up a new mosaic chain.

Installation

git clone git@github.com:OpenSTFoundation/mosaic-contracts.git
cd mosaic-contracts
npm install
npm run compile-all

Usage

There is a deployment tool available for deployment and set-up:

node ./tools/blue_deployment/index.js

⚠️ Note that this feature is still very experimental ⚠️

Related Work

mosaic.js uses this package to provide a JavaScript abstraction layer of the mosaic contracts. You can use mosaic.js directly to deploy the contracts and interact with them.

Contributing

Set-up

git clone git@github.com:OpenSTFoundation/mosaic-contracts.git
cd mosaic-contracts
npm install
npm run compile-all
npm run ganache
npm run test

# Requires docker, stop ganache first:
npm run test:integration

Guidelines

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.

Community

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.