-
Notifications
You must be signed in to change notification settings - Fork 45
常用的API详细说明
所有API可以通过节点自带的Swagger Client查询和使用,您可以打开浏览器输入 http://<全节点ip>:9922
使用Swagger,例如 http://test.v.systems:9922
。
调用方法:POST /vsys/broadcast/payment
发送字段编码
{
"timestamp": (类型:Number)时间戳,单位为纳秒
"amount": (类型:Number)交易数量,单位为最小单位,1 VSYS = 10^8 最小单位
"fee": (类型:Number)交易手续费,单位为最小单位,目前手续费均为固定值 0.1 VSYS
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"recipient": (类型:String)收款人的Base58地址
"senderPublicKey": (类型:String)发送者的Base58公钥
"attachment": (类型:String)发送的附件,Base58编码
"signature": (类型:String)发送者对此交易的Base58签名
}
发送例子
{
"timestamp": 1544083814291691000,
"amount": 100000000,
"fee": 10000000,
"feeScale": 100,
"senderPublicKey": "3orvgyRKf45FRyiCkcA3CzAGDvyEpBpXZzYGEGZnpZK5",
"attachment": "",
"recipient": "ATt6P4vSpBvBTHdV5V9PJEHMFp4msJ1fkkX",
"signature": "t1X2zmw5a2b9iaLgtsHyHKgEmKo6GCFuMFQsZNqj8ZkzpVbRKhWUttqUDfcjzcn5w7VgVVvf8cetr1mh2d2xypQ"
}
返回结果字段编码
{
"type": (类型:Number)交易类型ID,2 = 支付交易
"id": (类型:String)交易ID
"fee": (类型:Number)手续费,单位为最小单位
"timestamp": (类型:Number)时间戳,单位为纳秒
"proofs": (类型:Array of Object)交易签名及证明类型
"recipient": (类型:String)收款人的Base58地址
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"amount": (类型:Number)交易数量
"attachment": (类型:String)发送的附件,Base58编码
}
成功的返回结果例子
{
"type": 2,
"id": "EoNQyNouEKg8pDcEEPY2dJL9FMQx61YFk1Sn5EJN8H7K",
"fee": 10000000,
"timestamp": 1544083814291691000,
"proofs": [
{
"proofType": "Curve25519",
"address": "ATwi9fALjKTPfvSe7qJ2418huNd6SSYRuQu",
"publicKey": "3orvgyRKf45FRyiCkcA3CzAGDvyEpBpXZzYGEGZnpZK5",
"signature": "t1X2zmw5a2b9iaLgtsHyHKgEmKo6GCFuMFQsZNqj8ZkzpVbRKhWUttqUDfcjzcn5w7VgVVvf8cetr1mh2d2xypQ"
}
],
"recipient": "ATt6P4vSpBvBTHdV5V9PJEHMFp4msJ1fkkX",
"feeScale": 100,
"amount": 100000000,
"attachment": ""
}
出现错误的返回结果例子
{
"error": 102,
"message": "invalid address"
}
调用方法:GET /transactions/info/{id}
返回结果字段编码
{
"type": (类型:Number)交易类型ID,常见的有2 = 支付交易,3 = 租赁交易,4 = 取消租赁交易,5 = 铸币收益
"id": (类型:String)交易ID
"fee": (类型:Number)手续费,单位为最小单位
"timestamp": (类型:Number)时间戳,单位为纳秒
"proofs": (类型:Array of Object)交易签名及证明类型
"recipient":(类型:String)收款人的Base58地址
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"amount": (类型:Number)交易数量
"attachment": (类型:String)发送的附件,Base58编码
"status": (类型:String)交易结果,只有Success才是成功,其他均为失败
"feeCharged": (类型:Number)实际收取的手续费
"height": (类型:Number)交易所在区块高度
"leaseStatus": (类型:String)租赁状态
"leaseId": (类型:String)租赁的交易ID(交易类型为4的交易才有此项)
"lease": (类型:Object)租赁的交易详情(交易类型为4的交易才有此项)
}
成功的返回结果例子
{
"type": 2,
"id": "EhmLJA5H5LG8a69eQEpKtbPZf8KGMCSH5w4MPDMoaGR3",
"fee": 10000000,
"timestamp": 1562339456608000000,
"proofs": [
{
"proofType": "Curve25519",
"address": "ATwi9fALjKTPfvSe7qJ2418huNd6SSYRuQu",
"publicKey": "EaxkrqBySftSD7M9WJiBKxLPjugtjUqDCJK3Lf3aTq1E",
"signature": "4zxLLLpBmERW7zwTTyRamrQDgeQPSe2gwFwsUKoVtBvsPjz73n2fHFLBxAyYtJop3yrKs9LFiirNZ5VUDahD4ao7"
}
],
"recipient": "AU83FKKzTYCue5ZQPweCzJ68dQE4HtdMv5U",
"feeScale": 100,
"amount": 50000000,
"attachment": "",
"status": "Success",
"feeCharged": 10000000,
"height": 5414065
}
出现错误的返回结果例子
{
"status": "error",
"details": "Transaction is not in blockchain"
}
注:如果一笔交易已经从Unconfirmed transaction pool打包到区块中,通过此API可以得到确切的知道该笔交易所在区块高度。当节点同步高度高于该交易的所在高度31个区块之后,可确认该笔交易。
调用方法:GET /transactions/address/{address}/limit/{limit}
返回结果字段编码类型:Array of Array of Object,其中Object的编码为
{
"type": (类型:Number)交易类型ID,常见的有2 = 支付交易,3 = 租赁交易,4 = 取消租赁交易,5 = 铸币收益
"id": (类型:String)交易ID
"fee": (类型:Number)手续费,单位为最小单位
"timestamp": (类型:Number)时间戳,单位为纳秒
"proofs": (类型:Array of Object)交易签名及证明类型
"recipient":(类型:String)收款人的Base58地址
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"amount": (类型:Number)交易数量
"attachment": (类型:String)发送的附件,Base58编码
"status": (类型:String)交易结果,只有Success才是成功,其他均为失败
"feeCharged": (类型:Number)实际收取的手续费
"height": (类型:Number)交易所在区块高度
"leaseStatus": (类型:String)租赁状态
"leaseId": (类型:String)租赁的交易ID(交易类型为4的交易才有此项)
"lease": (类型:Object)租赁的交易详情(交易类型为4的交易才有此项)
}
成功的返回结果例子
[
[
{
"type": 2,
"id": "EoNQyNouEKg8pDcEEPY2dJL9FMQx61YFk1Sn5EJN8H7K",
"fee": 10000000,
"timestamp": 1544083814291691000,
"proofs": [
{
"proofType": "Curve25519",
"address": "ATwi9fALjKTPfvSe7qJ2418huNd6SSYRuQu",
"publicKey": "3orvgyRKf45FRyiCkcA3CzAGDvyEpBpXZzYGEGZnpZK5",
"signature": "t1X2zmw5a2b9iaLgtsHyHKgEmKo6GCFuMFQsZNqj8ZkzpVbRKhWUttqUDfcjzcn5w7VgVVvf8cetr1mh2d2xypQ"
}
],
"recipient": "ATt6P4vSpBvBTHdV5V9PJEHMFp4msJ1fkkX",
"feeScale": 100,
"amount": 100000000,
"attachment": "",
"status": "Success",
"feeCharged": 10000000
},
{
"type": 4,
"id": "FiMiErppddPfFCmehu1ziKNTqyzBFsLRj6gh9y45JKKD",
"fee": 10000000,
"timestamp": 1543569020372515800,
"proofs": [
{
"proofType": "Curve25519",
"publicKey": "B2Khd89jtnpuzGdnyGRcnKycZMBCo6PsotFcWWi1wMDV",
"signature": "2hpsVXZVs2Wmg5ixD8PqvMJoC3CAqgTqvapYkuFAxbLvoyXRu45q9HXZQyqCzHeiHocGFM8phPkmDuM566Xu59em"
}
],
"feeScale": 100,
"leaseId": "D8mGb2YSGyKr5Q3WATnpQP8JvyDdteXwieo5khwsTEyY",
"status": "Success",
"feeCharged": 10000000,
"lease": {
"type": 3,
"id": "D8mGb2YSGyKr5Q3WATnpQP8JvyDdteXwieo5khwsTEyY",
"fee": 10000000,
"timestamp": 1543569009108564000,
"proofs": [
{
"proofType": "Curve25519",
"publicKey": "B2Khd89jtnpuzGdnyGRcnKycZMBCo6PsotFcWWi1wMDV",
"signature": "8TDUgnkNbrPL6VMLFzDnhZvABfRqXitFX46mmvpohsdeRHKaNtWCs5C7m6avaUH2NjiFS7jGFov1CY5s3W8Zc5V"
}
],
"amount": 100000000,
"recipient": "AU6GsBinGPqW8zUuvmjgwpBNLfyyTU3p83Q",
"feeScale": 100
}
},
{
"type": 3,
"id": "D8mGb2YSGyKr5Q3WATnpQP8JvyDdteXwieo5khwsTEyY",
"fee": 10000000,
"timestamp": 1543569009108564000,
"proofs": [
{
"proofType": "Curve25519",
"publicKey": "B2Khd89jtnpuzGdnyGRcnKycZMBCo6PsotFcWWi1wMDV",
"signature": "8TDUgnkNbrPL6VMLFzDnhZvABfRqXitFX46mmvpohsdeRHKaNtWCs5C7m6avaUH2NjiFS7jGFov1CY5s3W8Zc5V"
}
],
"amount": 100000000,
"recipient": "AU6GsBinGPqW8zUuvmjgwpBNLfyyTU3p83Q",
"feeScale": 100,
"status": "Success",
"feeCharged": 10000000
}
]
]
出现错误的返回结果例子
{
"error": 102,
"message": "invalid address"
}
调用方法:POST /leasing/broadcast/lease
发送字段编码
{
"timestamp": (类型:Number)时间戳,单位为纳秒
"amount": (类型:Number)交易数量,单位为最小单位,1 VSYS = 10^8 最小单位
"fee": (类型:Number)交易手续费,单位为最小单位,目前手续费均为固定值 0.1 VSYS
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"recipient": (类型:String)收款人的Base58地址
"senderPublicKey": (类型:String)发送者的Base58公钥
"signature": (类型:String)发送者对此交易的Base58签名
}
发送例子
{
"timestamp": 1563963312897000000
"amount": 100000000,
"fee": 10000000,
"feeScale": 100,
"senderPublicKey": "DREQ2s3dQzaKTsvnmKWTnj59ptM1NzXwmap8jYVdPeLC",
"recipient": "ATt6P4vSpBvBTHdV5V9PJEHMFp4msJ1fkkX",
"signature": "54Z48cQ6XEtpmZaN1zXPiL4JqDCjRytc4UkYTHnH2bPZiKm3iyTVhkRacrAADb3jCP2sBQi4cxuZCxQnWYnvRao2"
}
返回结果字段编码
{
"type": (类型:Number)交易类型ID,3 = 租赁交易
"id": (类型:String)交易ID
"fee": (类型:Number)手续费,单位为最小单位
"timestamp": (类型:Number)时间戳,单位为纳秒
"proofs": (类型:Array of Object)交易签名及证明类型
"recipient": (类型:String)收款人的Base58地址
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"amount": (类型:Number)交易数量
}
成功的返回结果例子
{
"type": 3,
"id": "F1hy4f4GGJzgjZm4CB6cgRSWTFgTYjwfe8tmYL2sgXqE",
"fee": 10000000,
"timestamp": 1563963339028000000,
"proofs": [
{
"proofType": "Curve25519",
"address": "ATwi9fALjKTPfvSe7qJ2418huNd6SSYRuQu",
"publicKey": "DREQ2s3dQzaKTsvnmKWTnj59ptM1NzXwmap8jYVdPeLC",
"signature": "54Z48cQ6XEtpmZaN1zXPiL4JqDCjRytc4UkYTHnH2bPZiKm3iyTVhkRacrAADb3jCP2sBQi4cxuZCxQnWYnvRao2"
}
],
"amount": 100000000,
"recipient": "AU83FKKzTYCue5ZQPweCzJ68dQE4HtdMv5U",
"feeScale": 100,
"status": "Success",
"feeCharged": 10000000,
"height": 5950151
}
出现错误的返回结果例子
{
"error": 102,
"message": "invalid address"
}
调用方法:POST /leasing/broadcast/cancel
发送字段编码
{
"timestamp": (类型:Number)时间戳,单位为纳秒
"fee": (类型:Number)交易手续费,单位为最小单位,目前手续费均为固定值 0.1 VSYS
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
"txId": (类型:String)要取消的交易ID
"senderPublicKey": (类型:String)发送者的Base58公钥
"signature": (类型:String)发送者对此交易的Base58签名
}
发送例子
{
"senderPublicKey": "DREQ2s3dQzaKTsvnmKWTnj59ptM1NzXwmap8jYVdPeLC",
"txId": "AzutjAvyW47L4poTUvxZB1T9nmwyaKbGtZdjX4hDKNeN",
"timestamp": 1563963377829000000,
"signature": "t2GmqG5cYHDAHzwZsVoQ6oXnFyASdAFGjjRbc1QwHrz7k9SJHHUmNJLd2ExciR5p2hwncC6MoXs8FGVb28Jet51",
"fee": 10000000,
"feeScale": 100
}
返回结果字段编码
{
"type": (类型:Number)交易类型ID,4 = 取消租赁交易
"id": (类型:String)交易ID
"fee": (类型:Number)手续费,单位为最小单位
"timestamp": (类型:Number)时间戳,单位为纳秒
"proofs": (类型:Array of Object)交易签名及证明类型
"leaseId": (类型:String)此前租赁的交易ID
"feeScale": (类型:Number)手续费放大百分比,目前为固定值100
}
成功的返回结果例子
{
"type" : 4,
"id" : "8WFK8hfkogaJGzsmCpZp7NTWFGM8GupWbojz7kMHj9qb",
"fee" : 10000000,
"timestamp" : 1564395560154000000,
"proofs" : [ {
"proofType" : "Curve25519",
"address": "ATwi9fALjKTPfvSe7qJ2418huNd6SSYRuQu",
"publicKey" : "DREQ2s3dQzaKTsvnmKWTnj59ptM1NzXwmap8jYVdPeLC",
"signature" : "5mmqXKLdqhBayuvueoJJv39HiqyNZKVP9A6HUbox4fGGGxZmfG4GefPmuQ6NzN49b2TKDyo1T4XZgw6vY9AVg9Qt"
} ],
"feeScale" : 100,
"leaseId" : "GRNXBduX4goyePH8HyNRZZT4wyWTHoEVHPLJQ1p8Mn8V"
}
出现错误的返回结果例子
{
"error": 102,
"message": "invalid address"
}
调用方法: GET /blocks/height
返回结果字段编码
{
"height" (类型:Number)区块高度
}
返回结果例子
{
"height": 14554 //区块高度
}
调用方法: GET /blocks/at/{height}
返回结果字段编码
{
"version" (类型:Number)区块版本
"timestamp" (类型:Number)区块产生的时间
"reference" (类型:String)上一个区块的Base58签名
"SPOSConsensus" (类型:Object)共识机制
"resourcePricingData" (类型:Number)区块高度
"TransactionMerkleRoot":(类型:String)交易的根哈希的Base58值
"transactions": (类型:Array of Object)区块包含的交易
"generator": (类型:String)产生区块的Base58地址
"signature": (类型:String)区块的Base58签名,区块签名即区块ID
"fee": (类型:Number)生产区块的费用
"blocksize": (类型:Number)区块大小,单位Byte
"height": (类型:Number)区块高度
"transaction count": (类型:Number)区块内包含的交易个数
}
成功的返回结果例子
{
"version": 1,
"timestamp": 1543310672000509700,
"reference": "3Fb832ZiXQpbpWFn2aFwBqtyN4xKsfpmB4Zbj2tRJdtGsBhj8jiNJxjJJkHqGcfG7ycZCLFXjxodx9c7GmrbRg5X",
"SPOSConsensus": {
"mintTime": 1543310672000000000,
"mintBalance": 0
},
"resourcePricingData": {
"computation": 0,
"storage": 0,
"memory": 0,
"randomIO": 0,
"sequentialIO": 0
},
"TransactionMerkleRoot": "8Rfgrmwz9zV7ffCgqPkgViNjPnjyJxZWufCetgWprJUZ",
"transactions": [
{
"type": 5,
"id": "HfoEiQgV6YVPcCRFbVLsuT1EBE6uVD96vG3T6BUPA4mR",
"recipient": "ARCt4ovNZVZEP3RvB9txQZF923kxXXxuBzB",
"timestamp": 1543310672000509700,
"amount": 3600000000,
"currentBlockHeight": 500,
"status": "Success",
"feeCharged": 0
}
],
"generator": "AR9fDBBdQzeGmQY2ZikX2yUZMEMyjKEC5EW",
"signature": "3REE8WZCG2QedSot75rcGq78wsjcMbybLTgjvSLXKJHKtDshmpkUmFsVnzgrcHmo2ZBhSRa3zSsJm8GjPVCEVmSd",
"fee": 0,
"blocksize": 330,
"height": 500,
"transaction count": 1
}
出现错误的返回结果例子
{
"error": 301,
"message": "block does not exist"
}
调用方法:GET /addresses/balance/details/{address}
返回结果字段编码
{
'address': (类型:String)钱包的Base58地址
'regular': (类型:Number)钱包当前所持有币的余额
'available': (类型:Number)可用余额为持有余额减去租出金额的余额(可用余额 = 持有余额 - 租出金额)
'effective': (类型:Number)有效余额为持有余额减去租出金额加上租入金额(有效余额 = 持有余额 - 租出金额 + 租入金额)
'mintingAverage': (类型:Number)MAB值,计算币龄有关,用于竞选超级节点
'height': (类型:Number)此次查询是高度多少时的余额值,一般为当前节点最大高度
}
成功的返回结果例子
{
'address': 'AU8R9ri7eG968zuJuLQVLMiUzRNXvQwNPwE',
'regular': 109010000000,
'available': 108910000000,
'effective': 108910000000,
'mintingAverage': 108909964800,
'height': 643936
}
出现错误的返回结果例子
{
"error": 102,
"message": "invalid address"
}
Error ID | Message |
---|---|
1 | failed to parse json message |
2 | Provided API key is not correct |
10 | Too big sequences requested |
101 | invalid signature |
102 | invalid address |
103 | invalid seed |
104 | invalid amount |
105 | invalid fee |
106 | invalid sender |
107 | invalid recipient |
108 | invalid public key |
109 | argument is not a number |
110 | invalid message |
111 | invalid name |
112 | State check failed. Reason: XXXXX |
113 | overflow error |
114 | Transaction to yourself |
115 | no private key for sender address in wallet |
117 | invalid db key |
118 | The XXXX is not a valid utf8 string |
119 | Invalid Proof Bytes |
120 | Invalid Proof Length |
121 | Invalid Proof Type |
122 | Invalid Contract |
123 | Invalid DataEntry |
124 | Invalid DataEntry Length |
125 | Invalid Contract Address |
126 | Invalid Token Index |
301 | block does not exist |
401 | Contract is not in blockchain |
402 | Token is not in blockchain |
403 | contract XXXXX already disabled |
501 | nameSpace XXXXX is not valid |
502 | the entry for XXXXX does not exist for the nameSpace XXXXX |
503 | invalid database entry, this entry might be corruptted |
504 | invalid database datatype XXXX |
505 | The data is too long for database put. |