Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @openst/mosaic-proof with all npm packages installed. Try it out:

var mosaicProof = require("@openst/mosaic-proof")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@openst/mosaic-proof v0.1.0-alpha.1

Mosaic proof is a tool for generating merkle patricia proof of message that is used by the protocol for message transfers.

Mosaic proof

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. More details on Mosaic here

The protocol defines a set of actions that together perform atomic token transfers across two blockchains using gateway contracts. This is done using a 2-phase message passing architecture between the chains. This is done with proving Merkle Patricia proofs of messages generated from one chain to another chain.

Mosaic proof is a tool for generating Merkle Patricia proof of a message that is used by the protocol for message transfers.

###Usage install @openst/mosaic-proof package.

npm install @openst/mosaic-proof

Using proof generator.

import { ProofGenerator } from '@openst/mosaic-proof';

Create proof generator object.

const web3 = new Web3('http://localhost:8546');
const proofGenerator = new ProofGenerator(web3);

Generate message box outbox proof for a given message

const eip20GatewayAddress = '0xEIP20GatewayAddress000000000000000000000';
const messageHash = '0xMessageHash000000000000000000000000000000000000000000000000000';
const blockNumber = 'latest';

// Get MessageBox outbox proof.
const outboxProof:ProofData = await proofGenerator.getOutboxProof(
    eip20GatewayAddress,
    [messageHash], 
    blockNumber,
  );

Generate message box inbox proof for a given message

// Get MessageBox outbox proof.
const inboxProof: ProofData = await proofGenerator.getInboxProof(
    eip20GatewayAddress,
    [messageHash], 
    blockNumber,
  );

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free