Skip to content
A library for the Open Market Protocol (OMP).
Branch: master
Clone or download
Latest commit 80d3db5 Apr 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ Merge branch 'master' into ct Apr 8, 2019
bins readme Feb 26, 2019
src hash: simplify hashing, make it stringify the sorted objects to JSON … Apr 10, 2019
.travis.yml Add test suite Jul 7, 2018 Merge branch 'master' into ct Apr 8, 2019
notes Initial commit Sep 7, 2018
package.json v0.1.50 Apr 10, 2019 Test framework: travis doesn't like inputs very much, temporarily dis… Apr 8, 2019
tslint.json tests Oct 10, 2018


The reference implementation for the Open Market Protocol

Note: the documentation is very outdated for the private message format.


* build(..MPA_*):  rebuilds the transaction for a given and spits outs the rawtx.
* validate(MPA_*): validate that a marketplace action conforms to the protocol.
* verify(..MPA_*): verifies a _chain_ of MarketPlaceActions.
* strip(MPA_*):  strip any fields that do not belong in the protocol (simple: delete all that start with "_").

* create(MPA_LISTING_ADD): returns MPA_BID.
* accept(MPA_LISTING_ADD, MPA_BID): returns MPA_ACCEPT (partially signed destruction tx, partially signed release tx).
* lock(MPA_LISTING_ADD, MPA_BID, MPA_ACCEPT): make this also create the release tx. returns MPA_LOCK. (signed destruction tx, partially signed bix txn)
* complete(MPA_LISTING_ADD, MPA_BID, MPA_ACCEPT, MPA_LOCK): returns a fully signed bid rawtx for the seller.
* release(MPA_LISTING_ADD, MPA_BID, MPA_ACCEPT, MPA_LOCK): returns a fully signed release rawtx for the buyer.
* refund(MPA_LISTING_ADD, MPA_BID, MPA_ACCEPT, MPA_LOCK): returns a fully signed refund rawtx for the seller.

Format validators

The format validators can be found in the src/format-validators directory. These purely validate:

  • required fields
  • the right types (string, number, ..)
  • non-negative fields

Sequence verifiers

The sequence verifiers can be found in the src/sequence-verifiers directory. These purely verify that the provide sequence of actions is correct:

  • validate format of action first
  • check the sequence to verify that the order is correct (e.g. no bids before listing)
  • verify that the sequence linked by the hashes is correct
  • verify that the cryptocurrency in the bid is allowed in the listing
  • verify that the escrow type over the sequence doesn't change

Deterministic transaction generation

Given a sequence of MPA's (marketplace actions), the resulting transaction generated by this library should be identical, byte-for-byte. The library rebuilds the transactions and stores a state of (potentially incomplete) transactions in the private fields of a message.

Private fields

Additional fields can be supplied by the database with an "_", these should be stripped out using strip(). We only use these when building transactions.


Run the test environment by running: python3

Then run the test with: yarn test

You can’t perform that action at this time.