# MOV通用API

Field Value
HTTP_SERVER_ENDPOINT https://ex.movapi.com/vapor

# 获取某账户的Utxo

根据账户获得所有的Utxo

# Request

GET /v3/q/utxos

# Params

  • Int- start:开始
  • Int- limit:返回数量

# Body

  • Object- filter:过滤
    • String- script:账户的script编号
    • String- asset:账户的资产
  • Object- sort:排序
    • String- by:排序的键
    • String- order:升降序

# Response

  • String- hash:哈希
  • String- asset:资产代码
  • Int- amount:金额
# Request
POST https://ex.movapi.com/vapor/v3/q/utxos?limit=2
{
    "filter":{
        "script":"00147a6cfb076a560b9a37c4fd6ca2acc66f85b64a21",
        "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
    },
    "sort":{
        "by":"amount",
        "order":"desc"
    }
}

# Response
{
    "code": 200,
    "msg": "",
    "data": [
        {
            "hash": "f26d6ca7ebdbecd302cb70a7c5b3b26e47880241a505946a111bbdbeb91151f7",
            "asset": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "amount": 336000
        },
        {
            "hash": "0a418603b0fa5c5dc207b2c27a40845b25f2d42c1481dea30c634216d1384512",
            "asset": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "amount": 10000000
        }
    ],
    "pagination": {
        "start": 0,
        "limit": 2,
        "_links": {
            "next": "/bytom/v3/q/utxos?limit=10&start=10"
        }
    }
}

# 获取账户信息

根据账户地址获取账户信息

# Request

GET /v3/account/address

# Params

  • String- address:账户地址

# Response

  • Object- asset:资产对象
    • String- asset_id:资产ID
    • String- symbol:资产名称
  • String- balance:资产余额
  • String- available_balance:资产可用余额
  • String- total_received:接收的资产数量
  • String- total_sent:发送的资产数量
  • String- in_usd:资产以美元计价的总价值
  • String- in_cny:资产以人民币计价的总价值
  • String- in_btc:资产以比特币计价的总价值
  • 示例:
# Request
GET https://ex.movapi.com/vapor/v3/account/address?address=vp1qjzjd9fqsdl5a2ft4gwm526kene8pddnw6kakhn

# Response
{
   "code":200,
   "msg":"",
   "data":{
      "address":"vp1qhg8qjtd5e3thlem569fmt8l8uc6xyd2nmsscks",
      "label":"",
      "balances":[
         {
            "asset":{
               "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
               "symbol":"BTM"
            },
            "balance":"18.67621",
            "available_balance":"18.67621",
            "total_received":"7997.10581",
            "total_sent":"7978.4296",
            "in_usd":"1.15",
            "in_cny":"8.16",
            "in_btc":"0.000132"
         },
         {
            "asset":{
               "asset_id":"bda946b3110fa46fd94346ce3f05f0760f1b9de72e238835bc4d19f9d64f1742",
               "symbol":"BTC"
            },
            "balance":"0",
            "available_balance":"0",
            "total_received":"0.01",
            "total_sent":"0.01",
            "in_usd":"0.00",
            "in_cny":"0.00",
            "in_btc":"0.000000"
         },
         {
            "asset":{
               "asset_id":"78de44ffa1bce37b757c9eae8925b5f199dc4621b412ef0f3f46168865284a93",
               "symbol":"ETH"
            },
            "balance":"0",
            "available_balance":"0",
            "total_received":"0.1",
            "total_sent":"0.1",
            "in_usd":"0.00",
            "in_cny":"0.00",
            "in_btc":"0.000000"
         },
         {
            "asset":{
               "asset_id":"184e1cc4ee4845023888810a79eed7a42c02c544cf2c61ceac05e176d575bd46",
               "symbol":"USDT"
            },
            "balance":"0.037415",
            "available_balance":"0.037415",
            "total_received":"147.690972",
            "total_sent":"147.653557",
            "in_usd":"0.04",
            "in_cny":"0.26",
            "in_btc":"0.000004"
         }
      ],
      "votes":[

      ]
   }
}

# 构建转账交易

构建转账的交易

# Request

POST /vapor/v3/merchant/build-payment

# Params

  • String- address:账户地址

# Body

  • String- asset:资产ID
  • Array- recipents:接收者
    • String- address:地址
    • String- amount:金额
  • Int- confirmations:确认数
  • String- memo:附加信息
  • Boolean- forbid_chain_tx:禁止链式交易

# Response

  • Object- tx:交易
    • String- hash:交易哈希
    • Bool- status:交易是否为一笔手续费耗尽的无效交易
    • Int- size:交易体积
    • Int- submission_timestamp:交易提交的时间戳
    • String- memo:Memo信息
    • Array- inputs:UTXO输入
      • String- script:脚本地址
      • String- address:地址
      • Object- asset:资产ID
        • String- asset_id:资产ID
        • String- symbol:资产代码
      • String- amount:资产数量
      • String- type:UTXO类型
    • Array- outputs:UTXO输出
      • String- script:脚本地址
      • String- address:地址
      • Object- asset:资产ID
        • String- asset_id:资产ID
        • String- symbol:资产代码
      • String- amount:资产数量
      • String- type:UTXO类型
    • Int- fee:交易手续费
    • Array- balances:资产金额变动
      • String- asset:资产ID
      • Int- amount:资产数量
    • Array- types:交易类型
      • String- chain_type:订单类型
        • String- chain_tx:链式合并 UTXO 交易
        • String- mov_matched_tx:磁力合约成交交易
        • String- mov_place_order:磁力合约挂单交易
        • String- mov_cancel_order:磁力合约取消挂单交易
        • String- mov_cancel_order:闪兑交易
    • String- raw_transaction:待签名的交易信息
    • Array- signing_instructions:交易需要签名的信息
      • Object-
        • Array- derivation_path:派生路径
        • Array- sign_data:签名数据
        • String- pubkey:公钥
  • 示例:
# Request
POST https://ex.movapi.com/vapor/v3/merchant/build-payment?address=vp1qzftmh4ad5kzqrtsy4jfs088xyw5dyjagzyudcg
{
    "asset": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
    "recipients": {
        "vp1qzftmh4ad5kzqrtsy4jfs088xyw5dyjagzyudcg": 1,
    },
    "confirmations": 1,
    "memo": "中本聪",
    "forbid_chain_tx": False
}
    
# Response
{
   "code":200,
   "msg":"",
   "data":[
      {
         "tx":{
            "hash":"6e404c158e6e74f2eac0940ab83b2b9ebebf6acdf9483f02c4d7604b60d84450",
            "status":True,
            "size":279,
            "submission_timestamp":0,
            "memo":"memo",
            "inputs":[
               {
                  "script":"00147e73cdef5ccfff19a41d6682b458dfc1702adef2",
                  "address":"bm1q0eeumm6uell3nfqav6ptgkxlc9cz4hhjjhazgl",
                  "asset":{
                     "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "symbol":"BTM"
                  },
                  "amount":"12.95061",
                  "type":"spend"
               }
            ],
            "outputs":[
               {
                  "utxo_id":"06f7ddb720414ca28adafb8f17a4c5e97353c0871f10832fdd05000172d98ea6",
                  "script":"0020f86826d640810eb08a2bfb706e0092273e05e9a7d3d71f9d53f4f6cc2e3d6c6a",
                  "address":"bm1qlp5zd4jqsy8tpz3tldcxuqyjyulqt6d860t3l82n7nmvct3ad34qfktwv7",
                  "asset":{
                     "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "symbol":"BTM"
                  },
                  "amount":"1",
                  "type":"crosschain_output"
               },
               {
                  "utxo_id":"a087fed1e5a85892d2629097c687f946417fd1caaeb7969054018166beb81bbd",
                  "script":"00147e73cdef5ccfff19a41d6682b458dfc1702adef2",
                  "address":"bm1q0eeumm6uell3nfqav6ptgkxlc9cz4hhjjhazgl",
                  "asset":{
                     "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "symbol":"BTM"
                  },
                  "amount":"11.94612",
                  "type":"control"
               }
            ],
            "fee":"0.00449",
            "balances":[
               {
                  "asset":{
                     "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                     "symbol":"BTM"
                  },
                  "amount":"-1"
               }
            ],
            "types":[
               "out_crosschain"
            ]
         },
         "raw_transaction":"0701b4ac1c010160015eacb38e7be05ca145e9f997b4a34dd2face5d281a7b0e98c4985c9c51c19166a8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff88a0c4e90401011600147e73cdef5ccfff19a41d6682b458dfc1702adef2220120396e19350e81e4eb60bffa96cdac2e9485257a143bbd97b4535c3695d17a8428020148ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f01220020f86826d640810eb08a2bfb706e0092273e05e9a7d3d71f9d53f4f6cc2e3d6c6a00013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0aad1b904011600147e73cdef5ccfff19a41d6682b458dfc1702adef200",
         "signing_instructions":[
            {
               "derivation_path":[
                  "2c000000",
                  "99000000",
                  "01000000",
                  "00000000",
                  "01000000"
               ],
               "sign_data":[
                  "9bbda8d1c79053169901a9c0f5f404064980a86c79775c3bd76e5f69330a811c"
               ],
               "pubkey":"396e19350e81e4eb60bffa96cdac2e9485257a143bbd97b4535c3695d17a8428"
            }
         ]
      }
   ]
}

# 提交交易

提交交易的签名信息

# Request

POST /v3/merchant/submit-payment

# Params

  • String- address:账户地址

# Body

  • String- raw_transaction:submit-payment接口返回的数据
  • Array - signatures:签名数据
  • String- memo:交易备注

# Response

  • String- tx_hash:交易哈希
  • 示例:
# Request
POST https://ex.movapi.com/magnet/v3/merchant/submit-payment?address=vp1qzpm9pqf3phngkv9qnv73tgtr2mzdnxpdswphm3

# Body
{
    "raw_transaction":"070100010160015e26978b848afd77d559980e58db9b60559b716312bd1e24af7e44c6efa5c1605dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0a885fd0201011600140ff923ae0944af0cfdd3eb3671db354eaa6b5795220120c44537a8d397ee09315755cd77fd02d66db015f32ba358c3bfafe20d887d041202013cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f011600141e03ad3233693b551be8c86f5db062bdbe0c9f6600013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8b292cd02011600140ff923ae0944af0cfdd3eb3671db354eaa6b579500",
    "signatures":[
        [
            "4f5e0b94f983ab6d98c230e7edf031951c93809af318d0bb6c362714794c38c5939df58e43ac1a45599d777386724354c0ced7bab54d19bac02c233fa9e2050a"
        ]
    ],
    "memo":"mock transaction"
}

# Response
{
    "code": 200,
    "msg": "",
    "data": {
      "tx_hash": "e629f2f3eca0627eae0167f22a4a5e24c1495932624c1bcbeff064d4eeb219f0"
    }
}

# 构建高级交易

构建高级交易数据

# Request

POST /v3/merchant/build-advanced-tx

# Params

  • String- address:账户地址

# Body

  • Int- confirmations:区块确认数
  • Array- inputs:输入
    • String- script:脚本
    • Address- address:地址
    • String- asset:资产代号
    • String- amount:金额
    • String- type:输入类型
      • spend_utxo
      • spend_wallet
      • spend_address
  • Array- outputs:输出
    • String- script:脚本
    • String- address:地址
    • String- asset:资产代号
    • String- amount:金额
    • String- type:输出类型
      • control_address
      • control_program
  • String- fee: 手续费
  • Boolean- forbid_chain_tx: 是否链式交易

# Response

  • Object- tx:交易
    • String- hash:交易哈希
    • Bool- status:交易是否为一笔手续费耗尽的无效交易
    • Int- size:交易体积
    • Int- submission_timestamp:交易提交的时间戳
    • String- memo:Memo信息
    • Array- inputs:UTXO输入
      • String- script:脚本地址
      • String- address:地址
      • Object- asset:资产ID
        • String- asset_id:资产ID
        • String- symbol:资产代码
      • String- amount:资产数量
      • String- type:UTXO类型
    • Array- outputs:UTXO输出
      • String- script:脚本地址
      • String- address:地址
      • Object- asset:资产ID
        • String- asset_id:资产ID
        • String- symbol:资产代码
      • String- amount:资产数量
      • String- type:UTXO类型
    • Int- fee:交易手续费
    • Array- balances:资产金额变动
      • String- asset:资产ID
      • Int- amount:资产数量
    • Array- types:交易类型
      • String- chain_type:订单类型
        • String- chain_tx:链式合并 UTXO 交易
        • String- mov_matched_tx:磁力合约成交交易
        • String- mov_place_order:磁力合约挂单交易
        • String- mov_cancel_order:磁力合约取消挂单交易
        • String- mov_cancel_order:闪兑交易
    • String- raw_transaction:待签名的交易信息
    • Array- signing_instructions:交易需要签名的信息
      • Object-
        • Array- derivation_path:派生路径
        • Array- sign_data:签名数据
        • String- pubkey:公钥
# Request
POST https://ex.movapi.com/vapor/v3/merchant/build-advanced-tx?address=vp1qzftmh4ad5kzqrtsy4jfs088xyw5dyjagzyudcg
{
    "confirmations":1,
    "fee":"0.4",
    "inputs":[
        {
            "amount":"1",
            "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "type":"spend_wallet"
        },
        {
            "amount":"0.1",
            "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "type":"spend_wallet"
        }
    ],
    "outputs":[
        {
            "type":"control_address",
            "amount":"99",
            "asset": {
                        "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                        "symbol": "BTM"
            },
            "address":"bm1q50u3z8empm5ke0g3ngl2t3sqtr6sd7cepd3z68"
        },
        {
            "type":"control_program",
            "amount":"99",
            "asset": {
                        "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                        "symbol": "BTM"
             },
            "control_program":"bm1q50u3z8empm5ke0g3ngl2t3sqtr6sd7cepd3z68"
        }
    ],
}
    
# Response
{
    "code":200,
    "msg":"mock",
    "result":{
        "data":[
          {
                "tx":{
                    "inputs":[
                        {
                            "script":"00147a8a16c665568c2f52e33c5fb373a3bd1fb7f2c1",
                            "address":"tm1q029pd3n926xz75hr830mxuarh50m0ukpw8g27u",
                            "asset":"0000000000000000000000000000000000000000000000000000000000000000",
                            "amount":"0",
                            "type":"spend"
                        }
                    ],
                    "outputs":[
                        {
                            "script":"00147a8a16c665568c2f52e33c5fb373a3bd1fb7f2c1",
                            "address":"tm1q029pd3n926xz75hr830mxuarh50m0ukpw8g27u",
                            "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                            "amount":"412.5",
                            "type":"control"
                        }
                    ],
                    "fee":"0",
                    "balances":[
                        {
                            "asset":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                            "amount":"412.5"
                        }
                    ],
                    "hash":"eb4daea5edc379b6ab024c0e4ef963feafe6affcfe581d66f7ad3ec6d1828463"
                },
                "raw_transaction":"070100010160015e5978c52e0508cbf1cd901919277e4dba80fb4440b4771bbaa3b6c483f9264d21ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8094ebdc0301011600143c21d88332683d060ccf905a0f26ce82907ac132220120f3a597b7a1f8b7b210790d5ceef145ae8616d025a6fdb4aec67338bf937af6b9020139ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6401160014f0928dc5f8878a4289b981d7c66386ff74be7fc300013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb4dfcfdc03011600143c21d88332683d060ccf905a0f26ce82907ac13200",
                "signing_instructions":[
                    {
                        "sign_data":[
                            "b9fb5dc0e7b7ee0e9c252439ec32fe6b222e0d170aee6b562634dfad3638560e"
                        ]
                    }
                ]
          }
        ]
    }
}
Last Updated: 8/11/2020, 2:26:55 PM