Skip to content

IFWallet钱包开放接口文档

bibodeng edited this page Jan 12, 2019 · 5 revisions

开放接口权限申请

请微信联系 bibodeng 获取特有的 API_KEY 和 SECRET_KEY,它们是调用IFWallet钱包开放接口的凭据,请妥善保管,不得泄露。

请求方式

开放接口请求方式统一,在每个请求的Header中填入APIKEY和SECRETKEY,务必使用和以下一致的参数名:

APIKEY: 调用方唯一标识 
SECRETKEY:调用方密钥 

接口

获取UTXO

GET https://api.ifwallet.com/open/wallet/unspent

请求参数:

coin_type 币种 如 BCH/BSV
addresses 地址列表 如 ["bchtest:qzgs336xkt7cce27z43d8ctmhltevlhtny4asyv5vz"]

响应结果:

{
    "code": 0,
    "data": [{
            "address": "bchtest:qzgs336xkt7cce27z43d8ctmhltevlhtny4asyv5vz",
            "amount": 0.00000546,
            "confirmations": 1081,
            "txid": "de13d07cf8db5c9143ead28431054d027cd56433a86eb8a16650cf4df59e5bb5",
            "vout": 1
    }],
    "message": "OK"
}

广播交易

POST https://api.ifwallet.com/open/tx

请求参数:

coin_type 币种 如 BCH/BSV
raw_transaction 原始交易Hex

响应结果:

{
    "code": 0,
    "data": {
        "txid": "df8e2c5241aa23a26c1d29077c52c87176e5a24124b8e120c4a161a67093e8ff"
    },
    "message": "OK"
}

查询交易

GET https://api.ifwallet.com/open/tx

请求参数:

coin_type 币种 如 BCH/BSV
txid 交易ID 如 df8e2c5241aa23a26c1d29077c52c87176e5a24124b8e120c4a161a67093e8ff

响应结果:

{
    "code": 0,
    "data": {
        "blockhash": "00000000610dd7e84cb31786faed5a36c3e861a1ce6bc52f765458683c235d71",
        "blocktime": 1542793965,
        "confirmations": 2052,
        "hash": "df8e2c5241aa23a26c1d29077c52c87176e5a24124b8e120c4a161a67093e8ff",
        "hex": "0200000001215c215fa2d3d8182fb9e271c1ab61a3165dc3b7e52e3ac766baf550df26b5c4040000006a4730440220312533a57937e33efb66a2913eb3a760d89ef22bbcc3827ec71621f934d6e92a0220372433d2c02f9b0cc4b244a695d77a76fbbacc8a56f31c359d7cd9d8350612384121033e7dd580b2cd7ddf2644a1b353b45c0ce04f69be36fef65159e03f01f6685902ffffffff0522020000000000001976a9149108c746b2fd8c655e1562d3e17bbfd7967eeb9988ac22020000000000001976a9149108c746b2fd8c655e1562d3e17bbfd7967eeb9988ac22020000000000001976a9149108c746b2fd8c655e1562d3e17bbfd7967eeb9988ac22020000000000001976a91464f43e2b7e4d2909666482f8bc7fd9f67ddad3f488ac38634a00000000001976a914f450b57576cdbb8929f91e08c3d7f20741b56f5488ac00000000",
        "locktime": 0,
        "size": 327,
        "time": 1542793965,
        "txid": "df8e2c5241aa23a26c1d29077c52c87176e5a24124b8e120c4a161a67093e8ff",
        "version": 2,
        "vin": [
            {
                "address": [
                    "bchtest:qr69pdt4wmxmhzffly0q3s7h7gr5rdt02suq5rn8mr"
                ],
                "amount": 0.0487778,
                "scriptSig": {
                    "asm": "30440220312533a57937e33efb66a2913eb3a760d89ef22bbcc3827ec71621f934d6e92a0220372433d2c02f9b0cc4b244a695d77a76fbbacc8a56f31c359d7cd9d835061238[ALL|FORKID] 033e7dd580b2cd7ddf2644a1b353b45c0ce04f69be36fef65159e03f01f6685902",
                    "hex": "4730440220312533a57937e33efb66a2913eb3a760d89ef22bbcc3827ec71621f934d6e92a0220372433d2c02f9b0cc4b244a695d77a76fbbacc8a56f31c359d7cd9d8350612384121033e7dd580b2cd7ddf2644a1b353b45c0ce04f69be36fef65159e03f01f6685902"
                },
                "sequence": 4294967295,
                "txid": "c4b526df50f5ba66c73a2ee5b7c35d16a361abc171e2b92f18d8d3a25f215c21",
                "vout": 4
            }
        ],
        "vout": [
            {
                "n": 0,
                "scriptPubKey": {
                    "addresses": [
                        "bchtest:qzgs336xkt7cce27z43d8ctmhltevlhtny4asyv5vz"
                    ],
                    "asm": "OP_DUP OP_HASH160 9108c746b2fd8c655e1562d3e17bbfd7967eeb99 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a9149108c746b2fd8c655e1562d3e17bbfd7967eeb9988ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.00000546
            },
            {
                "n": 1,
                "scriptPubKey": {
                    "addresses": [
                        "bchtest:qzgs336xkt7cce27z43d8ctmhltevlhtny4asyv5vz"
                    ],
                    "asm": "OP_DUP OP_HASH160 9108c746b2fd8c655e1562d3e17bbfd7967eeb99 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a9149108c746b2fd8c655e1562d3e17bbfd7967eeb9988ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.00000546
            },
            {
                "n": 2,
                "scriptPubKey": {
                    "addresses": [
                        "bchtest:qzgs336xkt7cce27z43d8ctmhltevlhtny4asyv5vz"
                    ],
                    "asm": "OP_DUP OP_HASH160 9108c746b2fd8c655e1562d3e17bbfd7967eeb99 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a9149108c746b2fd8c655e1562d3e17bbfd7967eeb9988ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.00000546
            },
            {
                "n": 3,
                "scriptPubKey": {
                    "addresses": [
                        "bchtest:qpj0g03t0exjjztxvjp030rlm8m8mkkn7sx43c8s89"
                    ],
                    "asm": "OP_DUP OP_HASH160 64f43e2b7e4d2909666482f8bc7fd9f67ddad3f4 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a91464f43e2b7e4d2909666482f8bc7fd9f67ddad3f488ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.00000546
            },
            {
                "n": 4,
                "scriptPubKey": {
                    "addresses": [
                        "bchtest:qr69pdt4wmxmhzffly0q3s7h7gr5rdt02suq5rn8mr"
                    ],
                    "asm": "OP_DUP OP_HASH160 f450b57576cdbb8929f91e08c3d7f20741b56f54 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914f450b57576cdbb8929f91e08c3d7f20741b56f5488ac",
                    "reqSigs": 1,
                    "type": "pubkeyhash"
                },
                "value": 0.04875064
            }
        ]
    },
    "message": "OK"
}

查询CashAccount

GET https://api.ifwallet.com/open/cash/account

请求参数:

page 页码 如 1
limit 每页的条目数 如 10
name 要搜索的CashAccount名字 如 bibodeng@136.86

响应结果:

{
    "code": 0,
    "data": {
        "count": 1,
        "curr_page": 1,
        "data": [
            {
                "address": "bitcoincash:qrl6p8mhqxunk3e6c269yulscnlwwg9e4y37wrrjjf",
                "block": 563756,
                "full_name": "bibodeng#136.8689842343",
                "identicon": 127853,
                "name": "bibodeng",
                "txid": "4366f616a1427bfc13b2f0d6bb324633e661662c96cc7f9370dfd9c5f6ab1946"
            }
        ],
        "has_next": false,
        "total": 1,
        "total_page": 1
    },
    "message": "OK"
}
You can’t perform that action at this time.