-
Notifications
You must be signed in to change notification settings - Fork 15
NEO
Oleg Baturov edited this page Jul 9, 2018
·
51 revisions
neo-vcoin apis
api prefix: '/api/v1'
Get server working status
Get db working status
Get rpc working status
get latest blocks from offset, count
get transactions by offset, count, order, contract
get block by hash or height
get block details by hash or height
get transaction by txid
get transaction details by txid
get address related transactions
search
Get the balance of the address
Get UTXO of the address
Send raw transaction
GET /monitor
- for successed case
{ status: 200, msg: "success", data: "Server is working now !" }
- for failed case
status: 400
{ status: 400, msg: 'errors', data: err }
GET /monitor/db
- for successed case
{ status: 200, msg: "success", data: "Db is working now !" }
- for failed case
status: 400
{ status: 400, msg: 'errors', data: err }
GET /monitor/rpc
- for successed case
{ status: 200, msg: "sccuess", data: protocolVersion }
- for failed case
status: 400
{ status: 400, msg: 'errors', data: err }
- get latest blocks from offset, count
GET /blocks
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
offset | Number | NO | 0 | offset |
count | Number | NO | 10 | block count |
* @return
* { status: 200, msg: 'success', data: { total, result: [block] } }
block = {
"hash": "0xd749cffddcf33a5302c2b675ebba305a9534584e91d9f05c639563fc31272c6e",
"size": 686,
"version": 0,
"previousblockhash": "0x0ea28647d7a89f04ac82c5b48be39955a1f040e06a313b510a9aab37970480c5",
"merkleroot": "0xdda503afb71e64d940cfd2c00995a72503ce901b13760752306d854ed58d9d1b",
"time": 1479227992,
"index": 127927,
"nonce": "19385d2ada9b3096",
"nextconsensus": "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR",
"script": {
"invocation": "403fc6abeb11da17f6b5dd24b5204e5f13e78fee01c658edfefa52bf5095fd1270b0124b2efac72512c4754d7fd54e3feca913ee88fcd530b769e63563fb3a081a40e3b56e3161c4136caaa8e6057ca89bef55615df4ba71d4f72568e9df7aeec6518161362d2f5634a10bca6bb0a48cffc76355a920d0c3228465ef070025fd065640694dc65aa45efbfd0f83ce64314b9e515273c8f69db3bf58eecbc7d796bbb0249f040f8df5a085d72d0fb3df1755ba1cc1f2043343e4c1f0e3fe7f65a989ee784041e59254b31b4a0833878a31ea73491a415273085386a7a065e73cc3123b083e2afb4c62b60108c87e92f967c2f528af2f0e0012f3ba0d8d41dd3381aa79f859406fc02bc4712fe4c5431594036e32a534151f3ef1dc0e55e7ea886fe10f89dacf788a340ee6718add1158ab64b086df6e3448112951d80d5740cb97a7d2599e8c",
"verification": "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae"
},
"tx": [transaction],
"confirmations": 3,
"nextblockhash": "0x2697dad3a4b6641600c7c975986152da14df272acb6f1c82a2360a82401fff32"
}
*/
- get transactions by offset, count, order, contract
GET /transactions
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
offset | Number | NO | 0 | offset |
count | Number | NO | 10 | transaction count |
order | Number | NO | 0 | 0 => newest first, 1 => oldest first |
contract | String | NO | undefined | contract address. undefined => all transactions |
* @return
* { "status": "200", "msg": "success",
* "data": { total, result: [txdetails] }
* }
*/
- get block by hash or height
GET /block/:hash
* @return
* { "status": "200", "msg": "success", "data": block }
- get block details by hash or height
GET /blockdetails/:hash
* return
* { "status": "200", "msg": "success", "data": blockdetails }
blockdetails = block & txdetails
- get transaction by txid
GET /tx/:txid
* return
* { "status": "200", "msg": "success", "data": transaction }
- get transaction details by txid
GET /txdetails/:txid
* return
* { "status": "200", "msg": "success", "data": txdetails }
txdetails = {
"txid": "0x4d072dd2c362f84edebb637b3d2085fab3d31e31f85c4b3ae29236163502512f",
"size": 296,
"type": "ContractTransaction",
"version": 0,
"attributes": [],
"vin": [
{
"txid": "0x5dcb045017f2cce0403747d153d616113e30cd7a02e4e29f9a0babac23e4b582",
"vout": 0,
"address": {
"n": 0,
"asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
"value": "28.54029216",
"address": "AK3tAKzmKvjeDeLx33SfKh1VZxgR6Vf7dp"
}
},...
],
"vout": [
{
"n": 0,
"asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
"value": "36",
"address": "AQBnkfJmP2NrYMB8UxVgW5sMfZjE3SVPdf"
},...
],
"sys_fee": "0",
"net_fee": "0",
"scripts": [
{
"invocation": "40e5459f25b2f6f627562673f79df7fcd43380d5ecd61ed88e2003eb5e688c48bb2958acaa0a7cfdd21ddaacca5ab36c7b6bc7959c151e3424be9e4169bc3eb4dc",
"verification": "21039453ace186f4662574dd95ebdd26fd7df4f42218266928a7612290343bb5f560ac"
}
],
"blockhash": "0x41ffc368fd33e512263f5f32e3b22c1d57affd2866a32c1ca3480ce06aca13bc",
"confirmations": 254241,
"blocktime": 1479737124
}
- get address related transactions
GET /address/txs/:address
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
asset | String | NO | undefined | address asset |
offset | Number | NO | 0 | offset |
count | Number | NO | 10 | transaction count |
order | Number | NO | 0 | 0 => newest first, 1 => oldest first |
return: { status: 200, msg: 'success', data: { total, result: [txdetails] } }
- Get the balance of the address.
GET /balance/:address
return
{
"status": 200,
"msg": "success",
"data": {
"address": "AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i",
"balance": [
{
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"value": 300000000,
"token": {
"_id": "5b2301673671a3283000f1aa",
"name": "NEO",
"ticker": "NEO",
"asset": "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
"type": "GoverningToken",
"__v": 0
},
"ticker": "NEO"
}
],
"n_tx": 4
}
}
- Search
GET /search/:key
key param can be txid or blockNo, blockHash, address.
{ status: 200, msg: 'sccuess', data: { type } }
type = 'block'
type = 'transaction'
type = 'address'
- Get UTXO of the address
GET /address/utxo/:address
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
address | String | YES | undefined | address |
return: { status: 200, msg: 'success', data: [utxo_item] }
utxo_item = {
txid: String,
index: Number,
value: Number,
asset: String,
createdAtBlock: Number,
}
- Send raw transaction
POST /sendrawtransaction
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
hex | String | YES | undefined | raw transaction hex value |
return: { status: 200, msg: 'success', data: result }