{"id":21658325,"url":"https://github.com/BuildOnViction/tomox-sdk","last_synced_at":"2025-07-17T21:30:52.074Z","repository":{"id":33868143,"uuid":"154813285","full_name":"BuildOnViction/tomox-sdk","owner":"BuildOnViction","description":"SDK to build a Decentralized Exchange on TomoX protocol","archived":false,"fork":false,"pushed_at":"2023-02-24T17:33:55.000Z","size":79355,"stargazers_count":36,"open_issues_count":12,"forks_count":18,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-06-19T02:04:31.269Z","etag":null,"topics":["cryptocurrency","decentralized-exchange","sdk","tomochain","tomox"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BuildOnViction.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-26T09:50:27.000Z","updated_at":"2024-05-17T16:48:07.000Z","dependencies_parsed_at":"2023-07-13T21:15:42.659Z","dependency_job_id":null,"html_url":"https://github.com/BuildOnViction/tomox-sdk","commit_stats":null,"previous_names":["tomochain/tomodex","tomochain/dex-server","buildonviction/tomox-sdk","tomochain/tomox-sdk"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildOnViction%2Ftomox-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildOnViction%2Ftomox-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildOnViction%2Ftomox-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BuildOnViction%2Ftomox-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BuildOnViction","download_url":"https://codeload.github.com/BuildOnViction/tomox-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226304579,"owners_count":17603626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptocurrency","decentralized-exchange","sdk","tomochain","tomox"],"created_at":"2024-11-25T09:29:05.807Z","updated_at":"2024-11-25T09:29:10.520Z","avatar_url":"https://github.com/BuildOnViction.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# DEX backend\n \nOfficial decentralized exchange backend base on TomoX Protocol\n\n# Getting Started\n\n### Requirements\n- **golang** 1.12+\n- **mongoDB** version 3.6 or newer\n- **rabbitmq** version 3.7.7 or newer\n- **Go Modules** latest\n\n### Install \u0026 build\nGet packages\n```\ngo mod download\n```\n\nCreate config file\n```\ncp config/config.yaml.example config/config.yaml\n```\nThen you update `config.yaml` to be correct with your enviroment.\n\nBuild binary file\n```\ngo build\n```\n\nRun\n```\n./tomox-sdk\n```\n\nYou also can follow [TomoX Testnet Guide](https://docs.tomochain.com/masternode/tomox-sdk/) to know how to run a DEX on Testnet\n\n## REST API\nTomoX API Document [https://apidocs.tomochain.com/#tomodex-apis](https://apidocs.tomochain.com/#tomodex-apis)\n\n## Websocket API\nSee [WEBSOCKET_API.md](WEBSOCKET_API.md)\n\nYou also can test create/cancel order by using [TomoXJS SDK](https://github.com/tomochain/tomoxjs) and [TomoX Market Maker](https://github.com/tomochain/tomox-market-maker)\n\n## Types\n\n### Orders\n\nOrders contain the information that is required to register an order in the orderbook as a \"Maker\".\n\n- **id** is the primary ID of the order (possibly deprecated)\n- **orderType** is either BUY or SELL. It is currently not parsed by the server and compute directly from buyToken, sellToken, buyAmount, sellAmount\n- **exchangeAddress** is the exchange smart contract address\n- **maker** is the maker (usually sender) ethereum account address\n- **buyToken** is the BUY token ethereum address\n- **sellToken** is the SELL token ethereum address\n- **buyAmount** is the BUY amount (in BUY_TOKEN units)\n- **sellAmount** is the SELL amount (in SELL_TOKEN units)\n- **expires** is the order expiration timestamp\n- **nonce** is the nonce that corresponds to\n- **type** Limit order or Maket order LO/MO\n- **status** NEW/CANCELLED\n- **pairID** is a hash of the corresponding\n- **hash** is a hash of the order details (see details below)\n- **signature** is a signature of the order hash. The signer must equal to the maker address for the order to be valid.\n- **price** corresponds to the pricepoint computed by the matching engine (not parsed)\n- **amount** corresponds to the amount computed by the matching engine (not parsed)\n\n**Order Price and Amount**\n\nThere are two ways to describe the amount of tokens being bought/sold. The smart-contract requires (buyToken, sellToken, buyAmount, sellAmount) while the\norderbook requires (pairID, amount, price).\n\nThe conversion between both systems can be found in the engine.ComputeOrderPrice\nfunction\n\n**Order Hash**\n\nThe order hash is a sha-256 hash of the following elements:\n\n- Exchange address\n- Token Buy address\n- Amount Buy\n- Token Sell Address\n- Amount Sell\n- Expires\n- Nonce\n- Type\n- Status\n- Maker Address\n\n### Trades\n\nWhen an order matches another order in the orderbook, the \"taker\" is required\nto sign a trade object that matches an order.\n\n- **orderHash** is the hash of the matching order\n- **amount** is the amount of tokens that will be traded\n- **trade nonce** is a unique integer to distinguish successive but identical orders (note: can probably be renamed to nonce)\n- **taker** is the taker ethereum account address\n- **pairID** is a hash identifying the token pair that will be traded\n- **hash** is a unique identifier hash of the trade details (see details below)\n- **signature** is a signature of the trade hash\n\nTrade Hash:\n\nThe trade hash is a sha-256 hash of the following elements:\n\n- Order Hash\n- Amount\n- Taker Address\n- Trade Nonce\n\nThe (Order, Trade) tuple can then be used to perform an on-chain transaction for this trade.\n\n### Quote Tokens and Token Pairs\n\nIn the same way as traditional exchanges function with the idea of base\ncurrencies and quote currencies, the decentralized exchange works with\nbase tokens and quote tokens under the following principles:\n\n- Only the exchange operator can register a quote token\n- Anybody can register a token pair (but the quote token needs to be registered)\n\nToken pairs are identified by an ID (a hash of both token addresses)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBuildOnViction%2Ftomox-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBuildOnViction%2Ftomox-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBuildOnViction%2Ftomox-sdk/lists"}