CustodyBtcOnChain

一.从链上钱包充值到托管账户

1.获取充值地址

GET:/custodyAccount/getRechargeBtcOnChainAddress

无请求体

响应体:

{
    "success": true,
    "error": "",
    "code": 200,
    "data": {
        "addr": "bcrt1pvjr6yadxsnzr86eulnvry225l49cqmr2v7mmwstgmnxq8ekx89wsdcywma"
    }
}

2.提交充值记录

Post:/custodyAccount/rechargeBtcOnchain

请求体:

{
    "tx_hash": "afa5b8cb777a67774f0850e9df382705e74df01e242efb80007f85ceefbadfc6"
}

响应体

{
    "success": true,
    "error": "",
    "code": 200,
    "data": {
        "success": "success"
    }
}

3.使用方法

a.调用1获取一个充值地址

b.调用api包中的sendcoins接口向a获取的地址转账,转账逻辑与正常比特币转账相同。

c.保存b中sendcoins接口返回的txid,作为2的tx_hash提交给服务器

d.等待链上确认

二.比特币提现到链上地址

1.提现

post:/custodyAccount/withdrawBtcOnchain

参数:

{
    "address": "bcrt1prxfa9nytpvqv9rh8lcmm68fv7nzydym6q69nd9cdtryp5kmwpt64sp2m6rq",
    "amount": 111111
}

响应体:

{
    "success": true,
    "error": "",
    "code": 200,
    "data": {
        "success": "success"
    }
}

Last updated