Language/语言
简体中文
Metanet Query
Node by txid
Returns a Metanet node accroding to a txid, the response contains information of the node and its parent node.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/metanet/txid/61145a1f39174a02ae618ab076c5daf46e9a361bad4c0cb64a39f9225711575b"
GET metanet/txid/{txid}
Response
{
"code": 200,
"data": {
"id": 1007417,
"height": 637709,
"blockIndex": 238,
"nodeTxid": "61145a1f39174a02ae618ab076c5daf46e9a361bad4c0cb64a39f9225711575b",
"parentTxid": "NULL",
"nodeAddress": "1PojuVs6VLTSps9DMP6S3qm8g32EvikqYM",
"parentAddress": "NULL",
"nodePubkey": "024ce693a669126143bbb9129aec1c4a554220c7350b97f6a8b5fcdcc19f4481f1",
"parentPubkey": "NULL",
"outputIndex": 0,
"time": 1591168235,
"rootTxid": "NULL",
"rootAddress": "NULL"
},
"message": null,
"success": true
}
Attributes | Type | Description |
---|---|---|
id | long | Paging ID |
nodeTxid | string | Node TXID |
parentTxid | string | Parent TXID |
nodeAddress | string | Address of the node |
parentAddress | string | Address of its parent node |
outputIndex | string | Output Index |
time | long | Timestamp |
height | int | Block Height |
rootTxid | string | root txid |
rootAddress | string | root address |
Node List by address
Returns all the nodes according to a nodeAddress/nodePubkey since one nodeAddress/nodePubkey might correspond to multiple metanet nodes in Metanet Protocol.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/metanet/address/16qVqhQSixSrEk6XNJWv26inug5so72SF5"
GET metanet/address/{nodeAddress/nodePubkey}
Example-Node List by nodeAddress
Example-Node List by nodePubkey
Request Parameter(s)
Parameters | Type | Required? | Description |
---|---|---|---|
flag | long | false | Paging flag(id of the last record from previous query) |
Response
{
"code": 200,
"data": [
{
"id": 3,
"height": 587848,
"blockIndex": 142,
"nodeTxid": "49ee9cc653ddd8e59b3321ec4d34ad8522bc394e48399931834db0987e26d1d6",
"parentTxid": "048e7609c70089ee052ddc7e5bceaec14a22b815b20624bcbebad58bc2415f2c",
"nodeAddress": "16qVqhQSixSrEk6XNJWv26inug5so72SF5",
"parentAddress": "1B43Nn9MEW1sTYw57s31XUXoPX3zuM6fBG",
"nodePubkey": "",
"parentPubkey": "02164a0d0f2aa2f6840f91f6b658edb6b91a3d0b4b4fb396008002734f6a098085",
"outputIndex": 0,
"time": 1561132282
}
],
"message": null,
"success": true
}
Attributes | Type | Description |
---|---|---|
id | long | Paging ID |
nodeTxid | string | Node TXID |
parentTxid | string | Parent TXID |
nodeAddress | string | Address of the node |
parentAddress | string | Address of its parent node |
nodePubkey | string | Public key of the node |
parentPubkey | string | Public key of its parent node |
outputIndex | string | Output Index |
time | long | Timestamp |
height | int | Block Height |
History Version
According to the definition of Metanet Protocol, if two nodes share the same nodeAddress and parentTxid, then they are ordered in version by TTOR(Topological Transaction Ordering Rule)
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/metanet/history_versions/1DwLduKv9FbxCL1GyB7rZxuUNXh5FJbjb/048e7609c70089ee052ddc7e5bceaec14a22b815b20624bcbebad58bc2415f2c"
GET metanet/history_versions/{nodeAddress/nodePubkey}/{parentTxid}
Example-History Version by nodeAddress and parentTxid
Example-History Version by nodePubkey and parentTxid
Request Parameter
Parameter | Type | Required? | Description |
---|---|---|---|
flag(optional) | long | false | Paging flag |
Response
{
"code": 200,
"data": [
{
"id": 6,
"height": 587848,
"blockIndex": 145,
"nodeTxid": "c10413a3ec3a395804960f337d77b97304d2576a346cb975949f7038552276ef",
"parentTxid": "048e7609c70089ee052ddc7e5bceaec14a22b815b20624bcbebad58bc2415f2c",
"nodeAddress": "1DwLduKv9FbxCL1GyB7rZxuUNXh5FJbjb",
"parentAddress": "1B43Nn9MEW1sTYw57s31XUXoPX3zuM6fBG",
"nodePubkey": "",
"parentPubkey": "02164a0d0f2aa2f6840f91f6b658edb6b91a3d0b4b4fb396008002734f6a098085",
"outputIndex": 0,
"time": 1561132282
},
{
"id": 5,
"height": 587848,
"blockIndex": 144,
"nodeTxid": "35a1250da21bec3b87c56171a5bdfc58c1e830746f1786340405a49e52880802",
"parentTxid": "048e7609c70089ee052ddc7e5bceaec14a22b815b20624bcbebad58bc2415f2c",
"nodeAddress": "1DwLduKv9FbxCL1GyB7rZxuUNXh5FJbjb",
"parentAddress": "1B43Nn9MEW1sTYw57s31XUXoPX3zuM6fBG",
"nodePubkey": "",
"parentPubkey": "02164a0d0f2aa2f6840f91f6b658edb6b91a3d0b4b4fb396008002734f6a098085",
"outputIndex": 0,
"time": 1561132282
}
],
"message": null,
"success": true
}
Attributes | Type | Description |
---|---|---|
id | long | Paging ID |
nodeTxid | string | Node TXID |
parentTxid | string | Parent TXID |
nodeAddress | string | Address of the node |
parentAddress | string | Address of its parent node |
nodePubkey | string | Public key of the node |
parentPubkey | string | Public key of its parent node |
outputIndex | string | Output Index |
time | long | Timestamp |
height | int | Block Height |
Child Nodes by Parent Node
Returns all child nodes including their versions according to the txid of a parent node
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/metanet/children/72b34a2890b9699528738a90ea87493a8848a7ec669f837ea386ac18e99474b7"
GET metanet/children/{parentTxid}
Example-Child Nodes by Parent Node
Request Parameter
Parameter | Type | Required? | Description |
---|---|---|---|
flag(optional) | long | false | Paging flag |
Response
{
"code": 200,
"data": [
{
"id": 7,
"nodeTxid": "bfe99262132497f13376e41b998599ccbf685907f3c82559380580b770e55821",
"parentTxid": "72b34a2890b9699528738a90ea87493a8848a7ec669f837ea386ac18e99474b7",
"nodeAddress": "16EYKVbWzyWBr1Fs8h5nYR9PebjqSYhTQK",
"parentAddress": "1RWhhV21Zx4Hj6XDLL6gUhMsgGQjeaAf3",
"outputIndex": 0,
"time": 1561132282
},
{
"id": 5,
"nodeTxid": "57bd02c1cc7e080aac19fa129a30e409bbe88a199c5abf5ffc40da077a6d3796",
"parentTxid": "72b34a2890b9699528738a90ea87493a8848a7ec669f837ea386ac18e99474b7",
"nodeAddress": "12U5Q74XGWNr3ji9H6voS77cGPn533Mzzb",
"parentAddress": "1RWhhV21Zx4Hj6XDLL6gUhMsgGQjeaAf3",
"outputIndex": 0,
"time": 1561132282
}
],
"message": null,
"success": true
}
Attributes | Type | Description |
---|---|---|
id | long | Paging ID |
nodeTxid | string | Node TXID |
parentTxid | string | Parent TXID |
nodeAddress | string | Address of the node |
parentAddress | string | Address of its parent node |
outputIndex | string | Output Index |
time | long | Timestamp |
height | int | Block Height |
On-chain Data Query
On-chain Data by TXID
Returns the content of OP_RETURN outputs according to a txid
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/data/tx/5648192b964061498ad7902552f0f6345f8521f67fdfc42946b5cd55f1670b41/0"
GET /data/tx/{txid}
GET /data/tx/{txid}/{outputIndex}
Note:If you are not sure with the outputIndex of the OP_RETURN one,use the previous one
Response
{
"code": 200,
"data": {
"txId": "5648192b964061498ad7902552f0f6345f8521f67fdfc42946b5cd55f1670b41",
"height": 625741,
"index": 0,
"raw": "AGoiMURTWGk4aHZ4bjZQZDRUYXZobVRLeFU3QlVxUzdjbnhodwxXVENXUTk3U0s1Q1cU5rKz5Y2XL+WRqOWPoy/pobnln44ZMjAyMC0wMy0xMVQxNzowMDowMCswODowMExreyJhcWkiOiI4MyIsInBtMjUiOiIyOSIsInBtMTAiOiIxMTYiLCJzbzIiOiI1Iiwibm8yIjoiMTAiLCJjbyI6IjAuMzI1IiwibzMiOiIxMDEiLCJwb2wiOiJQTTEwIiwicXVhIjoi6ImvIn1NCAF42oXRzUpCQRgG4HuZtRxm5pu/0z0E7cWFuApGp6hWIUgKBknmMsKF1SIICheRtPFmGo+X0TdHtOPpDO3e+fmYh3fql6R5ekwOiOGkRk7aXGLmJs+MYmZM4OLMccwhdfLEwu2Ww0STsOsAY5qGMWcxHh3iMI6dN3HhF1fZ7bt/7GcPk9XHTfZ6j0c2nAAkinFDw13rNq8lSjHAnW6tkqaqaWpHM78y2MoYZRHa5MWPn/ziej3qF1EgdAmlpdlH6UhfHHYovUV1LqytUtFoYevlXfY288+DgkqmOi2ppFDRqkD8V1X+5F+VjKg+p6v50I++8DO/l1M/7xUbE1SVbKCCttv4Aa43pow=",
"parts": [
"0",
"OP_RETURN",
"1DSXi8hvxn6Pd4TavhmTKxU7BUqS7cnxhw",
"WTCWQ97SK5CW",
"河南/周口/项城",
"2020-03-11T17:00:00+08:00",
"{\"aqi\":\"83\",\"pm25\":\"29\",\"pm10\":\"116\",\"so2\":\"5\",\"no2\":\"10\",\"co\":\"0.325\",\"o3\":\"101\",\"pol\":\"PM10\",\"qua\":\"良\"}",
""
]
},
"message": null,
"success": true
}
Attributes | Type | Description |
---|---|---|
txid | string | Transaction hash |
height | int | Block height |
index | int | Output index |
raw | string | Raw Output encoded by Base64 |
parts | array | Output stack components |
List Query
Returns data that fulfills the condition provided e.g. Webot Protocol: the third part of OP_RETURN stack(bit protocol). It also identifies and authenticates the user by address in TX input. Other applications including weathersv preev are also in this manner. 50 records at a time in descending order by time
HTTP Request
curl --location --request GET "api.metasv.com/v1/data/list?inputAddress=14PEs4zAtdGAECWhSS9XGNc4FmRoURusFL&protocol=BCHjeepney%20and%20stresstestbitcoin.cash%20(blaster.cash)&start=1533162913&end=1533167175"
GET data/list
Request Parameters
Parameter | Type | Description |
---|---|---|
inputAddress(optional) | string | Some address in TX input |
protocol(optional) | string | Bit protocol after OP_RETURN code |
flag(optional) | long | Paging flag(id of the last record from previous query) |
start(optional) | long | timestamp (second) of start time (inclusive) |
end(optional) | long | timestamp (second) of end time (inclusive) |
Response
{
"code": 200,
"data": [
{
"id": 1814788,
"inputAddress": "14PEs4zAtdGAECWhSS9XGNc4FmRoURusFL",
"protocol": "BCHjeepney and stresstestbitcoin.cash (blaster.cash)",
"height": 541584,
"time": 1533167175,
"txid": "b08b6050fa4a9e4f22b7fd873d0f58e222266a0874f1ca2d6d6874f3789c025e",
"outputIndex": 1
},
{
"id": 1814216,
"inputAddress": "14PEs4zAtdGAECWhSS9XGNc4FmRoURusFL",
"protocol": "BCHjeepney and stresstestbitcoin.cash (blaster.cash)",
"height": 541584,
"time": 1533167175,
"txid": "43f01c7f88f0a3e0681b7bab28b8a0244c60d37674b8334c95178da5b869b86e",
"outputIndex": 1
}
],
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
id | int | Paging id |
inputAddress | string | Input address |
protocol | string | Protocol |
time | long | Timestamp |
txid | string | Transaction id |
outputIndex | int | Output index |
B Protocol by Filename
Returns a file list of B Protocol(bit://19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut) according to a filename
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/data/b_protocol/twetch_twtext_1583810727714.txt"
GET data/b_protocol/{filename}
Example-B Protocol by Filename
Request
Parameter | Type | Required? | Description |
---|---|---|---|
flag(optional) | long | false | Paging flag |
Response
{
"code": 200,
"data": [
{
"id": 1961,
"filename": "twetch_twtext_1583810727714.txt",
"time": 1583810733,
"txid": "6e661935503cce008a273a6a88e5989c424ce4716ebfe0cd843f8079edd006bb",
"outIndex": null
}
],
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
id | int | Paging id |
filename | string | Filename |
time | long | Timestamp |
txid | string | Transaction id |
outIndex | int | Output index |
Transaction Query
Transaction Detail
Returns parsed transaction details, input and output information.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/tx/8e3da3d115a685ae28421b5661517e829e495091e6121c8d4b0cd52531a660a2"
GET /tx/{txid}
Request Parameters
None
Response
{
"code": 200,
"data": {
"txDetail": {
"txid": "8e3da3d115a685ae28421b5661517e829e495091e6121c8d4b0cd52531a660a2",
"version": 1,
"lockTime": 0,
"size": 192,
"fee": 57,
"height": 627182,
"blockIndex": 6,
"blockHash": "000000000000000000f0d2c432132681f73ef22679ef75aebe7ea190b184b14c",
"blockTime": 1584787871000,
"inputCount": 1,
"outputCount": 1
},
"vinList": [
{
"parentTxid": "8e3da3d115a685ae28421b5661517e829e495091e6121c8d4b0cd52531a660a2",
"height": 627182,
"index": 0,
"utxoTxid": "be70912d20e4d9639f270c09ff9ddb8e8d2fb676a4460fc8866581e56e884aff",
"utxoIndex": "5",
"value": 603,
"address": "15T6soD5ze5dMoguk7C1cnojWkX7yQPuGN",
"unlockScript": "SDBFAiEAoPLDAEpUxKLWL+b1I/3JAQ03vQSRcwAgQNDNoMbvkaYCIAEaTknYinzdp5vprXbMbL5riFatLIxQCrXcCBERQriBQSEDisPfwlnGgpyE/nOsS81xUf7zPCh1RuZmZous64/9hTY=",
"sequence": 4294967295
}
],
"voutList": [
{
"parentTxid": "8e3da3d115a685ae28421b5661517e829e495091e6121c8d4b0cd52531a660a2",
"height": 627182,
"index": 0,
"value": 546,
"address": "1363FvHSaAA9TgfxZAKQLMVjjdC5WvSjjx",
"lockScript": "dqkUFuQ3MhFWH2e2tiTUeiO6LQK1zGWIrA==",
"spentTxid": "",
"spentIndex": 0,
"spentHeight": 0,
"spent": false
}
]
},
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
txDetail | object | Transaction detail |
vinList | array | Input list |
voutList | array | Output list |
txDetail
Attribute | Type |
---|---|
txid | object |
version | int |
lockTime | long |
size | int |
fee | int |
height | int |
blockIndex | int |
blockHash | string |
blockTime | long |
inputCount | int |
outputCount | int |
vin
Attribute | Type |
---|---|
parentTxid | string |
height | int |
index | int |
value | long |
address | string |
unlockScript | string |
sequence | long |
utxoTxid | string |
utxoIndex | string |
vout
Attribute | Type |
---|---|
parentTxid | string |
height | int |
index | int |
value | long |
address | string |
lockScript | string |
spentTxid | string |
spentIndex | int |
spentHeight | int |
spent | boolean |
Obtain Raw Transaction
Returns raw transaction in hexadecimal format
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/tx/8e3da3d115a685ae28421b5661517e829e495091e6121c8d4b0cd52531a660a2/raw"
GET /tx/{txid}/raw
Request Parameters
None
Response
{
"code": 200,
"data": {
"rawHex": "0100000001ff4a886ee5816586c80f46a476b62f8d8edb9dff090c279f63d9e4202d9170be050000006b483045022100a0f2c3004a54c4a2d62fe6f523fdc9010d37bd049173002040d0cda0c6ef91a60220011a4e49d88a7cdda79be9ad76cc6cbe6b8856ad2c8c500ab5dc08111142b8814121038ac3dfc259c6829c84fe73ac4bcd7151fef33c287546e666668baceb8ffd8536ffffffff0122020000000000001976a91416e4373211561f67b6b624d47a23ba2d02b5cc6588ac00000000"
},
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
rawHex | string | Raw Transaction in HEX |
Block Query
Block Header Query
Returns block header content.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/block/1/header"
GET /block/{blockIdentifier}/header
Example-Query for block header by height
Example-Query for block header by hash
Request Parameter
Attribute | Types | Description |
---|---|---|
blockIdentifier | int/string | block heigh or block hash |
Response
{
"code": 200,
"data": {
"blockHash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
"height": 1,
"version": 1,
"prevBlockHash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"merkleRoot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
"timestamp": 1231469665000,
"medianTime": 1231469665000,
"reward": 5000000000,
"minerAddress": "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX",
"txCount": 1,
"inputCount": 1,
"outputCount": 1,
"bits": 486604799,
"nounce": null,
"size": 215
},
"message": null,
"success": true
}
Attribute | Types |
---|---|
blockHash | string |
height | long |
version | int |
preBlockHash | string |
merkleRoot | string |
timestamp | long |
medianTime | long |
txCount | long |
inputCount | long |
outputCount | long |
bits | long |
nounce | long |
size | long |
Transaction List Query
Returns transactions in a block.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/block/100000/txs?limit=10"
GET /block/{blockIdentifier}/txs
Example-Transaction List Query
Request Parameters
Attribute | Types | Description |
---|---|---|
blockIdentifier | int/string | block height or block hash |
offset | long | offset (optional) |
limit | long | max number of elements(maximum 50) |
Response
{
"code": 200,
"data": [
{
"txid": "8c14f0db3df150123e6f3dbbf30f8b955a8249b62ac1d1ff16284aefa3d06d87",
"version": 1,
"lockTime": 0,
"size": 135,
"fee": 0,
"blockIndex": 0,
"inputCount": 1,
"outputCount": 1
},
{
"txid": "fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4",
"version": 1,
"lockTime": 0,
"size": 259,
"fee": 0,
"blockIndex": 1,
"inputCount": 1,
"outputCount": 2
},
{
"txid": "6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4",
"version": 1,
"lockTime": 0,
"size": 257,
"fee": 0,
"blockIndex": 2,
"inputCount": 1,
"outputCount": 2
},
{
"txid": "e9a66845e05d5abc0ad04ec80f774a7e585c6e8db975962d069a522137b80c1d",
"version": 1,
"lockTime": 0,
"size": 225,
"fee": 0,
"blockIndex": 3,
"inputCount": 1,
"outputCount": 1
}
],
"message": null,
"success": true
}
Attribute | Types |
---|---|
txid | string |
version | int |
lockTime | long |
size | long |
fee | long |
blockIndex | long |
inputCount | long |
outputCount | long |
Merchant Interfaces
Transaction Existence Query
Returns the existence of a transaction
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/merchants/tx/exists?txid=826f60e6cd9355774998677e43026fd26716a0ac161ad94322f089ce98492e81"
GET /merchants/tx/exists
Example-Transaction Existence Query
Request Parameters
Parameter | Types | Description |
---|---|---|
txid | string | Transaction id |
Response
{
"code": 200,
"data": {
"txid": "826f60e6cd9355774998677e43026fd26716a0ac161ad94322f089ce98492e81",
"exists": true
},
"message": null,
"success": true
}
Attribute | Types | Description |
---|---|---|
txid | String | Transaction id |
exists | Boolean | Existence |
Broadcast Transaction
Broadcasts raw transaction
We accept transaction with fee rate 0.25sat/byte, MetaSV will pass the transaction to collaborating miner and got fee discount. Currently the maximum size of transaction which can be broadcasted through this API is 15 MB, we will remove it in the future.
collaborating pool | SYMBOL | public key |
---|---|---|
taal.com | TAAL | 03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270 |
HTTP Request
curl -X POST \
https://api.metasv.com/v1/merchants/tx/broadcast \
-H 'content-type: application/json' \
-d '{"rawHex":"0200000001e0d2128a554d7793352b3478c2339d4c6ba12f294584a2bcfd494daa106769e7000000006b483045022100863549e778bba1f8f8617c77bb286d161463a7b1ebd68d58c9e60e7f96c9afde022038d693ffe511685471b199ed90a806ac84e4ba2ab66ac1f3e160eb5f129452ab4121038fc908bdbac664624c0cca5e1c2c80a73af51f237e95a45b56f1a45446cb1a9bffffffff01bc020000000000001976a914950a65a1ffdde0931dcf2e3b0a1ce8142d43bfb888ac00000000"}'
POST /merchants/tx/broadcast
Request Body
Parameter | Type | Description |
---|---|---|
rawHex | string | Transaction in HEX |
Response
{
"code": 200,
"data": {
"hash": "b8193728dce79f9c1c370670ae428326e3afe96210d072dba38a29d1bf1e1e18",
"error": null,
"minerName": "TAAL",
"minerResponse": {
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-05-17T06:56:10.039Z\",\"txid\":\"b8193728dce79f9c1c370670ae428326e3afe96210d072dba38a29d1bf1e1e18\",\"returnResult\":\"success\",\"resultDescription\":\"\",\"minerId\":\"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270\",\"currentHighestBlockHash\":\"000000000000000002dc558abcd3caf9a2c5560ad346dabff7af51ebba356cb3\",\"currentHighestBlockHeight\":635273,\"txSecondMempoolExpiry\":0}",
"publicKey": "03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270",
"signature": "304402203effd0188f1d61fc78fb38b05fdaf99dcf363c6c73384b98895088d10549c9ad02201bdb2dd106e3090af2eb51bdc8f766ccabe34c4dc58d08bda2ad98daab80f2eb",
"encoding": "UTF-8",
"mimetype": "application/json"
}
},
"message": null,
"success": true
}
Attribute | Types | Description |
---|---|---|
hash | string | Transaction Hash |
error | object | Error |
minerName | string | Name of Miner |
minerResponse | object | Message from Mapi |
error
Attribute | Types | Description |
---|---|---|
code | int | Error code from the full node |
message | string | Error message |
minerResponse
Please refer to the definition of mapi
https://github.com/bitcoin-sv-specs/brfc-merchantapi
Attribute | Types | Description |
---|---|---|
payload | string | mapi payload |
publicKey | publicKey | miner publicKey |
signature | signature | miner signature |
encoding | encoding | payload encoding |
mimetype | mimetype | mime type |
Common error code of a full node
Error Type | Code | Message |
---|---|---|
RPC_MISC_ERROR | -1 | exception thrown in command handling |
RPC_TYPE_ERROR | -3 | Unexpected type was passed as parameter |
RPC_INVALID_ADDRESS_OR_KEY | -5 | Invalid address or key |
RPC_OUT_OF_MEMORY | -7 | Ran out of memory during operation |
RPC_INVALID_PARAMETER | -8 | Invalid, missing or duplicate parameter |
RPC_DATABASE_ERROR | -20 | Database error |
RPC_DESERIALIZATION_ERROR | -22 | Error parsing or validating structure in raw format |
RPC_VERIFY_ERROR | -25 | General error during transaction or block submission |
RPC_VERIFY_REJECTED | -26 | Transaction or block was rejected by network rules |
RPC_VERIFY_ALREADY_IN_CHAIN | -27 | Transaction already in chain |
"reject" Errors
Error Type | Code |
---|---|
REJECT_MALFORMED | 0x01 |
REJECT_INVALID | 0x10 |
REJECT_OBSOLETE | 0x11 |
REJECT_DUPLICATE | 0x12 |
REJECT_NONSTANDARD | 0x40 |
REJECT_DUST | 0x41 |
REJECT_INSUFFICIENTFEE | 0x42 |
REJECT_CHECKPOINT | 0x43 |
REJECT_TOOBUSY | 0x44 |
Utxo Selection
Selects a set of Utxos with a value higher than the amount for a given address list and an amount. In case of HD wallets, multiple addresses can be specified.
Note:Transaction fees is not included, add some transaction fees to amount when invoking
HTTP Request
curl --location --request POST 'https://api.metasv.com/v1/merchants/utxo_select' \
--header 'Content-Type: application/json' \
--data-raw '{"addresses": ["12higDjoCCNXSA95xZMWUdPvXNmkAduhWv", "19k8nToWwMGuF4HkNpzgoVAYk4viBnEs5D"], "amount": 102891277}'
POST /merchants/utxo_select
Request Body
Attribute | Type | Description |
---|---|---|
addresses | array | Address to query |
amount | long | Amount in satoshi |
{
"addresses": [
"12higDjoCCNXSA95xZMWUdPvXNmkAduhWv",
"19k8nToWwMGuF4HkNpzgoVAYk4viBnEs5D"
],
"amount": 102891277
}
Response
{
"code": 200,
"data": [
{
"outputIndex": 0,
"address": "12higDjoCCNXSA95xZMWUdPvXNmkAduhWv",
"txid": "0a21079a06c523fed3a41f890c4e96bb148433c90bf42d3c12649846af20f5b6",
"id": 31537708,
"ancestors": 0,
"descendents": 0,
"value": 100000000,
"height": 576232
},
{
"outputIndex": 0,
"address": "12higDjoCCNXSA95xZMWUdPvXNmkAduhWv",
"txid": "166a3ab4254f7dbb0a9ea5750bdc19254fb8597b30a8c393b8a48d3f73939775",
"id": 20292332,
"ancestors": 0,
"descendents": 0,
"value": 666000,
"height": 576241
}
],
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
txid | string | Transaction id |
address | string | Address |
height | int | Block Height(-1 if not confirmed yet) |
value | long | Amount |
id | long | Paging id |
outputIndex | int | Index |
ancestors | int | Ancestor count(0 if utxo confirmed) |
descendents | int | Descendent count(0 if utxo confirmed) |
If all the balances is not sufficient for the amount, api will return error code 20001 and the current balance, if you wish to fetch all the utxos, please use this balance as amount to request once again.
{
"code": 20001,
"data": {
"balance": 102891278
},
"message": "Utxo total amount is insufficient",
"success": false
}
Paymail Address Query
Paymail is a collection of protocols for Bitcoin SV wallets that allow for a set of simplified user experiences to be delivered across all wallets in the ecosystem.
Can query all used address by paymail address that is easier to remember, thus simplifying the arrangement of address.
For Details, please check Paymail Protocol
HTTP Request
curl --location --request GET 'api.metasv.com/v1/merchants/paymail/bitcoinscl@moneybutton.com'
GET /merchants/paymail/{alias}@{domain}
Response
{
"code": 200,
"data": {
"email": "bitcoinscl@moneybutton.com",
"publicKey": "03db230f7ac74a7193048f10b893c10bc8d3c43b6e151c3ca7fc1b1cd1e9627e6d",
"address": "1EXyJR3pzvSz8Xg6ux23TFkz8hUjUTL5xW",
"url": "https://www.moneybutton.com/api/v1/bsvalias/id/bitcoinscl@moneybutton.com"
},
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
string | email address | |
publicKey | string | public key |
address | string | used address |
url | string | paymail desolved url |
Address Query
Basic Information
Returns the basic information of an address. You can use either an address or a pubKey when running a query.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/address/1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz/info"
GET /address/{addressIdentifier}/info
Response
{
"code": 200,
"data": {
"id": null,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"confirmedBalance": 12504971819,
"unconfirmedBalance": 0,
"firstSpend": 1502122852000,
"firstSpendHeight": 478751,
"firstReceive": 1501746239000,
"firstReceiveHeight": 478583,
"lastSpend": 1591574628000,
"lastSpendHeight": 638383,
"lastReceive": 1591604088000,
"lastReceiveHeight": 638452,
"txCount": 22954,
"totalIncome": 25731818063550,
"totalOutcome": 25719313091731
},
"message": null,
"success": true
}
Attribute | Types |
---|---|
id | long |
address | string |
confirmedBalance | long |
unconfirmedBalance | long |
firstSpend | long |
firstSpendHeight | int |
firstReceive | long |
firstReceiveHeight | int |
lastSpend | long |
lastSpendHeight | int |
lastReceive | long |
lastReceiveHeight | int |
txCount | long |
totalIncome | long |
totalOutcome | long |
Transaction list by Address
Returns the history transactions involved in the address. You can use either an address or a pubKey when running a query.
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/address/1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz/tx?limit=10"
GET /address/{addressIdentifier}/tx
Example-Transaction list by Address
Request Parameter
Attribute | Types | Description |
---|---|---|
flag | string | Paging label(Optional) |
limit | int | Limit, maximum 100 (Optional, default 50) |
Response
{
"code": 200,
"data": {
"flag": "h_1591856308000_76785125",
"transactions": [
{
"id": 77427768,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591936092000,
"height": 638985,
"income": 625250909,
"outcome": 0,
"txid": "99561557fb56b53a026e7c5043542a1c27104859beb4cb65a1a68dc838dd53a3"
},
{
"id": 77310381,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591922015000,
"height": 638962,
"income": 0,
"outcome": 1875825044,
"txid": "9b8344c79f68094c02240bb093542f310bcd0fc416a161130617a1f12ce8173a"
},
{
"id": 77247902,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591910347000,
"height": 638949,
"income": 625113306,
"outcome": 0,
"txid": "16796544c87dab68c5287b60ffe4f44b569a4171d967aca339e3fe99ee13a999"
},
{
"id": 77124605,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591896582000,
"height": 638927,
"income": 625152761,
"outcome": 0,
"txid": "25cc416ae22bbd5bc5614acdadcca86522b1f3a99254a02ae86aeaadba75c162"
},
{
"id": 76965728,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591877219000,
"height": 638903,
"income": 0,
"outcome": 5627506777,
"txid": "3cca533e1553a19044f0d7d2a8e37db0ea1a909b774dcd5de7db7e61900c95fb"
},
{
"id": 76960828,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591876353000,
"height": 638898,
"income": 625071036,
"outcome": 0,
"txid": "e308fc17a976a8b110881b12dd5a134067442fecb7dc93f8f3d319cbee3de415"
},
{
"id": 76949119,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591874978000,
"height": 638895,
"income": 625127587,
"outcome": 0,
"txid": "eb388edfecc69dcb0db184af937c4855731b45b1f7ff137ea445b1362853fbef"
},
{
"id": 76814075,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591861906000,
"height": 638880,
"income": 625300161,
"outcome": 0,
"txid": "7d264a613657e35710ed1cbc822a5bf619d1bbb00bb0f49ca5d35833bf2fab57"
},
{
"id": 76798308,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591858108000,
"height": 638875,
"income": 625145054,
"outcome": 0,
"txid": "a4e6f017d1dd7fa1533c8b58074048575ed5e59cd6b9b5c5db0d234ae2ab63e0"
},
{
"id": 76785125,
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"time": 1591856308000,
"height": 638868,
"income": 625026889,
"outcome": 0,
"txid": "4228fb498e0b1b137c98a7164d1b99f88c10ddb8184ba1cc63cc1f93b6901fdb"
}
]
},
"success": true
}
Attribute | Description | |
---|---|---|
flag | string | paging label |
transactions | array | tx list |
Attribute | Types | Description |
---|---|---|
id | long | paging id |
address | string | address |
time | long | timestamp |
height | int | height |
income | long | income |
outcome | long | outcome |
txid | string | txid |
Address Balance
Returns confirmed and unconfirmed balance in an address
HTTP Request
curl --location --request GET "https://api.metasv.com/v1/address/1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz/balance"
GET /address/{address}/balance
Response
{
"code": 200,
"data": {
"address": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"confirmedBalance": 43783170730,
"unconfirmedBalance": 0
},
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
address | string | Address |
confirmed | long | Confirmed balance |
unconfirmed | long | Unconfirmed balance |
Utxo by Address
Returns a Utxo set of a given address(50 records at a time) Utxo with a higher confirm count is prioritized
HTTP Request
curl --location --request GET 'api.metasv.com/v1/address/12higDjoCCNXSA95xZMWUdPvXNmkAduhWv/utxo'
GET /address/{address}/utxo
Request
Parameter | Type | Required? | Description |
---|---|---|---|
flag | long | false | Paging flag(id of the last record from previous query) |
Response
{
"code": 200,
"data": [
{
"id": 4701050,
"address": "12higDjoCCNXSA95xZMWUdPvXNmkAduhWv",
"txid": "3541514998f58a38443878d0904033f519cb26820e9d88ccb5b22a90c3f34d1b",
"outputIndex": 0,
"value": 500000,
"height": 576239,
"ancestors": 0,
"descendents": 0
},
{
"id": 5376917,
"address": "12higDjoCCNXSA95xZMWUdPvXNmkAduhWv",
"txid": "e798e31cecf8a73ecf66402e702d28a91f99be46c09bee73a2e04a2068f2451f",
"outputIndex": 0,
"value": 9990,
"height": 576240,
"ancestors": 0,
"descendents": 0
}
],
"message": null,
"success": true
}
Attribute | Type | Description |
---|---|---|
txid | string | Transaction id |
address | string | Address |
height | int | Block Height(-1 if not confirmed yet) |
value | long | Amount |
id | long | Paging id |
outputIndex | int | Index |
ancestors | int | Ancestor count(0 if utxo confirmed) |
descendents | int | Descendent count(0 if utxo confirmed) |
MetaStream Subscription
We developed MetaStream Stream API to provide the latest on-chain data with developers. Clients can subscribe information from the server using a keep-alive connection. If the transaction, which the client is interested in, appears on the blockchain, the server will push the real-time data to client side using text/event-stream steam in the form of SSE(Server Sent Event).
This function is suitable for some applications that requires real-time features, such as on-chain chatroom, wallet notifications, on-chain stats(bitcoinblocks.live). MetaSV functions as a filter for your application so that only the data that clients focus are pushed.
Overview
Push messages returned by the server are in one of the following formats
{"type":"OPEN","data":""}
{"type":"HEARTBEAT","data":""}
{"type":"DATA","data":{"txid":"17140bb8784344a38c72f3041ae884fc86cda2f2d431b76ce6ad954d11890de6","time":1586600513456511000}}
The following table explains them further
Type | Description |
---|---|
OPEN | Notify the beginning of connection establishment |
HEARTBEAT | The default timeout of long connection is 1 min, therefore the server pushes heartbeat data every 30 sec to maintain the connection |
DATA | Push data |
There exists a time field in pushed data, which is a unix timestamp in nanoseconds
All the requests have an optional flag parameter
Notes on REAL-TIME
Subscribe Block
Obtain block-related events and their detail
HTTP Request
curl --location --request GET 'https://api.metasv.com/v1/stream/block'
GET /stream/block
Request
Parameter | Type | Required? | Description |
---|---|---|---|
flag | long | false | Replay flag(Timestamp at breakpoint in nanoseconds) |
Response
{
"type": "DATA",
"data": {
"block": {
"blockHash": "0000000000000000046bdee35b14794ed21035e2322a5687dcd7d40879639ac1",
"height": 630093,
"version": 536870912,
"prevBlock": "000000000000000005c4e4e1ee3f969f448964d90540342a7c1d6b17c5edd6c2",
"merkleRoot": "49113fd51c48763df8b54ad8b08694bb9e08507541703d1362606083f889b46b",
"timeStamp": 1586601469000,
"medianTime": 1586599227000,
"reward": 625285073,
"minerAddress": "1P3GQYtcWgZHrrJhUa4ctoQ3QoCU2F65nz",
"txCount": 1301,
"bits": 403043979,
"nonce": 3442284989,
"size": 591171,
"inputCount": 2804,
"outputCount": 4332,
"miner": "minerName",
"coinbase": "coinbaseMessage written by miner"
},
"time": 1586601509955212000
}
}
Attribute | Types | Description |
---|---|---|
blockHash | string | Block hash |
height | int | Block height |
version | int | Block version |
prevBlock | string | Previous block hash |
merkleRoot | string | Merkle root |
timeStamp | long | Block timestamp in ms |
medianTime | long | Median time |
reward | long | Block reward |
minerAddress | string | Miner Address |
txCount | int | Transaction count |
bits | long | Block volume in bits |
nonce | int | Block nonce |
size | int | Block size |
inputCount | int | Input |
outputCount | int | Output count in block |
miner | string | parsed miner name |
coinbase | string | parsed coinbase message |
Subscribe Transaction Hash
Push full transaction events happening on chain
HTTP Request
curl --location --request GET 'https://api.metasv.com/v1/stream/tx'
GET /stream/tx
Example-Real-time Transaction Subscriptionhash
Request
Parameter | Type | Required? | Description |
---|---|---|---|
flag | long | false | Replay flag(Timestamp at breakpoint in nanoseconds) |
Response
{
"type": "DATA",
"data": {
"txid": "469df6790f08785a33108620f73aeadd6d0e8344ada1c61c56dc25c35a22d100",
"time": 1586602009727723000
}
}
Attribute | Types | Description |
---|---|---|
txid | string | Transaction hash |
Subscribe Transaction Detail
Push full transaction events in detail(contain raw tx and parsed tx data).
HTTP Request
curl --location --request GET 'https://api.metasv.com/v1/stream/tx/detail'
GET /stream/tx/detail
Example-Real-time Transaction Detail Subscription
Request
Parameter | Type | Required? | Description |
---|---|---|---|
flag | long | false | Replay flag(Timestamp at breakpoint in nanoseconds) |
Response
{
"type": "DATA",
"data": {
"tx": {
"txDetail": {
"txid": "443ce7b5cfaaf34d650763e7814b7f1b2171313a1d28eb7245434c5c81e3c8d5",
"version": 1,
"lockTime": 0,
"size": 335,
"fee": 84,
"inputCount": 1,
"outputCount": 2,
"rawHex": "0100000001a3054761ea1ccb63d88a4fadb3e8c307c209ecd8d44963cc86713aac5730f1b5010000006b483045022100914b85024e0aeb275a42dbd64524363905b4fc68f3cfc210fb547c1bdcf7b51902205c133c2ea2d8a44cac6d0e413aa7ee8d55ed945f6e104a9c9acd621b41793c424121036609449580213f50abc68433cf9bed24568b3f6e8dcf19bddfb3e9ee1c6aef5dffffffff02000000000000000086006a22314c74794d45366235416e4d6f70517242504c6b3446474e3855427568784b71726e0101307b2274223a33372c2268223a34322c2270223a313030392c2263223a34302c227773223a332e312c227764223a39307d22313338523356484147456576554c57487173705077716e714a7941344778505479320a31353836363033383234e7ee0000000000001976a91417573bb918cdd72760f6aa59133719119f16769388ac00000000"
},
"vinList": [
{
"txId": "443ce7b5cfaaf34d650763e7814b7f1b2171313a1d28eb7245434c5c81e3c8d5",
"index": 0,
"utxoTxid": "b5f13057ac3a7186cc6349d4d8ec09c207c3e8b3ad4f8ad863cb1cea614705a3",
"utxoIndex": "1",
"value": 61243,
"address": "138R3VHAGEevULWHqspPwqnqJyA4GxPTy2",
"unlockScript": "483045022100914b85024e0aeb275a42dbd64524363905b4fc68f3cfc210fb547c1bdcf7b51902205c133c2ea2d8a44cac6d0e413aa7ee8d55ed945f6e104a9c9acd621b41793c424121036609449580213f50abc68433cf9bed24568b3f6e8dcf19bddfb3e9ee1c6aef5d",
"sequence": 4294967295
}
],
"voutList": [
{
"index": 0,
"value": 0,
"address": "",
"lockScript": "006a22314c74794d45366235416e4d6f70517242504c6b3446474e3855427568784b71726e0101307b2274223a33372c2268223a34322c2270223a313030392c2263223a34302c227773223a332e312c227764223a39307d22313338523356484147456576554c57487173705077716e714a7941344778505479320a31353836363033383234",
"parts": [
"0",
"OP_RETURN",
"1LtyME6b5AnMopQrBPLk4FGN8UBuhxKqrn",
"\u0001",
"{\"t\":37,\"h\":42,\"p\":1009,\"c\":40,\"ws\":3.1,\"wd\":90}",
"138R3VHAGEevULWHqspPwqnqJyA4GxPTy2",
"1586603824"
]
},
{
"index": 1,
"value": 61159,
"address": "138R3VHAGEevULWHqspPwqnqJyA4GxPTy2",
"lockScript": "76a91417573bb918cdd72760f6aa59133719119f16769388ac"
}
]
},
"time": 1586603836631453000
}
}
Attribute | Types | Description |
---|---|---|
txDetail | Object | Tx overview, includes some general information and raw tx text |
vinList | List |
Transaction input list, includes amount, scripts, utxo points and input addresses |
voutList | List |
Transaction output list, includes amount, scripts and addresses, also parts if it is an OP_RETURN output |
Subscribe Address
Subscribe to a specific address. Push transaction any events related to the address.
HTTP Request
curl --location --request GET 'https://api.metasv.com/v1/stream/address/1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf'
GET /stream/address/{address}
Example-Twetch Address Subscription
Request
Parameter | Type | Required? | Description |
---|---|---|---|
flag | long | false | Replay flag(Timestamp at breakpoint in nanoseconds) |
simple | boolean | false | Return simplified response(default true) |
Response
{
"type": "DATA",
"data": {
"relatedTx": {
"txDetail": {
"txid": "e29a8c21a2b7ff6dec2622b8b525bf35f81ace023f5b39f3f627c05f00a7c522",
"version": 1,
"lockTime": 0,
"size": 874,
"fee": 505,
"inputCount": 1,
"outputCount": 6,
"rawHex": "0100000001e3565a467f8adad66f2f00bea3b8bcec8ed01cd2422d5ac63c9632a0ff69279f050000006a473044022049385c71854122c2f04c00c5b2e517a3acb56bef58548ea5b388ccf0c88ee6ca022020d83cfefafafa9fc68c4abe901ddf5763cab9b219f940e92b56272cb373bec7412103e9ae85c03f284bf044708d1161987be21c54b7879408c367f6ada013316ec677ffffffff060000000000000000fd1802006a2231394878696756345179427633744870515663554551797131707a5a56646f4175741c4e4f20696e206d7920696e746572707265746174696f6e2e2e2e2e2e0a746578742f706c61696e04746578741f7477657463685f7477746578745f313538363630333539303432372e747874017c223150755161374b36324d694b43747373534c4b79316b683536575755374d74555235035345540b7477646174615f6a736f6e046e756c6c0375726c046e756c6c07636f6d6d656e74046e756c6c076d625f75736572053135313337057265706c794063333139356236373137393165303537356639313263393763373563333838633338633336653632383332326332636664313732363036353430663764626333047479706504706f73740974696d657374616d70046e756c6c036170700674776574636807696e766f6963652435313838303130382d353366342d346366372d623863342d653861663566343864313465017c22313550636948473232534e4c514a584d6f53556157566937575371633768436676610d424954434f494e5f454344534122314b6e695a4b396453757354545137564a726142445177537550664d56644d4e776d4c58487741334f376466465738554f3631434e49746a68767679544e4f63494e5946655166626d454d483652564d53335264586d7055304d2f495162415033467a557431755a734f7659356955573571704636366d2f7073773d13130000000000001976a91405186ff0710ed004229e644c0653b2985c648a2388ac22020000000000001976a91471818c0c2fd07d43fce35b1086904ac6838d484388ac990a0000000000001976a9141e32c13d76b7a0c842e69dbc74d1fefc27aab46288ac990a0000000000001976a9148d7795663206e5fb98ca370acb50f63d88bc747588ac35630200000000001976a9148468450fb7f945c6bdc272e22fdcf35c49d4e65e88ac00000000"
},
"vinList": [
{
"txId": "e29a8c21a2b7ff6dec2622b8b525bf35f81ace023f5b39f3f627c05f00a7c522",
"index": 0,
"utxoTxid": "9f2769ffa032963cc65a2d42d21cd08eecbcb8a3be002f6fd6da8a7f465a56e3",
"utxoIndex": "5",
"value": 167829,
"address": "1D5777WrAhk3PuN63U2TTPLys2T7MYmJ21",
"unlockScript": "473044022049385c71854122c2f04c00c5b2e517a3acb56bef58548ea5b388ccf0c88ee6ca022020d83cfefafafa9fc68c4abe901ddf5763cab9b219f940e92b56272cb373bec7412103e9ae85c03f284bf044708d1161987be21c54b7879408c367f6ada013316ec677",
"sequence": 4294967295
}
],
"voutList": [
{
"index": 0,
"value": 0,
"address": "",
"lockScript": "006a2231394878696756345179427633744870515663554551797131707a5a56646f4175741c4e4f20696e206d7920696e746572707265746174696f6e2e2e2e2e2e0a746578742f706c61696e04746578741f7477657463685f7477746578745f313538363630333539303432372e747874017c223150755161374b36324d694b43747373534c4b79316b683536575755374d74555235035345540b7477646174615f6a736f6e046e756c6c0375726c046e756c6c07636f6d6d656e74046e756c6c076d625f75736572053135313337057265706c794063333139356236373137393165303537356639313263393763373563333838633338633336653632383332326332636664313732363036353430663764626333047479706504706f73740974696d657374616d70046e756c6c036170700674776574636807696e766f6963652435313838303130382d353366342d346366372d623863342d653861663566343864313465017c22313550636948473232534e4c514a584d6f53556157566937575371633768436676610d424954434f494e5f454344534122314b6e695a4b396453757354545137564a726142445177537550664d56644d4e776d4c58487741334f376466465738554f3631434e49746a68767679544e4f63494e5946655166626d454d483652564d53335264586d7055304d2f495162415033467a557431755a734f7659356955573571704636366d2f7073773d",
"parts": [
"0",
"OP_RETURN",
"19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut",
"NO in my interpretation.....",
"text/plain",
"text",
"twetch_twtext_1586603590427.txt",
"|",
"1PuQa7K62MiKCtssSLKy1kh56WWU7MtUR5",
"SET",
"twdata_json",
"null",
"url",
"null",
"comment",
"null",
"mb_user",
"15137",
"reply",
"c3195b671791e0575f912c97c75c388c38c36e628322c2cfd172606540f7dbc3",
"type",
"post",
"timestamp",
"null",
"app",
"twetch",
"invoice",
"51880108-53f4-4cf7-b8c4-e8af5f48d14e",
"|",
"15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva",
"BITCOIN_ECDSA",
"1KniZK9dSusTTQ7VJraBDQwSuPfMVdMNwm",
"HwA3O7dfFW8UO61CNItjhvvyTNOcINYFeQfbmEMH6RVMS3RdXmpU0M/IQbAP3FzUt1uZsOvY5iUW5qpF66m/psw="
]
},
{
"index": 1,
"value": 4883,
"address": "qqz3smlswy8dqppznejycpjnk2v9cey2yvgehq93cw",
"lockScript": "76a91405186ff0710ed004229e644c0653b2985c648a2388ac"
},
{
"index": 2,
"value": 546,
"address": "qpccrrqv9lg86sluudd3pp5sftrg8r2ggvzlx9zjhx",
"lockScript": "76a91471818c0c2fd07d43fce35b1086904ac6838d484388ac"
},
{
"index": 3,
"value": 2713,
"address": "qq0r9sfaw6m6pjzzu6wmcax3lm7z0245vgruw3r85n",
"lockScript": "76a9141e32c13d76b7a0c842e69dbc74d1fefc27aab46288ac"
},
{
"index": 4,
"value": 2713,
"address": "qzxh09txxgrwt7ucegms4j6s7c7c30r5w5a3t5m3c7",
"lockScript": "76a9148d7795663206e5fb98ca370acb50f63d88bc747588ac"
},
{
"index": 5,
"value": 156469,
"address": "qzzxs3g0klu5t34acfewyt7u7dwyn48xtcyj22ssqq",
"lockScript": "76a9148468450fb7f945c6bdc272e22fdcf35c49d4e65e88ac"
}
]
},
"time": 1586603609082965000,
"income": 4883,
"outcome": 0
}
}
Attribute | Type | Description |
---|---|---|
relatedTx | Object | Transaction details related to the given address(data structure is the same as previous interface) |
income | Long | Total income of the given address in this transaction(sum of incomes) |
outcome | Long | Total outcome of the given address in this transaction(sum of outcomes) |
Simple Query Response
{
"type": "DATA",
"data": {
"txid": "8f8c2a7f89ccc0b6b4f70d0e126e158dfa3174f640a7698ad9f4996778af47d2",
"time": 1586865907728955000,
"income": 546,
"outcome": 0
}
}
Attribute | Type | Description |
---|---|---|
txid | string | Transaction id |
income | Long | Total income of the given address in this transaction(sum of incomes) |
outcome | Long | Total outcome of the given address in this transaction(sum of outcomes) |
Subscribe On-chain Data
Subscribe to transactions with OP_RETURN and filter on-chain data with parts
HTTP Request
curl --location --request GET 'https://api.metasv.com/v1/stream/data?p2=1LtyME6b5AnMopQrBPLk4FGN8UBuhxKqrn'
GET /stream/data
Example-real-time WeatherSV data
Request
OpCode | Index | Identifier |
---|---|---|
OP_FALSE | 0 | p0 |
OP_RETURN | 1 | p1 |
data0 | 2 | p2 |
data1 | 3 | p3 |
data2 | 4 | p4 |
data3 | 5 | p5 |
data4 | 6 | p6 |
Pass parameters according to above codes. Here parameters function as a filter, only transactions fulfill the parameter are pushed.
Parameter | Type | Required? | Description |
---|---|---|---|
flag | long | false | Replay flag(Timestamp at breakpoint in nanoseconds) |
inputAddress | string | false | address matching those in transaction input(for identification) |
p2 | string | false | string matching the 2nd part in OP_RETURN stack, usually a bitcom protocol indentifier |
p3 | string | false | string matching the 3nd part in OP_RETURN stack |
p4 | string | false | string matching the 4nd part in OP_RETURN stack |
p5 | string | false | string matching the 5nd part in OP_RETURN stack |
p6 | string | false | string matching the 6nd part in OP_RETURN stack |
Response
{
"type": "DATA",
"data": {
"data": {
"txId": "b727685b857824ff050d8b9c485c214aedd284f13e422223cd7d30093f0dfa18",
"raw": "006a22314c74794d45366235416e4d6f70517242504c6b3446474e3855427568784b71726e01012b7b2274223a32302e30362c2268223a34302c2270223a313032332c2263223a32302c227773223a312e357d2231473256686f434e73596651487a5044313256506b357037584876413572745874500a31353836363035303631",
"parts": [
"0",
"OP_RETURN",
"1LtyME6b5AnMopQrBPLk4FGN8UBuhxKqrn",
"\u0001",
"{\"t\":20.06,\"h\":40,\"p\":1023,\"c\":20,\"ws\":1.5}",
"1G2VhoCNsYfQHzPD12VPk5p7XHvA5rtXtP",
"1586605061"
]
},
"time": 1586605064152232000
}
}
Attribute | Type | Description |
---|---|---|
txid | string | Transaction hash |
raw | string | HEX representation of this tx output |
parts | string | output data parts decoded in utf-8 |
MetaTrigger
MetaTrigger is a Transaction Event Trigger service, specific event can be triggered after a transaction with designated format being sent to a specific address.
No request of http or rest in this service, the only thing necessary to trigger this service is creating a bitcoin transaction in specific condition.
Gatling Gun
For the convenience of developers and other users' testing work, MetaSV provides a function that is easy to use, called Transaction Gatling Gun Function.
Sending a large number of transactions in a short period of time is very complicated. Users need to split UTXO in advance, and manage UTXO concurrency issues. Meantime, there are transaction and broadcast performance bottlenecks.
MetaSV will enclose all the internal complexity inside the application for users, the only thing user needs to do is to make a simple transaction.
Manual
Transfer over 2000 satoshi to the address below can trigger 0.25 fee rate Gatling Gun
1MpRcaGTx3iQ5EisGbfPa2jTWUPTQ5jqWZ
Transfer over 3000 satoshi to the address below can trigger 0.5 fee rate Gatling Gun
1EHpcD2vyh7vwaYtFELthqoGXAS3iSfUTL
If you want to write a personal signature in the transaction generated by the gatling gun, you can write letter in the OP_RETURN output of the transfer transaction, for example:
0 OP_RETURN LoveBSV
Then such OP_RETURN will show in the output of all gatling gun transactions. If users do not specify a personal signature, MetaSV.com will be as replacement. Please make sure the transaction is in right format and with enough value
Limitation
The gatling gun triggered by a transfer will be fired at a fixed speed of 10 TPS.
The number of tasks executed by the system at the same time is 200 (up to 2000 TPS). If it exceeds, exceeding tasks will wait in queue to execute.
View Results
From some real-time transaction display websites, such as BitcoinBlocks.live.
Through MetaStream to monitor gatling gun transactions, for example: https://api.metasv.com/v1/stream/data?p3=7a2591 p3 is the location of part 3, where the gatling gun will write in the first 6 chars of the triggering transaction hash as the task id for searching transaction, in this case the txid is 7a2591cbe716118ee3773f5584eee13a283f83657cd879cbab271e45e0fd8d7f.
Through the fontend we made, https://webot.metasv.com/gatlin/your_order_txid, for example: example link
Expense
Please note that the transfer amount is at least 2000 satoshi, if it is less than 2000, it will be regarded as a donation.
The price (satoshi) equations for each transaction shooted by Gatling is:
0.5 fee rate gun: Price = (personal signature length - 10) * 10 + 300; if Price < 300 then Price = 300
0.25 fee rate gun: Price = (personal signature length - 5) * 10 + 200; if Price < 200 then Price = 200
The fee includes the miner's bonus fee, the cost of constructing utxo bullets, and the MetaSV server fee.
If you need a large number of transactions on the chain, please contact us. We will provide discount service.
Comments
If you have any advice,feel free to submit an issue to Github Repository:
https://github.com/KaKeimei/meta-sv/issues
Updates
2020/6/8
- Add basic information and tx list query service in address interface
2020/6/3
- Add block query api.
2020/5/28
- Add an extra attribute "descendents" to utxo. You can know descendents count when you query utxo.
2020/5/27
- Add pubkey fields to metanet node API. You can use node pubkey as the query parameter.
2020/5/17
- Tx broadcast will push the transaction directly to miner, and return mapi response
2020/5/14
- Add Paymail Address Query service in merchants interface
2020/5/5
- metastream block subscription add miner name and coinbase message
2020/4/17
- Add Txid,rootAddress fields to metanet node API
- Add time range parameters to data list API
2020/4/14
Added simple query parameters to real-time address stream
2020/4/11
Added MetaStream push interface
Real-time block stream: /stream/block
Real-time transaction stream: /stream/tx
Real-time transaction detail stream: /stream/tx/detail
Real-time address stream: /stream/address/{address}
Real-time on-chain data stream: /stream/data
Added interface for obtaining raw transaction
- /tx/{txid}/raw
Modified the following interfaces to return code 404 when resource not found
/tx/{txid}
/data/tx/{txid} /data/tx/{txid}/{outputIndex}
2020/3/27
Added support for utxo
utxo batch query /merchants/utxo_select
utxo paged query /address/{address}/utxo
2020/3/15
alpha release
ERROR CODES
This table defines all the ERROR CODES that may occur in our API response:
ERROR_CODE | IDENTIFIER | EXPLAINATION |
---|---|---|
404 | NOT_FOUND | resource not found |
500 | SYSTEM_ERROR | system error |
20001 | UTXO_SELECT_AMOUNT_INSUFFICIENT | insufficient balance while selecting utxo |