业务场景接口总览

最近更新时间:2019-10-30 10:20:59

TrustSQL 业务场景接口汇总

数字资产相关接口

接口名 接口功能
asset_issue_apply 资产发行申请
asset_issue_submit 资产发行提交
asset_mult_transfer_mid_apply 资产转让至中间账户申请(转让签收场景)
asset_mult_transfer_mid_submit 资产转让至中间账户提交(转让签收场景)
asset_mult_signin_apply 资产转让签收申请(转让签收场景)
asset_mult_signin_submit 资产转让签收提交(转让签收场景)
asset_transfer_apply 资产直接转让申请(非签收场景)
asset_transfer_submit 资产直接转让提交(非签收场景)
asset_settle_apply 资产兑付申请
asset_settle_submit 资产兑付提交
asset_account_query 资产批量查询
trans_batch_query 交易批量查询
asset_rec_sum_query 资产汇总对账
asset_rec_detail_query 资产明细对账
trans_rec_sum_query 交易汇总对账
trans_rec_detail_query 交易明细对账

信息共享相关接口

接口名 接口功能
Iss_Append 共享信息新增/追加
Iss_Query 共享信息查询

Trustsql 业务场景接口示例

数字资产服务

本例以数字资产服务相关接口中的资产发行接口 asset_issue_apply 为例。

  1. 用户需设置自己的参数并封装成 POST 请求,请求的 URL 为 TBaaS 平台。用户自定义参数如下所示:
    values = {"mch_sign":"MEQCID0FuZnQUmzTFlokvIOr0WOhraDMAKRuyolhuy2", "owner_account":"1MdjmfAWm2xH67uR5Egx9c5R1pXYZVU9Hu","mch_id":"12345678","mch_pubkey":"A7wklkNCp3PgBiWPRTjUsv98DRi2QRQ69/Qs93XdIiDJ","timestamp":"1535955749","owner_uid":"owner_uid5259","chain_id":"ch6f2mp139e8tyhwco","content":{"test":"test"},"amount":10000000000000,"version":"2.0","owner_account_pubkey":"A7wklkNCp3PgBiWPRTjUsv98DRi2QRQ69/Qs93XdIiDJ","sign_type":"ECDSA","source_id": "52227180","asset_type": 1,"unit": "fen","node_id": "tb6ckw7vr49mf0g1sb"}
    封装的 JSON 格式为:
    {"Service" : "dam",  "Method" : "asset_issue_apply", "Param": values 的字符串}
  2. 从返回结果中获取 sign_strtransaction_id。返回结果如下所示:
    {"version":"2.0","sign_type":"ECDSA","mch_id":"trust_mch","mch_sign":"MEUCIQDKqvBbz3xLKXk6Y6tfUjRYAYCtV1reyDtQqtaik3KFmQIgGbVQjYiYCay7lw4XOwxZROAX3HRF4rWX/9I0lMmutuI=","chain_id":"ch6f2mp139e8tyhwco","retcode":0,"retmsg":"SUCCESS","transaction_id":"201907300035132738","asset_id":"26aNKohVAE6X67k8Z2ZgPWZvTBf87ma9nfQ2jiLgaDGz1h3","sign_str_list":[{"id":1,"account":"1MdjmfAWm2xH67uR5Egx9c5R1pXYZVU9Hu","sign_str":"58dbee169d2e7e8897204245b468e2ccd6c4fa6646e26280e62d05642aa54fba"}],"mch_pubkey":""}
  3. sign_strQch3zytFxs+F1+32oqmqzL8XXEJjt+0rpedD3Tp61jI= 进行 ECDSA 签名,获取 sign
  4. 调用 asset_issue_submit 接口,进行资产发行提交。用户自定义参数如下所示:
    说明:

    其中 signtransaction_id 已从 步骤1 中获取。

    values={"mch_sign":"MEQCID0FuZnQUmzTFlokvIOr0WOhraDMAKRuyolhuy2","mch_id":"12345678","mch_pubkey":"A7wklkNCp3PgBiWPRTjUsv98DRi2QRQ69/Qs93XdIiDJ","timestamp":"1535955749","chain_id":"ch6f2mp139e8tyhwco","version":"2.0","sign_type":"ECDSA","source_id":"52227180","asset_type":1,"node_id":"tb6ckw7vr49mf0g1sb","transaction_id":"201907300035132738","sign_list":[{"account":"1MdjmfAWm2xH67uR5Egx9c5R1pXYZVU9Hu","sign_str":"58dbee169d2e7e8897204245b468e2ccd6c4fa6646e26280e62d05642aa54fba","id":1,"sign":"MEQCIFG8Rlky48cTtk9Nh27V+IK/OZaR348jkg2tJDqvlQg0AiAF+ARNwSom6iqBoos4AHPcrsBRxIGbKsSmze1dbyttIw=="}]}
    封装的 JSON 格式为:
    {"Service" : "dam",  "Method" : "asset_issue_submit ", "Param": values 的字符串}
    返回结果如下所示:
    {"version":"2.0","sign_type":"ECDSA","mch_id":"trust_mch","mch_sign":"MEUCIQCpPdckb60H/2coiaekeAQmP+5OzakSGwC9XCDa2n4XJQIgEpaf+f4SFQ6q5FE2/rnhtA3qMRw+EEYkTWjYhEg4LKg=","chain_id":"ch6f2mp139e8tyhwco","retcode":0,"retmsg":"SUCCESS","asset_id":"26aNKohVAE6X67k8Z2ZgPWZvTBf87ma9nfQ2jiLgaDGz1h3","trans_hash":"c939226796a18f355a9626cbe03483a3405d72620140c40591fff83b8327482a","trans_b_height":2,"trans_b_timestamp":1564456174,"mch_pubkey":""}

信息共享服务

本例以信息共享服务相关接口中的共享信息新增接口 Iss_Append 为例。

  1. 用户需设置自己的参数并封装成 POST 请求,请求的 URL 为 TBaaS 平台。用户自定义参数如下所示:
    values = {"mch_sign":"MEQCID0FuZnQUmzTFlokvIOr0WOhraDMAKRuyolhuy2", "node_id": "tb6ckw7vr49mf0g1sb","chain_id":"ch6f2mp139e8tyhwco","public_key":"A7wklkNCp3PgBiWPRTjUsv98DRi2QRQ69/Qs93XdIiDJ","account":"1MdjmfAWm2xH67uR5Egx9c5R1pXYZVU9Hu","mch_pubkey":"A7wklkNCp3PgBiWPRTjUsv98DRi2QRQ69/Qs93XdIiDJ","timestamp":"1535955749","sign":"","content":{"test":"content_8804177188"},"mch_id":"12345678","version":"2.0","sign_type":"ECDSA","extra_info":{"test":"test"}}
    封装的 JSON 格式为:
    {"Service" : "iss",  "Method" : "Iss_Append", "Param": values的字符串}
  2. 从返回结果中获取 sign_str。返回结果如下所示:
    {"version":"2.0","sign_type":"ECDSA","mch_id":"trust_mch","mch_sign":"MEYCIQDoNs11+aGS/AtpSlpI9CWnqfcd47w9PzWXYrbpwPwKmwIhAO14RahFLaa6Kz+ga1Tc4Q6fpQzKOWNNGqgQw0omOKdQ","retcode":0,"retmsg":"SUCCESS","sign_str":"003fca1b393f536cdd0d17fd68e88277607328a2b026bb392ac9c798acfa4cfb","t_hash":"ac2e0e0415235ae1cd11f0019bc28d72542847dbd1434da84bde9ae9f0f0acbf","inputs":[{"index":0,"output_point":{"hash":"0000000000000000000000000000000000000000000000000000000000000000","index":-1,"issueNo":"117e77a22c4b8f80f66d5173fb934d53"},"voucher":""}],"outputs":[{"condition":"6GS968dzAPG2643DVXp1Qb2TaTS8sV4KA7c4efu","amount":1,"address":"1MdjmfAWm2xH67uR5Egx9c5R1pXYZVU9Hu","data":"6QqbdaZ6wQhEEAiA7goe2MvwrW7a9mCnNd6z9ujCHD1va5hh76uK2zA8ZP6zegvovXSF6WakDRL8U8xwYs3hDoupkWf4oPLx","index":0,"id":"1515fBVwCUCUSCSC9C1SdtjV2VYRphNGm5FEyeGbsUijHUnnanuca2oR1GNxdt"}]}  
  3. sign_strQch3zytFxs+F1+32oqmqzL8XXEJjt+0rpedD3Tp61jI= 进行 ECDSA 签名,得到 sign
  4. 将获取的 sign 值填入 步骤1sign 字段,并重新执行 步骤1
    返回结果如下所示:
    {"version":"2.0","sign_type":"ECDSA","mch_id":"trust_mch","mch_sign":"MEUCIQCp3An9noXV5tmuuNAVqwGsaGcWxzEMK61mqRygvyme+QIgIjIojlCeokKPUizSp2MqtROwIv93DMZC8w8TgAiKQ+Q=","retcode":0,"retmsg":"SUCCESS","t_hash":"ac2e0e0415235ae1cd11f0019bc28d72542847dbd1434da84bde9ae9f0f0acbf","b_height":"1","b_time":"2019-07-29 17:56:44"}