Coder Social home page Coder Social logo

exincore's Introduction

ExinCore

ExinCore is a decentralized instant exchange platform built on Mixin Network, to use ExinCore, just send a asset transfer to ExinCore, ExinCore will auto use API to trade in exchange like Binance, Huobi Global, BigOne, Okex, FCoin, ruturn to pay account after exchange, complete within 1 second.

All order and trade data are encoded in the Mixin snapshots' memo field, the memo is base64 encoded MessagePack.

ExinCore is available to professional users with programming skills, general user enjoy the Instant-Exchange service, and the OTC service at ExinOne.

Features

  • Safe: decentralized exchange, keeping assets by yourself, and no need to trust ExinCore.
  • High Liquidity: all pairs will connect to the best liquidity exchange to ensure trade at right market price.
  • Free: Mixin Network is a free and lightning fast peer-to-peer transactional network for digital assets.
  • Fast: API to exchanges trade, complete the transaction within 1 second.
  • Cross-chain:ExinCore can support all assets supported by the Mixin Network, now support BTC ETH BCH EOS USDT and so on.

Create Order

To exchange 10 USDT to BTC, send a 10 USDT transfer to ExinCore (61103d28-3ac2-44a2-ae34-bd956070dab1) with base64 encoded MessagePack data as the memo. A example to test.

Transfer

Reference the Mixin Network API Document:

https://developers.mixin.one/api/alpha-mixin-network/transfer/

Memo Encode Example

Golang

Install the package:

// You can use other msgpack implementations.
go get -u github.com/vmihailenco/msgpack

Example:

import (
    "encoding/base64"
    "github.com/satori/go.uuid"
    "github.com/vmihailenco/msgpack"
)

type OrderAction struct {
    A  uuid.UUID  // asset uuid
}

memo := base64.StdEncoding.EncodeToString(msgpack.Marshal(OrderAction{
    A: uuid.FromString("c6d0c728-2624-429b-8e0d-d9d19b6592fa"),
}))

PHP

Install msgpack extension:

sudo pecl install msgpack

Install the package:

composer require ramsey/uuid

Example:

require 'vendor/autoload.php';

use Ramsey\Uuid\Uuid;

$memo = base64_encode(msgpack_pack([
    'A' => Uuid::fromString("c6d0c728-2624-429b-8e0d-d9d19b6592fa")->getBytes(),
]));

Python

Install the package:

pip install msgpack

Example:

import uuid
import msgpack
import base64

memo = base64.b64encode(msgpack.packb({
    "A": uuid.UUID("{c6d0c728-2624-429b-8e0d-d9d19b6592fa}").bytes
}))

Ruby

Install the package:

// You can use other msgpack implementations.
sudo gem install msgpack
sudo gem install easy-uuid

Example:

require 'msgpack'
require 'base64'
require 'uuid'

memo = Base64.encode64(MessagePack.pack({
    'A' => UUID.parse("c6d0c728-2624-429b-8e0d-d9d19b6592fa").to_raw
}))

Instant Exchange Return

ExinCore will send asset to the pay account with base64 encoded MessagePack data as the memo.

type OrderAction struct {
    C  integer    // code
    P  string     // price, only type is return
    F  string     // ExinCore fee, only type is return
    FA string     // ExinCore fee asset, only type is return
    T  string     // type: refund(F)|return(R)|Error(E)
    O  uuid.UUID  // order: trace_id
}

memo = base64.StdEncoding.EncodeToString(msgpack(OrderAction{
    C:  1000,
    P:  "0.46372",
    F:  "0.000023",
    FA: uuid.FromString("c6d0c728-2624-429b-8e0d-d9d19b6592fa"),
    T:  "F"
    O:  uuid.FromString("37af6bd0-ecb8-11e8-9be4-3be93718305e"),
}))

memo = base64.StdEncoding.EncodeToString(msgpack(OrderAction{
    C: 1000,
    T: "F"
    O: uuid.FromString("37af6bd0-ecb8-11e8-9be4-3be93718305e"),
}))

Parameter Description

Parameter Description
C Code
P The Exchange price includ exchange fee
F The amount of ExinCore fee
FA The UUID of ExinCore fee asset
T Transfer type. F is refund, refund will not happen if the memo is not valid base64 encoded MessagePack data. R is return after exchange success. E is error, such as insufficient funds pool, it will retry until successful.
O Order ID, the same as trace_id

API of Get Instant Exchange List

Get the ExinCore the support list of instent exchange with base_asset (optional), exchange_asset(optional)

GET https://exinone.com/exincore/markets?base_asset=815b0b1a-2764-3736-8faa-42d694fa620a

{
  "code": 0,
  "data": [
    {
      "base_asset": "815b0b1a-2764-3736-8faa-42d694fa620a",
      "base_asset_symbol": "USDT",
      "echange_asset": "c6d0c728-2624-429b-8e0d-d9d19b6592fa",
      "echange_asset_symbol": "BTC",
      "minimum_amount": "1",
      "maximum_amount": "100",
      "exchanges": ["Huobi Global"],
      "price": "5372"
    }
  ],
  "message": "success"
}

Parameter Description

Parameter Description
base_asset The UUID of pay asset
base_asset_symbol The symbol of pay asset
echange_asset The UUID of exchange asset
echange_asset_symbol The symbol of exchange asset
minimum_amount The minimum of pay asset
maximum_amount The maximum of pay asset
exchanges The exchange platforms
price The trade price, echange_asset price/base_asset price, for reference only, subject to actual transaction price

Fee

  • 0.2% of the filled part after December 15, 2018, and free before the time
  • Deduct from the exchange asset
  • Not support the ExinOne Point Card (EPC)

Code

Code Type Description
1000 return Successful Exchange
1001 refund The order not found or invalid
1002 refund The request data is invalid
1003 refund The market not supported
1004 refund Failed exchange
1005 return|refund Partial exchange
1006 error Insufficient pool
1007 refund Below the minimum exchange amount
1008 refund Exceeding the maximum exchange amount

Contact

Base On

         

Application

 

exincore's People

Contributors

kuri-su avatar lorca-r avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.