Waves DEX live on mainnet: how to post orders

Guy
Waves Protocol
Published in
2 min readApr 3, 2017

Waves’ decentralised exchange (DEX) has been deployed on mainnet and Matcher transactions are live. You can currently access it via a full node. In due course it will be integrated with the GUI in the lite client, allowing anyone to use it without any technical knowledge or blockchain downloads. For now, here’s some more information about how to post orders.

If you want to post an order for the Waves DEX, you’ll need access to a Waves node. At this point, that either means running your own node or signing a transaction offline and sending it to an open one. If you need more information about setting up a node, read https://github.com/wavesplatform/Waves/wiki/How-to-install-Waves-node or ask for help in the #fullnode channel of Waves Slack.

Matcher nodes are responsible for pairing orders and executing trades quickly, whilst they are still settled on the blockchain. You’ll need to send your orders to a Matcher. Peter Black (@pblck), who helpfully provided information for this article, has an open one at http://dev.pywaves.org:6886. If you visit http://dev.pywaves.org:6886/matcher/orderbook you can see the listed pairs.

To sign an order (buy or sell) you need a node, go to /assets/order and post something along the following lines:

{
“senderPublicKey”: “YOUR_PUBLIC_KEY”,
“matcherPublicKey”: “YOUR_MATCHER_PUBLIC_KEY”,
“assetPair”: {
“amountAsset”: “AnERqFRffNVrCbviXbDEdzrU6ipXCP5Y1PKpFdRnyQAy”,
“priceAsset”: “”
},
“orderType”: “buy”,
“price”: 10000000,
“amount”: 100000000000,
“timestamp”: YOUR-TIME-STAMP,
“expiration”: YOUR-EXPIRATION-TIME-STAMP,
“matcherFee”: 100000
}

YOUR_PUBLIC_KEY is the public key of the buyer/seller (you can get this from the backup tab of the lite client)

YOUR_MATCHER_PUBLIC_KEY is the public key of the matcher, which can be obtained from from /matcher on the matcher URL. E.g. GoVxp9iFXvDhGFUYG4fZ4GU3yQDsxyti8f3D5tNYiAXX in the case of the given node.

amountAsset/priceAsset is the pair: in the example above RBX/WAVES, but you can post orders in any pair of tokens.

timestamp and expiration are Unix epoch timestamps. There are several ways to generate these, or you can use an online tool like https://www.epochconverter.com/. It is in millisecond format, e.g. 1491205494000.

Post the JSON, then post the response you get to /matcher/orderbook on the matcher node. Done! If you post a matching order, it should be Matched in a matter of milliseconds and confirm in under a minute. Pretty impressive!

If you’re not running your own node, it’s still possible to post orders, but you’ll need a piece of custom code to sign transactions, which you then post to a node. Pblck has created some Python tools to do that — see https://github.com/PyWaves/PyWaves.

--

--

Guy
Waves Protocol

UK-based cryptocurrency communicator. Class of 2014.