Core gRPC Endpoints
Detailed core gRPC endpoint reference
gRPC Overview
Please refer to the gRPC Overview for details regarding running the examples shown below, encoding/decoding the request/response data, and clients available for several languages.
Endpoint Details
broadcastTransaction
New in Dash Platform v0.15.0
Previously named
sendTransaction
Returns: The transaction id (TXID) if successful
Parameters:
Name | Type | Required | Description |
---|---|---|---|
transaction | Bytes | Yes | A raw transaction |
allow_high_fees | Boolean | No | Enables bypassing the high fee check |
bypass_limits | Boolean | No |
Example Request and Response
const DAPIClient = require('@dashevo/dapi-client');
const { Transaction } = require('@dashevo/dashcore-lib');
const client = new DAPIClient({
seeds: [{
service: 'seed-1.evonet.networks.dash.org',
port: 3000
}],
});
const tx = Transaction('02000000012a853bf4bf4965540210b8a1ff11cde1bf17c47b37b1bf97633d81f642136d52010000006a47304402207a6f967119ea7432414a44f26b75c62053626ac6c918781c22e0eca8be6ffd6002201967858618c139a57e417a02c253888f9be79a7d4ca2381054be93141fd31c6e0121029c0d10e04cb436f76fc8223e1c7a37601f1d097a059674a45391f19b642a8e17feffffff0200e1f505000000001976a914f862c9d89384b14139d79b485dde663a5a02268f88ac9c3260f6000000001976a91417b2e8501e9f956575102c5ba87d15de9dcd5bb088ac0f180000');
client.core.broadcastTransaction(tx.toBuffer())
.then((response) => console.log(response));
const {
v0: {
CorePromiseClient,
},
} = require('@dashevo/dapi-grpc');
const { Transaction } = require('@dashevo/dashcore-lib');
const corePromiseClient = new CorePromiseClient('http://seed.evonet.networks.dash.org:3010');
const tx = Transaction('02000000012a853bf4bf4965540210b8a1ff11cde1bf17c47b37b1bf97633d81f642136d52010000006a47304402207a6f967119ea7432414a44f26b75c62053626ac6c918781c22e0eca8be6ffd6002201967858618c139a57e417a02c253888f9be79a7d4ca2381054be93141fd31c6e0121029c0d10e04cb436f76fc8223e1c7a37601f1d097a059674a45391f19b642a8e17feffffff0200e1f505000000001976a914f862c9d89384b14139d79b485dde663a5a02268f88ac9c3260f6000000001976a91417b2e8501e9f956575102c5ba87d15de9dcd5bb088ac0f180000');
corePromiseClient.client.broadcastTransaction({ transaction: tx.toBuffer() })
.then((response) => console.log(response));
{
transactionId: 'a519f41be5de67a917094346e85111d571e198dbd2646c9170358c7439fc2b10'
}
getStatus
Returns: Status information from the Core chain
Parameters: None
Example Request and Response
const DAPIClient = require('@dashevo/dapi-client');
const client = new DAPIClient({
seeds: [{
service: 'seed-1.evonet.networks.dash.org',
port: 3000
}],
});
client.core.getStatus()
.then((response) => console.log(response));
const {
v0: {
GetStatusRequest,
CorePromiseClient,
},
} = require('@dashevo/dapi-grpc');
const corePromiseClient = new CorePromiseClient('http://seed.evonet.networks.dash.org:3010');
corePromiseClient.client.getStatus(new GetStatusRequest())
.then((response) => console.log(response));
grpcurl -plaintext -proto protos/core/v0/core.proto \
seed.evonet.networks.dash.org:3010 \
org.dash.platform.dapi.v0.Core/getStatus
{
coreVersion: 160001,
protocolVersion: 70218,
blocks: 10761,
timeOffset: 0,
connections: 15,
proxy: '',
difficulty: 0.00139064070266453,
testnet: false,
relayFee: 0.00001,
errors: '',
network: 'testnet'
}
{
"coreVersion": 160001,
"protocolVersion": 70218,
"blocks": 6154,
"connections": 25,
"difficulty": 0.00176467490021852,
"relayFee": 1e-05,
"network": "testnet"
}
getBlock
Returns: A raw block
Parameters:
Name | Type | Required | Description |
---|---|---|---|
One of the following: | |||
hash | Bytes | No | Return the block matching the block hash provided |
height | Integer | No | Return the block matching the block height provided |
Example Request and Response
const DAPIClient = require('@dashevo/dapi-client');
const client = new DAPIClient({
seeds: [{
service: 'seed-1.evonet.networks.dash.org',
port: 3000
}],
});
client.core.getBlockByHeight(1)
.then((response) => console.log(response.toString('hex')));
const {
v0: {
CorePromiseClient,
},
} = require('@dashevo/dapi-grpc');
const corePromiseClient = new CorePromiseClient('http://seed.evonet.networks.dash.org:3010');
corePromiseClient.client.getBlock({ height: 1 })
.then((response) => console.log(response.block.toString('hex')));
const {
v0: {
CorePromiseClient,
},
} = require('@dashevo/dapi-grpc');
const corePromiseClient = new CorePromiseClient('http://seed.evonet.networks.dash.org:3010');
corePromiseClient.client.getBlock({
hash: '5dd32f6c03b041c5e701323ccc92e62ee0b40ac19d214ad721ae5321f1dce38c',
}).then((response) => {
console.log(response.block.toString('hex'));
});
grpcurl -plaintext -proto protos/core/v0/core.proto \
-d '{
"height":1
}' \
seed.evonet.networks.dash.org:3010 \
org.dash.platform.dapi.v0.Core/getBlock
Block Encoding
Note: The gRPCurl response block data is Base64 encoded
040000002e3df23eec5cd6a86edd509539028e2c3a3dc05315eb28f2baa43218ca080000c4b1069b3cf0b36e57a33e4f85c3b5b7b4470b9fda358ae8e04499473c51e205ba968054ffff7f20030000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff10510e6465766e65742d70616c696e6b61ffffffff0100f2052a01000000016a00000000
{
"block": "BAAAAC498j7sXNaobt1QlTkCjiw6PcBTFeso8rqkMhjKCAAAO7rZNoARgNKNj0JldKtFvqTpbdeiOJQXCiDy09a92HO6loBU//9/IAIAAAABAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////8RUQ9kZXZuZXQtZXZvbmV0LTj/////AQDyBSoBAAAAAWoAAAAA"
}
getTransaction
Returns: A raw transaction
Parameters:
Name | Type | Required | Description |
---|---|---|---|
id | String | Yes | A transaction id (TXID) |
Example Request and Response
const {
v0: {
CorePromiseClient,
},
} = require('@dashevo/dapi-grpc');
const corePromiseClient = new CorePromiseClient('http://seed.evonet.networks.dash.org:3010');
const txid = 'a519f41be5de67a917094346e85111d571e198dbd2646c9170358c7439fc2b10';
corePromiseClient.client.getTransaction({ id: txid })
.then((response) => console.log(response.transaction.toString('hex')));
const DAPIClient = require('@dashevo/dapi-client');
const client = new DAPIClient({
seeds: [{
service: 'seed-1.evonet.networks.dash.org',
port: 3000
}],
});
const txid = 'a519f41be5de67a917094346e85111d571e198dbd2646c9170358c7439fc2b10';
client.core.getTransaction(txid)
.then((response) => console.log(response.toString('hex')));
grpcurl -plaintext -proto protos/core/v0/core.proto \
-d '{
"id":"a519f41be5de67a917094346e85111d571e198dbd2646c9170358c7439fc2b10"
}' \
seed.evonet.networks.dash.org:3010 \
org.dash.platform.dapi.v0.Core/getTransaction
Transaction Encoding
Note: The gRPCurl response transaction data is Base64 encoded
02000000012a853bf4bf4965540210b8a1ff11cde1bf17c47b37b1bf97633d81f642136d52010000006a47304402207a6f967119ea7432414a44f26b75c62053626ac6c918781c22e0eca8be6ffd6002201967858618c139a57e417a02c253888f9be79a7d4ca2381054be93141fd31c6e0121029c0d10e04cb436f76fc8223e1c7a37601f1d097a059674a45391f19b642a8e17feffffff0200e1f505000000001976a914f862c9d89384b14139d79b485dde663a5a02268f88ac9c3260f6000000001976a91417b2e8501e9f956575102c5ba87d15de9dcd5bb088ac0f180000
{
"transaction": "AgAAAAEqhTv0v0llVAIQuKH/Ec3hvxfEezexv5djPYH2QhNtUgEAAABqRzBEAiB6b5ZxGep0MkFKRPJrdcYgU2JqxskYeBwi4Oyovm/9YAIgGWeFhhjBOaV+QXoCwlOIj5vnmn1MojgQVL6TFB/THG4BIQKcDRDgTLQ292/IIj4cejdgHx0JegWWdKRTkfGbZCqOF/7///8CAOH1BQAAAAAZdqkU+GLJ2JOEsUE515tIXd5mOloCJo+IrJwyYPYAAAAAGXapFBey6FAen5VldRAsW6h9Fd6dzVuwiKwPGAAA"
}
subscribeToTransactionsWithProofs
Updated in Dash Platform v0.15.0
This endpoint was moved into the Core gRPC service (from the Transaction Filter Stream service) to consolidate all Core-related endpoints together.
Returns: streams the requested transaction information
Parameters:
Name | Type | Required | Description |
---|---|---|---|
bloom_filter.v_data | Bytes | Yes | The filter itself is simply a bit field of arbitrary byte-aligned size. The maximum size is 36,000 bytes |
bloom_filter.n_hash_funcs | Integer | Yes | The number of hash functions to use in this filter. The maximum value allowed in this field is 50 |
bloom_filter.n_tweak | Integer | Yes | A random value to add to the seed value in the hash function used by the bloom filter |
bloom_filter.n_flags | Integer | Yes | A set of flags that control how matched items are added to the filter |
---------- | |||
One of the following: | |||
from_block_hash | Bytes | No | Return records beginning with the block hash provided |
from_block_height | Integer | No | Return records beginning with the block height provided |
---------- | |||
count | Integer | No | Number of blocks to sync. If set to 0 syncing is continuously sends new data as well (default: 0) |
send_transaction_hashes * | Boolean | No |
Example Request and Response
grpcurl -proto protos/core/v0/core.proto -plaintext \
-d '{
"from_block_height": 1,
"count": 1,
"bloom_filter": {
"n_hash_funcs": 11,
"v_data": "",
"n_tweak": 0,
"n_flags": 0
}
}' \
seed.evonet.networks.dash.org:3010 \
org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs
{
"rawTransactions": {
"transactions": [
"AQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////8RUQ9kZXZuZXQtZXZvbmV0LTT/////AQDyBSoBAAAAAWoAAAAA"
]
}
}
{
"rawMerkleBlock": "BAAAAC498j7sXNaobt1QlTkCjiw6PcBTFeso8rqkMhjKCAAAD0Oosr0gDJvAxHZ2Y+4dtsmO+XenCUNNoIX0W06eoW26loBU//9/IAAAAAABAAAAAQ9DqLK9IAybwMR2dmPuHbbJjvl3pwlDTaCF9FtOnqFtAQE="
}
Deprecated Endpoints
sendTransaction
Deprecated RPC
Renamed to
broadcastTransaction
in Dash Platform v0.15.0
Code Reference
Implementation details related to the information on this page can be found in:
- The DAPI repository
lib/grpcServer/handlers/core
folder - The DAPI-gRPC repository
protos
folder
Updated almost 4 years ago