# Blockmeta API
# Use case
Base URL:bcapi.movapi.com/blockmeta/bytom2/v1
Curl -X GET http://bcapi.movapi.com/blockmeta/bytom2/v1/block?height=100
# Custom error code
error code | error message | error description |
---|---|---|
10000 | 'server inner error' | server error |
20001 | 'request param is not valid' | wrong parameter(type or length) |
20002 | 'request param is null' | lack of parameter |
30001 | 'block hash is not correct' | wrong block hash |
30002 | 'block height is not correct' | wrong block height |
30003 | 'transaction hash is not correct' | wrong tx hash |
30004 | 'asset id is not correct' | wrong asset id |
30005 | 'timestamp is not correct' | wrong timestamp |
# API
Search
Block
Block-headers
Transaction
Transactions
Address
Forbes
Assets
Asset
Daily
Vote-transaction
# Search
GET /search
Query whether the parameter is in the database and obtain the data type (address / block height / transaction hash / block hash)
# Request
String
- data, the parameters to be queried
# Response
Integer
- code, status codeString
- msg, error messageString
- type, data type,including[transaction,block,address]
# Example
Curl -X GET /search?data=c335a393db951760acb8a74c739e0e4c860598d64421bfc563ce6d367c822122
{
"code": 200,
"msg": "",
"data": {
"type": "transaction"
}
}
# Block
GET /block
Query block information by block height or block hash
# Request
The request parameter cannot be empty
String
- hash, block hashInteger
- height, block height
# Response
Integer
- code, status codeString
- msg, error messageObject
- header, block header informationString
- hash, block hashInteger
- height, block heightString
- previous_block_hash, previous block hashString
- merkle_root, merkle rootinteger
- size,block sizeinteger
- timestamp, the timestamp of block generationinteger
- transaction_count, the amount of transaction contain in this block
Object
- validator, the generator of this blockString
- pub_key, public keyString
- validator_name, generator Chinese nameString
- validator_name_english, generator English name
Array of Object
- transactions, the list of transaction contain in this blockString
- hash, transaction hashString
- fee, transaction feeInteger
- size, transaction sizeArray of String
-tx_types,transaction type["ordinary","coinbase","issuance","vote","veto", "cross_chain","chain_tx"]Array of Object
- inputs, input informationString
-type, input type['spend', 'issue', 'coinbase','veto']String
- amount, the amount of input assetString
- program, control_programObject
-* decoded_program*, decoded control_programString
- address, account address, only exits when the type is 'spend'Object
- asset, input asset informationString
- id, asset idString
- symbol, asset symbol
Array of Object
- outputs, output informationString
- type, output type["ordinary", "vote","retire"]String
- address, the receiver addressString
- amount, the amount of output assetString
- program, control_programObject
- decoded_program, decoded control_programObject
- asset, output asset informationString
- id, asset idString
- symbol, asset symbol
# Example
Curl -X GET /block?height=100
{
"code": 200,
"msg": "",
"data": {
"header": {
"hash": "c7bfc4f264c183bf67518496dad1860f83aced4bbb69d0d5483e4c5c6c5d4289",
"height": 100,
"previous_block_hash": "b376ad51d35e81c65f333e9a3e45520ee9da30b3384aaf113f0ad9ff1b187666",
"merkle_root": "c47d425b3e2c04d19050ef98cf994a2402e915dacd420e64439a1d39a8cc4be4",
"size": 652,
"timestamp": 1629425448,
"transaction_count": 1,
"validator": {
"pub_key": "1313379b05c38ff2d171d512f23f199f0f068a67d77b9d5b6db040f2da1edc0c35c68a21b068956f448fed6441b9c27294f1ca6aaedc2c580de322f3f0260c1f",
"name_zh": "创世节点",
"name_en": "Genesis node"
}
},
"transactions": [
{
"hash": "54f48bcc033886bc28fd7cfe2a15d3b82690280726c40ddc12045f86bcd3d08b",
"fee": "0.0000000000",
"size": 152,
"tx_types": [
"coinbase"
],
"inputs": [
{
"type": "coinbase",
"amount": "0.0000000000",
"program": "",
"decoded_program": "",
"address": "smart contract",
"asset": {
"id": "0000000000000000000000000000000000000000000000000000000000000000",
"symbol": ""
}
}
],
"outputs": [
{
"type": "ordinary",
"amount": "0.0000000000",
"program": "00147979dd397652cc9e02e6f361614a645ea0f79cfc",
"decoded_program": "DUP \nHASH160 \nDATA_20 7979dd397652cc9e02e6f361614a645ea0f79cfc\nEQUALVERIFY \nTXSIGHASH \nSWAP \nCHECKSIG \n",
"address": "bn1q09ua6wtk2txfuqhx7dskzjnyt6s0088ulmsrpr",
"asset": {
"id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"symbol": "BTM"
}
}
]
}
]
}
}
# Block-headers
GET /block-headers
Query the block headers, using paging mechanism
# Request
Integer
- start, paging start positionInteger
- limit, data amount per page
# Response
Integer
- code, status codeString
- msg, error messageArray
- object, block header arrayString
- hash, block hashInteger
- height, block heightString
- previous_block_hash, previous block hashString
- merkle_root, merkle rootInteger
- size, block sizeInteger
- timestamp, the timestamp of block generationInteger
- transaction_count, the transaction amount contain in this blockObject
- validator, the generator of this blockString
- pub_key, public keyString
- validator_name, generator Chinese nameString
- validator_name_english, generator English name
# Example
Curl -X GET /block-headers?/blocks?start=10&limit=2
{
"code": 200,
"msg": "",
"data": [
{
"hash": "2f5bfa3a2b6f6b917c0b81d938a012563bfa1d26bd2709f2314864e55dad9b78",
"height": 54705,
"previous_block_hash": "7f36f3855102d427074f8679b8ce506b82cb086d1bdfda1ddd55a2f429f855e3",
"merkle_root": "e7ec1b0cf151c8e97ae696d744bbe3e4d69af5d424eb2841f17b3f3d4226d0af",
"size": 446,
"timestamp": 1629798444,
"transaction_count": 1,
"validator": {
"pub_key": "380d8820818167c67b8e677062e6d6daf6302583b7e205f1eaa2e3446c777aab1d0fc48b101cc2a081e6cbf361d78016596c241d5e69eca09176ce05c1bf397b",
"name_zh": "Bytom海外社区",
"name_en": "Bytom-Community"
}
},
{
"hash": "7f36f3855102d427074f8679b8ce506b82cb086d1bdfda1ddd55a2f429f855e3",
"height": 54704,
"previous_block_hash": "1c62b0deda7d7dfb80407f21bc850ec696f3c0e44d4e9cbbafb58d924510d21d",
"merkle_root": "73c259ec9b04ddda4dc624ec6d58690284d82f83c356412daf89231f459399f4",
"size": 446,
"timestamp": 1629798438,
"transaction_count": 1,
"validator": {
"pub_key": "1ab83450661e1de973e7be2a8a4ba7d4634996f327a6c59b10d59bfd96df6dc5d7afd5b287b1ad96809d89b915ef7002143a33dd06872376927fff589046ec0d",
"name_zh": "链节点",
"name_en": "ChainNode"
}
}
],
"pagination": {
"start": 0,
"limit": 2,
"total": 54706,
"_links": {
"next": "/blockmeta/bytom2/v1/block-headers?limit=2&start=2"
}
}
}
# Transaction
GET /transaction
Query transaction by transaction ID
# Request
String
- hash, transaction ID
# Response
Integer
- code, status codeString
- msg, error messageObject
- data, block informationString
- hash, transaction hashInteger
- block_height, block heightInteger
- block_hash, block hashString
- fee, transaction feeinteger
- size,transaction sizeinteger
- timestamp, the timestamp of transaction generationArray of String
-tx_types,transaction type["ordinary","coinbase","issuance","vote","veto", "cross_chain","chain_tx"]Array of Object
- inputs, input informationString
-type, input type['spend', 'issue', 'coinbase','veto']String
- amount, the amount of input assetString
- program, control_programObject
-* decoded_program*, decoded control_programString
- address, account address, only exits when the type is 'spend'Object
- asset, input asset informationString
- id, asset idString
- symbol, asset symbol
Array of Object
- outputs, output informationString
- type, output type["ordinary", "vote","retire"]String
- address, the receiver addressString
- amount, the amount of output assetString
- program, control_programObject
- decoded_program, decoded control_programObject
- asset, output asset informationString
- id, asset idString
- symbol, asset symbol
# Example
Curl -X GET /transaction?hash=19e7fc0bf5d8a2c9c1ec663b948d9be4ceb573d2f4922452febc25cac7d3c23d
{
"code": 200,
"msg": "",
"data": {
"hash": "19e7fc0bf5d8a2c9c1ec663b948d9be4ceb573d2f4922452febc25cac7d3c23d",
"fee": "0.0000000000",
"size": 156,
"block_height": 54949,
"block_hash": "f9068faced79a08545ff2abe0584e068c5f30275050cb81582f1eca196dda807",
"timestamp": 1629799908,
"tx_types": [
"coinbase"
],
"inputs": [
{
"type": "coinbase",
"amount": "0.0000000000",
"program": "",
"decoded_program": "",
"address": "smart contract",
"asset": {
"id": "0000000000000000000000000000000000000000000000000000000000000000",
"symbol": ""
}
}
],
"outputs": [
{
"type": "ordinary",
"amount": "0.0000000000",
"program": "0014978f30da1cd774799f7a4229b14dfdb5e6baffe7",
"decoded_program": "DUP \nHASH160 \nDATA_20 978f30da1cd774799f7a4229b14dfdb5e6baffe7\nEQUALVERIFY \nTXSIGHASH \nSWAP \nCHECKSIG \n",
"address": "bn1qj78npksu6a68n8m6gg5mzn0akhnt4ll8hln2cn",
"asset": {
"id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"symbol": "BTM"
}
}
]
}
}
# Transactions
GET /transactions
Query a group of transaction by query parameters
# Request
String
- address, query the transactions by the specified addressString
- asset, query the transactions by the specified assetString
- type, query the transactions by the specified transaction type // vote、cross_chainInteger
- start, paging start positionInteger
- limit, data amount per page
# Response
Integer
- code, status codeString
- msg, error messageArray of Object
- data, transaction listString
- hash, transaction hashInteger
- block_height, block heightInteger
- block_hash, block hashString
- fee, transaction feeinteger
- size,transaction sizeinteger
- timestamp, the timestamp of transaction generationArray of String
-tx_types,transaction type["ordinary","coinbase","issuance","vote","veto", "cross_chain","chain_tx"]Array of Object
- inputs, input informationString
-type, input type['spend', 'issue', 'coinbase','veto']String
- amount, the amount of input assetString
- program, control_programObject
-* decoded_program*, decoded control_programString
- address, account address, only exits when the type is 'spend'Object
- asset, input asset informationString
- id, asset idString
- symbol, asset symbol
Array of Object
- outputs, output informationString
- type, output type["ordinary", "vote","retire"]String
- address, the receiver addressString
- amount, the amount of output assetString
- program, control_programObject
- decoded_program, decoded control_programObject
- asset, output asset informationString
- id, asset idString
- symbol, asset symbol
Object
- pagination, paging informationInteger
- start, paging start positionInteger
- limit, data amount per pageInteger
- total, total transaction amountObject
- _links, paging linkString
- next, next paging linkString
- prev, previous paging link
# Example
Curl -X GET /transactions?block_height=100&start=1&limit=1
{
"code": 200,
"msg": "",
"data": [
{
"hash": "8fb8802b4777d78aad9a1067a0e44badc83a6d78737c7cfef9197e2e4dc3901a",
"fee": "0.0000000000",
"size": 156,
"block_height": 55113,
"block_hash": "ebe54bd2e2f253dbd91483b0d880a4c4a7e063a7ee60bb3de0cee7a3904caabe",
"timestamp": 1629800892,
"tx_types": [
"coinbase"
],
"inputs": [
{
"type": "coinbase",
"amount": "0.0000000000",
"program": "",
"decoded_program": "",
"address": "smart contract",
"asset": {
"id": "0000000000000000000000000000000000000000000000000000000000000000",
"symbol": ""
}
}
],
"outputs": [
{
"type": "ordinary",
"amount": "0.0000000000",
"program": "0014eddab573568136a66b0ab7345dee57bb204616b7",
"decoded_program": "DUP \nHASH160 \nDATA_20 eddab573568136a66b0ab7345dee57bb204616b7\nEQUALVERIFY \nTXSIGHASH \nSWAP \nCHECKSIG \n",
"address": "bn1qahdt2u6ksym2v6c2ku69mmjhhvsyv94hwr8evp",
"asset": {
"id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"symbol": "BTM"
}
}
]
}
],
"pagination": {
"start": 1,
"limit": 1,
"total": 57564,
"_links": {
"next": "/blockmeta/bytom2/v1/transactions?limit=1&start=2",
"prev": "/blockmeta/bytom2/v1/transactions?limit=1&start=0"
}
}
}
# Address
GET /address
Query the asset information related to the specified address
# Request
String
- address, the specified address,required
# Response
Integer
- code, status codeString
- msg, error messageArray of Object
- data, address informationObject
- asset, asset informationString
- id, asset idString
- symbol, asset symbol
String
- address, addressString
- balance, balanceString
- total_received, the total received asset amoutString
- total_sent, the total sent asset amout
# Example
Curl -X GET /address?address=bn1qj78npksu6a68n8m6gg5mzn0akhnt4ll8hln2cn
{
"code": 200,
"msg": "",
"data": [
{
"asset": {
"id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"symbol": "BTM"
},
"address": "bn1qj78npksu6a68n8m6gg5mzn0akhnt4ll8hln2cn",
"balance": "4092.7782370400",
"total_received": "10495.0772679500",
"total_sent": "6402.2990309100"
}
]
}
# Forbes
GET /forbes
Query all owners of an asset and sort by balance
# Request
String
- asset, specified assets ID,RequiredInteger
- start, paging start positionInteger
- limit, data amount per page
# Response
Integer
- code, status codeString
- msg, error messageArray of Object
- data, asset owner listObject
- asset, asset informationString
- id, asset idString
- symbol, asset symbol
String
- address, owner addressString
- balance, balanceString
- total_received, the total received asset amoutString
- total_sent, the total sent asset amout
Object
- pagination, paging informationInteger
- start, paging start positionInteger
- limit, data amount per pageInteger
- total, total transaction amountObject
- _links, paging linkString
- next, next paging linkString
- prev, previous paging link
# Example
Curl -X GET /forbes?asset=47fcd4d7c22d1d38931a6cd7767156babbd5f05bbbb3f7d3900635b56eb1b67e
{
"code": 200,
"msg": "",
"data": [
{
"asset": {
"id": "47fcd4d7c22d1d38931a6cd7767156babbd5f05bbbb3f7d3900635b56eb1b67e",
"symbol": "SUP"
},
"address": "bn1qr5q0sh3zpc66yv5zelrlj8l8kd9ldhqc642epn",
"balance": "87839.3193166200",
"total_received": "87888.9028510100",
"total_sent": "49.5835343900"
},
{
"asset": {
"id": "47fcd4d7c22d1d38931a6cd7767156babbd5f05bbbb3f7d3900635b56eb1b67e",
"symbol": "SUP"
},
"address": "bn1qcj7dzpjlnsg7pf24nj6pduar9dc24uxe7ue4y3",
"balance": "334.6012919800",
"total_received": "334.6012919800",
"total_sent": "0.0000000000"
}
],
"pagination": {
"start": 0,
"limit": 10,
"total": 175,
"_links": {
"next": "/blockmeta/bytom2/v1/forbes?limit=10&start=10"
}
}
}
# Assets
GET /assets
Query all the assets in the Bytom blockchain
# Request
Integer
- start, paging start positionInteger
- limit, data amount per page
# Response
Integer
- code, status codeString
- msg, error messageArray of Object
- assets, asset listString
- total_supply, total supplyInteger
- decimals, numerical accuracyString
- name, asset nameString
- symbol, asset symbolString
- asset, asset idInteger
- issue_timestamp, first issue timeString
- program, issue programBool
- is_bap_2, whether a bap-2 assetObject
- definition asset definitionObject
- description asset descriptionString
- logo, asset's logoInteger
- quorum, asset signatures amountBool
- reissue, whether the asset support additional issuance
Object
- external (omit)Integer
- address_count, the owner number of assetInteger
- tx_count, the transacton amount of asset
Object
- pagination, paging informationInteger
- start, paging start positionInteger
- limit, data amount per pageInteger
- total, total transaction amountObject
- _links, paging linkString
- next, next paging linkString
- prev, previous paging link
# Example
Curl -X GET /assets
{
"code": 200,
"msg": "",
"data": [
{
"total_supply": "1596306453.6991328000",
"decimals": 8,
"name": "BTM",
"symbol": "BTM",
"asset": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"issue_timestamp": 1629427444,
"program": "",
"is_bap_2": true
},
{
"total_supply": "1000000.0000000000",
"decimals": 8,
"name": "MAG",
"symbol": "MAG",
"asset": "a0a71c215764e342d10d003be6369baf4145d9c7977f7b8f6bf446e628d8b8b8",
"issue_timestamp": 1629427459,
"program": "ae20d66ab117eca2bba6aefed569e52d6bf68a7a4ad7d775cbc01f7b2cfcd798f7b22031ab3c2147c330c5e360b4e585047d1dea5f529476ad5aff475ecdd55541923120851b4a24975df6dbeb4f8e5348542764f85bed67b763875325aa5e45116751b35253ad",
"is_bap_2": true,
"definition": {
"description": {},
"logo": "",
"quorum": 2,
"reissue": true
}
},
{
"total_supply": "98667.0129104500",
"decimals": 8,
"name": "SUP",
"symbol": "SUP",
"asset": "47fcd4d7c22d1d38931a6cd7767156babbd5f05bbbb3f7d3900635b56eb1b67e",
"issue_timestamp": 1629427459,
"program": "0354df07cda069ae203c939b7ba615a49adf57b5b4c9c37e80666436970f8507d56a272539cabcb9e15151ad",
"is_bap_2": true,
"definition": {
"description": {},
"logo": "",
"quorum": 1,
"reissue": false
}
}
],
"pagination": {
"start": 0,
"limit": 10,
"total": 3,
"_links": {}
}
}
# Asset
GET /asset
Query the asset detail by asset id
# Request
String
- asset, asset id,required
# Response
Integer
- code, status codeString
- msg, error messageObject
- asset, asset informationString
- total_supply, total supplyInteger
- decimals, numerical accuracyString
- name, asset nameString
- symbol, asset symbolString
- asset, asset idInteger
- issue_timestamp, first issue timeString
- program, issue programBool
- is_bap_2, whether a bap-2 assetObject
- definition asset definitionObject
- description asset descriptionString
- logo, asset's logoInteger
- quorum, asset signatures amountBool
- reissue, whether the asset support additional issuance
Object
- external (omit)Integer
- address_count, the owner number of assetInteger
- tx_count, the transacton amount of asset
# Example
Curl -X GET /asset?asset=a0a71c215764e342d10d003be6369baf4145d9c7977f7b8f6bf446e628d8b8b8
{
"code": 200,
"msg": "",
"data": {
"total_supply": "1000000.0000000000",
"decimals": 8,
"name": "MAG",
"symbol": "MAG",
"asset": "a0a71c215764e342d10d003be6369baf4145d9c7977f7b8f6bf446e628d8b8b8",
"issue_timestamp": 1629427459,
"program": "ae20d66ab117eca2bba6aefed569e52d6bf68a7a4ad7d775cbc01f7b2cfcd798f7b22031ab3c2147c330c5e360b4e585047d1dea5f529476ad5aff475ecdd55541923120851b4a24975df6dbeb4f8e5348542764f85bed67b763875325aa5e45116751b35253ad",
"is_bap_2": true,
"definition": {
"description": {},
"logo": "",
"quorum": 2,
"reissue": true
},
"external": {
"address_count": 50,
"tx_count": 3
}
}
}
# Daily
GET /summary/daily
Query the address, block, transaction and other summary information in daily units. Only the information of the previous day can be queried on that day
# Request
Integer
- start, start time,timestamp formatInteger
- end, start time,timestamp format
# Response
Integer
- code, status codeString
- msg, error messageObject
- data, summary informationInteger
- new_address_count, daily new addressInteger
- active_address_count, daily active addressInteger
- block_count, daily new block amountInteger
- transaction_count, daily transactions amountString
- vote_amount, total daily vote amountString
- veto_amount, total daily veto amountInteger
- timestamp, time of daily statistics
# Example
Curl -X GET /summary/daily?start=1629614272&end=1629873563
{
"code": 200,
"msg": "",
"data": [
{
"block_count": 14400,
"transaction_count": 14917,
"vote_amount": "1159667250729465.00000000",
"veto_amount": "732844616000000.00000000",
"new_address_count": 17,
"active_address_count": 17,
"timestamp": 1629648000
},
{
"block_count": 14400,
"transaction_count": 14962,
"vote_amount": "713679135535571.00000000",
"veto_amount": "424472519090000.00000000",
"new_address_count": 111,
"active_address_count": 111,
"timestamp": 1629734400
}
]
}
# Vote-transactions
GET /node/vote-transactions
Query all the voting transaction by node public key
# Request
String
- pub_key, node public key, requiredInteger
- start,paging start positionInteger
- limit, data amount per page
# Response
Integer
- code, status codeString
- msg, error messageArray of Object
- data, voting transaction listInteger
- timestamp, transaction timeString
- amount, vote or veto amountString
- voter, voter addressString
- type, vote type,vote or vetoString
- voted_pub_key, node public key
Object
- pagination, paging informationInteger
- start, paging start positionInteger
- limit, data amount per pageInteger
- total, total transaction amountObject
- _links, paging linkString
- next, next paging linkString
- prev, previous paging link
# Example
Curl -X GET /node/vote-transactions?pub_key=f9003633ccbd8cc37e034f4dbe70d9fae980d437948d8cb908d0cab7909780d74a324b4decb5dfcd43fbc6b896ac066b7e02c733a1537360e933278a101a850c
{
"code": 200,
"msg": "",
"data": [
{
"timestamp": 1629557064,
"amount": "410000.00",
"voter": "bn1q95s6aen3qrez88ayz3ehql3c029kzv5unygajd",
"type": "2",
"voted_pub_key": "f9003633ccbd8cc37e034f4dbe70d9fae980d437948d8cb908d0cab7909780d74a324b4decb5dfcd43fbc6b896ac066b7e02c733a1537360e933278a101a850c"
},
{
"timestamp": 1629724344,
"amount": "290000.00",
"voter": "bn1q23q74m3xurqeys39ctp2xwhadr9l77wmsq7ps8",
"type": "2",
"voted_pub_key": "f9003633ccbd8cc37e034f4dbe70d9fae980d437948d8cb908d0cab7909780d74a324b4decb5dfcd43fbc6b896ac066b7e02c733a1537360e933278a101a850c"
},
{
"timestamp": 1629446640,
"amount": "250000.00",
"voter": "bn1q95s6aen3qrez88ayz3ehql3c029kzv5unygajd",
"type": "2",
"voted_pub_key": "f9003633ccbd8cc37e034f4dbe70d9fae980d437948d8cb908d0cab7909780d74a324b4decb5dfcd43fbc6b896ac066b7e02c733a1537360e933278a101a850c"
}
],
"pagination": {
"start": 0,
"limit": 10,
"total": 34,
"_links": {
"next": "/blockmeta/bytom2/v1/node/vote-transactions?limit=10&start=10"
}
}
}