前言
由于小蚁NEO官方并没有提供根据钱包地址查询其所有交易记录的API,如果要自己实现的话比较麻烦,这里找到一个第三方的API,并对参数和返回值做一定说明
接口描述:
请求URL:
http://state-api.otcgo.cn/api/v1/mainnet/public/graphql?query
请求方式:
请求示例
http://state-api.otcgo.cn/api/v1/mainnet/public/graphql?query=
{TransactionQuery (skip:0, limit:9999,address: "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd" )
{count,rows
{ _id
txid
blockIndex
time
size
type
vin {
vout
txid
utxo {
address
value
asset
name
}
}
vout {
address
value
asset
n
name
}
nep5 {
to
from
symbol
value
operation
assetId
}
scripts {
invocation
verification
}
}
}
}
参数:
参数名 |
必选 |
类型 |
说明 |
skip |
是 |
string |
从第几条记录开始获取 |
limit |
是 |
string |
要获取的最大数 |
address |
是 |
string |
地址 |
全局资产返回示例
{
"data": {
"TransactionQuery": {
"count": 7,
"rows": [
{
"_id": "5b5ab3c394778f5539184e27",
"txid": "0x5d6776023499a89f37a4ecb64f10084ba61767d9e3bb89e75bbdd554ae0c7417",
"blockIndex": 2551243,
"time": 1532670878,
"size": 202,
"type": "ContractTransaction",
"vin": [
{
"vout": 0,
"txid": "0x8fe160aa784d2e7b4a69e896300c6b5549760e4286d935162bebc24e917e5f6c",
"utxo": {
"address": "AUW58h4SBZbJbarjD1BFkEUmgtCLjdWgKz",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
}
],
"vout": [
{
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 0,
"name": "小蚁股"
}
],
"nep5": null,
"scripts": [
{
"invocation": "40c42b921661434585a0da8c113776351f3309ceb36150fb49bb421e3ec7065d661d5e986e1c4bcdbd296f41086952008f178e9c2c4c3aa07e4494659ed25780f9",
"verification": "2103dc4622f4f3d22f897f2c10970122297f601ad0e4e6e114bc69924ef62638e94eac"
}
]
},
{
"_id": "5b5ab2b594778f5539184d52",
"txid": "0x7e9d1a4e57e6889ff5ca20f96bf654f6a958c2419d4f88dbbe5d06b5a6d9d42d",
"blockIndex": 2551231,
"time": 1532670602,
"size": 203,
"type": "ClaimTransaction",
"vin": [],
"vout": [
{
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "0.00079362",
"asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
"n": 0,
"name": "小蚁币"
}
],
"nep5": null,
"scripts": [
{
"invocation": "4094f885a279522e9a4ebf4ab32cf1736ad30689b7cb4a5ccea6a961727454bd05d883e73d5b18eebc169f9ad227c676776b736ced9d2c902d73cecdd98331f0fc",
"verification": "21023a838e342930e79178915ff9a08194fa1a305411c95ddf99e5eab541a2066c23ac"
}
]
},
{
"_id": "5b5ab1c594778f5539184cae",
"txid": "0x8fe160aa784d2e7b4a69e896300c6b5549760e4286d935162bebc24e917e5f6c",
"blockIndex": 2551221,
"time": 1532670371,
"size": 202,
"type": "ContractTransaction",
"vin": [
{
"vout": 0,
"txid": "0x589a0a1972f2a521373b660ea7fbcd290dcba24da5afa2382db49c2e12901955",
"utxo": {
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
}
],
"vout": [
{
"address": "AUW58h4SBZbJbarjD1BFkEUmgtCLjdWgKz",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 0,
"name": "小蚁股"
}
],
"nep5": null,
"scripts": [
{
"invocation": "404a37ec0374868e66560d4cd753494af603cddae9d20b7eee247535dbca832120c12235b8296c6c3b38e6818c26b84bae1b96dbad7608cdbf0c817cb5646a40dc",
"verification": "21023a838e342930e79178915ff9a08194fa1a305411c95ddf99e5eab541a2066c23ac"
}
]
},
{
"_id": "5b59d03a94778f05149319e8",
"txid": "0x552463a94c39e31481fe15825f6e2f547fad34e3c588e3196abfa29b9ec3fe38",
"blockIndex": 2540073,
"time": 1532420254,
"size": 339,
"type": "ClaimTransaction",
"vin": [],
"vout": [
{
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "0.00028518",
"asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
"n": 0,
"name": "小蚁币"
}
],
"nep5": null,
"scripts": [
{
"invocation": "40032e16698f9e7e7996b5579568f149fc4c8b40c6a0b30481bf18be64ed89e8b82958293498068924b6465a29fc61237c6794913f51ababe7b371a9044fe3e384",
"verification": "21023a838e342930e79178915ff9a08194fa1a305411c95ddf99e5eab541a2066c23ac"
},
{
"invocation": "4024cecbb97956b403eb1adf233f86dc4b2e53b249074b598dceb1160f7225918acf2862cbeb71da4de370e9098c4acdd3f7b1771aa975e88ac22631e5247627e7",
"verification": "210318e86027f0b2000c21ce76ffe9b14a198927da1ad3bdf5050cd836366d067707ac"
}
]
},
{
"_id": "5b59d02e94778f0514931750",
"txid": "0x589a0a1972f2a521373b660ea7fbcd290dcba24da5afa2382db49c2e12901955",
"blockIndex": 2540025,
"time": 1532419150,
"size": 202,
"type": "ContractTransaction",
"vin": [
{
"vout": 0,
"txid": "0xb7d569d1b3e0547487cd06ce49e4b2d0948b2891d50127895571715ba7290cd2",
"utxo": {
"address": "ANhhpU7JWrw77iPUJXe9bVGb1CDNxyyEsZ",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
}
],
"vout": [
{
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 0,
"name": "小蚁股"
}
],
"nep5": null,
"scripts": [
{
"invocation": "40a5f1868b9ab7bc2e8cfe5da7ef56825ef2190d45ec5b4f218aa4d8b8d5f4b40042b84ea56d6f48023dc8aeb1ccbb4bbc0ff5240cfd4d97c6830464552b171a9b",
"verification": "210318e86027f0b2000c21ce76ffe9b14a198927da1ad3bdf5050cd836366d067707ac"
}
]
},
{
"_id": "5b59d02c94778f05149316dc",
"txid": "0xb7d569d1b3e0547487cd06ce49e4b2d0948b2891d50127895571715ba7290cd2",
"blockIndex": 2540014,
"time": 1532418892,
"size": 202,
"type": "ContractTransaction",
"vin": [
{
"vout": 2,
"txid": "0x7fcc6edbc5f05a1238eec983f961804bb82194f671fabd5ddbb15dc1ccfac1fa",
"utxo": {
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
}
],
"vout": [
{
"address": "ANhhpU7JWrw77iPUJXe9bVGb1CDNxyyEsZ",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 0,
"name": "小蚁股"
}
],
"nep5": null,
"scripts": [
{
"invocation": "4022c33ef9c2ba17525221b262a8a61c967bb4c836f2a7b90f7f9d84949f9962ec9dea44b32a8dd2a9f3b6969fd02d844eede33157069bfb5cb65d33fd4cbda498",
"verification": "21023a838e342930e79178915ff9a08194fa1a305411c95ddf99e5eab541a2066c23ac"
}
]
},
{
"_id": "5b59d04d94778f05169464c5",
"txid": "0x7fcc6edbc5f05a1238eec983f961804bb82194f671fabd5ddbb15dc1ccfac1fa",
"blockIndex": 2535951,
"time": 1532317165,
"size": 688,
"type": "ContractTransaction",
"vin": [
{
"vout": 0,
"txid": "0x5c65613155772ef863d25e043735fa5d84f9787e1b4c8360ba29f9d014146c8a",
"utxo": {
"address": "APbnSf5ZBR9XqXPBorBXSp8Hcd56M3yxHs",
"value": "14",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
},
{
"vout": 3,
"txid": "0x66ea59c195ddca702ed7ace79427fbdc33bb5d4c613571f63400131eee7678bd",
"utxo": {
"address": "ASGx4h9oiei6xUAL7N4F5iMbQ29foeuFp9",
"value": "2",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
},
{
"vout": 3,
"txid": "0x91613db6ad3fb113ab0b52123d37f24e6325849ff62c9f6ff4eb538d3dbb3222",
"utxo": {
"address": "AKxVv9ti4na6SJdPg9SWttJLE1Web869fS",
"value": "1787",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
},
{
"vout": 0,
"txid": "0xd160d17c353994c5fcf8f708da2d9ab0a1a3e665d17844bf909fedcdc200da54",
"utxo": {
"address": "ASGx4h9oiei6xUAL7N4F5iMbQ29foeuFp9",
"value": "3",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"name": "小蚁股"
}
}
],
"vout": [
{
"address": "AcYdvbnL7BiiwysVatcXGTnNJEZTpp16jn",
"value": "21",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 0,
"name": "小蚁股"
},
{
"address": "AK8Y94pk6zLaXFtqUjFDqptyxq22WkPkkd",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 1,
"name": "小蚁股"
},
{
"address": "AU1APqhqevYFqAYWwSopd4XUB8UJk1gjPd",
"value": "1",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 2,
"name": "小蚁股"
},
{
"address": "AKxVv9ti4na6SJdPg9SWttJLE1Web869fS",
"value": "1783",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"n": 3,
"name": "小蚁股"
}
],
"nep5": null,
"scripts": [
{
"invocation": "40fe21088456ecc02553005e30d3a356ad5e3e361f7ba18f22fe4b97b7ce2e65399f7a28599927aacec6788eba4c8e42d2b10f7b91c77128c4cd0bd607cc6d0ffe",
"verification": "2103c40ca94507b2a357d540d8634f77e8cbd3145234c80b990585c35e2aa745b6b3ac"
},
{
"invocation": "402836ac10b0e32864fdb9e50b6682422f9b4589d8d270024c3824f3557993ff1475fe0b485ddc097226a04a113698505a7d25cedc240ad3dce8f0a29f1f2c80c6",
"verification": "21027c0a815027b73b371347c38b391a0f0f1815a79680185854e771346e76ac902fac"
},
{
"invocation": "406b3d0dfca227a0284afc4ce01648a813882ded0561cae1b1d9612f48db6af266ff2fbe2394e9dd6e1ba9f5d49959a9a099cfe14ac6a6ac81042e4e2ba6fb2da0",
"verification": "2103f8bbea2a727ff55c37ff476c06dbd240e316868488e294b9572a3e7551164b76ac"
}
]
}
]
}
},
"code": 200,
"status": "OK",
"server_time": "2018-08-09T06:00:48.613Z"
}
全局资产返回关键参数说明
参数名 |
类型 |
说明 |
count |
int |
总交易记录数量 |
rows |
array |
交易记录数组 |
txid |
string |
交易hash |
blockIndex |
int |
区块高度 |
time |
int |
时间戳 |
size |
bytes |
交易大小 |
type |
string |
交易类型。全局资产类型(neo,gas,token,share)的type为ContractTransaction,合约资产类型(NEP-5)的type为InvocationTransaction |
vin/txid |
string |
前一笔输入交易id |
vin/utxo/address |
string |
转出地址 |
vin/utxo/value |
string |
转出金额 |
vin/utxo/asset |
string |
资产id |
vin/utxo/name |
string |
资产名称 |
vout/address |
string |
转入地址 |
vout/value |
string |
转入金额 |
vout/asset |
string |
资产id |
vout/n |
int |
序号 |
vout/n/name |
string |
资产名称 |
invocation |
string |
合约脚本 |
verification |
string |
验证脚本 |
合约资产返回及关键参数说明
{
"_id": "5b59c42e94778f0512908454",
"txid": "0x0bec4cdab06cd3fd9b7641525096a030465a5d8341d7aa97a6c52bdabdff21bf",
"blockIndex": 2457808,
"time": 1530513074,
"size": 207,
"type": "InvocationTransaction",
"vin": [],
"vout": [],
"nep5": [
{
"to": "ALEsEVFKAaq3XQEy9UwM5Wz3ZAnoNYq29m",
"from": "AZroG6GpphomjZC2kdSHYL7dSkzVgDiaGa",
"symbol": "NNC",
"value": "152.5",
"operation": "transfer",
"assetId": "0xfc732edee1efdf968c23c20a9628eaa5a6ccb934"
}
],
"scripts": [
{
"invocation": "40e31bd314e5dd96faa31247a4d01442f8c7d7efafed96049aab8e1ef8695719153b78dad51943abe8ef0d04882891794d6dec8bdda9f83d297b7de8df26d0a594",
"verification": "2102964c1991a3582d1dec6a13a048b1289f2c3bd6a190c58108a46c07f79ae2afccac"
}
]
},
参数名 |
类型 |
说明 |
to |
string |
转入地址 |
from |
string |
转出地址 |
symbol |
string |
资产标识 |
value |
string |
金额 |
operation |
string |
类型 |
assetId |
string |
资产ID |
原创文章,转载请注明出处
网友评论