BLOCd

JSON RPC API

BLOCd daemon provides a JSON RPC API used to receive informations from the blockchain allowing it to be controlled locally or remotely which makes it useful for integration with other software or in larger payment systems. Various commands are made available by the API described on this page.

BLOCd JSON RPC API

Used to receive informations from the blockchain

Start BLOCd with arguments and use this page to connect to your BLOCd node or enter the details to connect to a BLOCd public node. Make sure you enter the address exactly like on the exemple. Once connected, you will be able to use all the functions described below.

  • Enter the requested input for each function
  • Send command direcly to a remote BLOCd node using the RPC port

A simple way to test your application or/and connect to a BLOCd remote node and send commands.

Note: We are not saving any logs/requests on this website. Only you see the outputs.


Example: http://0.0.0.0:2086/json_rpc



{API}
BLOC-DAEMON

BLOC integration

Make sure you follow this instructions before getting started with BLOC

BLOC integration process may differes from other cryptocurrencies. Firstly, the coin has three separate binaries:

 

 

We also support the following official client bindings:

 

 

Please click on each of the service you would like to use to see how does it work and how to implement BLOC into your application and/or website.



{API}
BLOC - DAEMON

Getting started

Use the form below to test the integration of the BLOCd API into your application. Make sure you have filled the connexion details at the top of this page.

This section describes BLOCd daemon integration process into your service with BLOCd JSON RPC API. We also have available the BLOCd HTTP RPC API if you need.

 

Make sure you have started BLOCd with the correct arguments before using the following functions. You can also check out the list of the BLOCd inline commands available.

 

To start the Daemon JSON RPC API server at http://localhost:2086, run:

./BLOCd --rpc-bind-port=2086

 

To make the server accessible from another computer, use the --rpc-bind-ip 0.0.0.0switch.

./BLOCd --rpc-bind-ip=0.0.0.0 --rpc-bind-port=2086

 

To enable block explorer API access (like for getblocks, gettransactionpool, etc.), use the --enable_blockexplorer switch.

./BLOCd --enable-blockexplorer

 

The above given switches can be combined to achieve remote access with block explorer methods as shown below.

./BLOCd --enable-blockexplorer --rpc-bind-ip=0.0.0.0 --rpc-bind-port=2086

 

To make a JSON RPC request to your BLOCd node you should use a POST request that looks like this:

 

http://<service address>:<service port>/json_rpc

 

Where:

  • <service address> is an IP of BLOCd node, if BLOCd is located on local machine it is either 127.0.0.1 or localhost,
  • <service port> is BLOCd RPC port, by default it is binded to 2086 port, but it can be manually binded to any port you want, read more about this here.

 

Make sure you have filled the connexion details at the top of this page. Once you are ready, scroll down until your favorite function, fill the details and click TRY IT OUT button to send the request and get the the response.

 



Implementation Notes

on_getblockhash() method returns block hash for a given height off by one.


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
height Yes The height of the block whose previous hash is to be retrieved. integer 104357

Output Parameters 1 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
result Hash of previous block integer

TRY IT OUT

Example : 104357



curl -d '{"jsonrpc":"2.0","method":"on_getblockhash","params":[_params_]}' http://machine.domain:port/json_rpc

<?php
$height = 1000;
$response = $blocd->getBlockHash($height);
echo $response;

daemon.getBlockHash({
  height: 1000
}).then((blockHash) => {
  // do something
}).catch((error) => {
  // do something
})

height := 1000
response := daemon.GetBlockHash(height)
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":"d51c775685b602c38fa02e05f7534e25b9540ff87d0b96a716ff70e7752e0cbd"
}

Implementation Notes

getblocktemplate(reserve_size, addr) method returns blocktemplate with an empty "hole" for nonce.


Input Parameters 2 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
reserve_size Yes Block reserve size to be specified integer 200
wallet_address Yes Valid BLOC wallet address string abLocv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ

Output Parameters 5 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
blocktempate_blob Blocktemplate with empty "hole" for nonce string
difficulty Difficulty of the network integer
height Blockchain height of the network integer
reserved_offset Offset reserved integer
status Status of the network string

TRY IT OUT

Example : 200

Example : abLocv1pacKFJk9QgSmzk2LJWn14JGmTKzReFLz1RgY3K9Ryn7783RDT2TretzfYdck5GMCGzXTuwKfePWQYViNs4avKpnUbrwfQ



curl -d '{"jsonrpc":"2.0","method":"getblocktemplate","params":{_params_}' http://machine.domain:port/json_rpc

<?php
$reserveSize = 200;
$address = 'abLocyyy...';
$response = $blocd->getBlockTemplate($reserveSize, $address);
echo $response;

daemon.getBlockTemplate({
  reserveSize: 200,
  walletAddress: 'abLocyyy.....'
}).then((blockTemplate) => {
  // do something
}).catch((error) => {
  // do something
})

reserveSize := 200
walletAddress := "abLocyyy..."

response := daemon.GetBlockTemplate(reserveSize, walletAddress)
fmt.Println(response)

Expected Output

{
    "jsonrpc": "2.0",
    "result": {
        "blocktemplate_blob": "0400293f62342d2b17d9bd9...",
        "difficulty": 51474062,
        "height": 104369,
        "reserved_offset": 305,
        "status": "OK"
    }
}

Implementation Notes

submitblock(block_blob) method submits mined block.


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
blockBlob Yes block blob of the mined block string b93d05763e3ead8b1992c46a33674c5579618aee9d347b4cd92aba5c37913453

Output Parameters 1 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
status Status of request string

TRY IT OUT

Example : b93d05763e3ead8b1992c46a33674c5579618aee9d347b4cd92aba5c37913453



curl -d '{"jsonrpc":"2.0","method":"submitblock","params":[_params_]}' http://machine.domain:port/json_rpc

<?php
$blockBlob = '0100b...';
$response = $blocd->submitBlock($blockBlob);
echo $response;

daemon.submitBlock({
  blockBlob: '...'
}).then((result) => {
  // do something
}).catch((error) => {
  // do something
})

blockBlob := "0100b..."
response := daemon.SubmitBlock(blockBlob)
fmt.Println(response)

Expected Output

{
    "jsonrpc": "2.0",
    "result": {
        "status" : "OK"
    }
}

Implementation Notes

getlastblockheader () method returns the last block header


There are no inputs for this Function


Output Parameters 14 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
block_size size of the block integer
depth height away from the known top block integer
difficulty difficulty of the last block integer
hash hash of the last block string
height height of the last block integer
major_version Major version integer
minor_version Minor version integer
nonce Nonce integer
num_txs Number of transactions in the block integer
orphan_status whether the last block was an orphan or not bool
prev_hash hash of the previous block string
reward reward of the block string
timestamp the time at which the block is occured on chain since Unix epoch integer
status status of the request string

TRY IT OUT



curl -d '{"jsonrpc":"2.0","method":"getlastblockheader","params":_params_}' http://machine.domain:port/json_rpc

<?php
$response = $blocd->getLastBlockHeader();
echo $response;

daemon.getLastBlockHeader().then((result) => {
  // do something
}).catch((error) => {
  // do something
})

response := daemon.GetLastBlockHeader()
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
    "block_header": {
    "block_size": 419,
    "depth": 0,
    "difficulty": 200671816,
    "hash": "7d6db7b77232d41c19d898e81c85ecf08c4e8dfa3434f975a319f6261a695739",
    "height": 502345,
    "major_version": 4,
    "minor_version": 0,
    "nonce": 130876,
    "num_txes": 1,
    "orphan_status": false,
    "prev_hash": "5af657331edff98791720c23aacf72e8b6247ddba2a5c42c93984a46946abd14",
    "reward": 2935955,
    "timestamp": 1527907348
  },
  "status": "OK"
    }
}

Implementation Notes

getblockheaderbyhash() returns block header by given block hash


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
hash Yes The block hash to find string 9840215c7c13292abb7e8976a747777ea13be458ae49a88faded1d4090cfe90c

Output Parameters 14 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
block_size size of the block integer
depth height away from the known top block integer
difficulty difficulty of the requested block integer
hash hash of the requested block string
height height of the requested block integer
major_version Major version integer
minor_version Minor version integer
nonce Nonce integer
num_txs Number of transactions in the block integer
orphan_status whether the requested block was an orphan or not bool
prev_hash hash of the previous block string
reward reward of the block string
timestamp the time at which the block is occured on chain since Unix epoch integer
status status of the request string

TRY IT OUT

Example : 9840215c7c13292abb7e8976a747777ea13be458ae49a88faded1d4090cfe90c



curl -d '{"jsonrpc":"2.0","method":"getblockheaderbyhash","params":{params}}' http://machine.domain:port/json_rpc

<?php
$hash = '30706...';
$response = $blocd->getBlockHeaderByHash($hash);
echo $response;

daemon.getBlockHeaderByHash({
  hash: '5339e77b028a29ace5cfb2d94c1fe869dd810aed3a9d7e1280aa192311e427e5'
}).then((result) => {
  // do something
}).catch((error) => {
  // do something
})

hash := "30706..."
response := daemon.GetBlockHeaderByHash(hash)
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
     "result":{
   block_size: 2911,
  depth: 6,
  difficulty: 51474062,
  hash:
   '9840215c7c13292abb7e8976a747777ea13be458ae49a88faded1d4090cfe90c',
  height: 104369,
  major_version: 4,
  minor_version: 0,
  nonce: 1534084014,
  num_txes: 2,
  orphan_status: false,
  prev_hash:
   '293f62342d2b17d9bd9ab9450e74998600b2c401b42b3e94b689c495c4c49f64',
  reward: 204160,
  timestamp: 1540811301 }

"status":"OK"
    }
}

Implementation Notes

getblockheaderbyheight() method returns block header by given block height


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
height No the block height to find integer 100000

Output Parameters 14 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
block_size size of the block integer
depth height away from the known top block integer
difficulty difficulty of the requested block integer
hash hash of the requested block string
height height of the requested block integer
major_version Major version integer
minor_version Minor version integer
nonce Nonce integer
num_txs Number of transactions in the block integer
orphan_status whether the requested block was an orphan or not bool
prev_hash hash of the previous block string
reward reward of the block string
timestamp the time at which the block is occured on chain since Unix epoch integer
status status of the request string

TRY IT OUT

Example : 100000



curl -d '{"jsonrpc":"2.0","method":"getblockheaderbyheight","params":{params}}' http://machine.domain:port/json_rpc

<?php
$height = 10000;
$response = $blocd->getBlockHeaderByHeight($height);
echo $response;

daemon.getBlockHeaderByHeight({
  height: 10000
}).then((result) => {
  // do something
}).catch((error) => {
  // do something
})

height := 10000
response := daemon.GetBlockHeaderByHeight(height)
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
        "block_header":{
            "block_size": 3045,
            "depth": 4377,
            "difficulty": 36580703,
            "hash":"e026316d0b95436a7d3d36247fc8adb5fcb342015eccc239b346a7e2fd64c262",
            "height": 100000,
            "major_version":4,
            "minor_version":0,
            "nonce": 12925874,
            "num_txes":2,
            "orphan_status":false,
            "prev_hash":"9d982868dcec3c1c2913fbb96b40c9b872edd79a137d0f8097d252f1a7dcf50a",
            "reward": 205585,
            "timestamp": 1540279968
        },
    "status":"OK"
    }
}

Implementation Notes

getcurrencyid() method returns unique currency identifier.


There are no inputs for this Function


Output Parameters 1 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
currency_id_blob unique currency identifier string

TRY IT OUT



curl -d '{"jsonrpc":"2.0","method":"getcurrencyid","params":{params}}' http://machine.domain:port/json_rpc

<?php
$response = $blocd->getCurrencyId();
echo $response;

daemon.getCurrencyId().then((result) => {
  // do something
}).catch((error) => {
  // do something
})

response := daemon.GetCurrencyID()
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
        "currency_id_blob":"acd5682403287ad25d94769adb80fbcd45de591ecfd5c86d5176bb9a10ff5baa"
    }
}

Implementation Notes

getblocks() method returns information on the last 30 blocks from height (inclusive)


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
height Yes height of the blockchain to be included in the result. integer 104326

Output Parameters 8 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
status status of the request string
blocks array
blocks.cumul_size size of the block integer
blocks.difficulty difficulty of the block integer
blocks.hash hash of the block string
blocks.height height of the block integer
blocks.timestamp the time at which the block is occured on the chain since Unix epoch integer
blocks.tx_count number of transactions in the block integer

TRY IT OUT

Example : 104326



curl -d '{"jsonrpc":"2.0","method":"f_blocks_list_json","params":{params}}' http://machine.domain:port/json_rpc

<?php
$height = 10000;
$response = $blocd->getBlocks($height);
echo $response;

daemon.getBlocks({
  height: 10000
}).then((blocks) => {
  // do something
}).catch((error) => {
  // do something
})

height := 10000
response := daemon.GetBlocks(height)
fmt.Println(response)

Expected Output

{
    "jsonrpc": "2.0",
    "result": {
        "blocks":[ { cumul_size: 1742,
    difficulty: 47134552,
    hash:
     'a4ee6bc0613b131ab9642c4090542bf906284a614e5a6041915127536d6bcbc0',
    height: 104326,
    timestamp: 1540806279,
    tx_count: 2 },
  { cumul_size: 355,
    difficulty: 47531254,
    hash:
     '9bc5b82452047a3475dc90796900ee6c78a7b971f0d36409328630787dbd4664',
    height: 104325,
    timestamp: 1540806195,
    tx_count: 1 },
  { cumul_size: 346,
    difficulty: 46081092,
    hash:
     '6986fc750946f7e20191d2a231853e7091de5dd34c4d7afa01ab686a54fe1ac0',
    height: 104324,
    timestamp: 1540806047,
    tx_count: 1 },
  { cumul_size: 16569,
    difficulty: 45398503,
    hash:
     '547879344dd593c3ad426f23f441b87a9fe939a797426656e6e3f2230da7507c',
    height: 104296,
    timestamp: 1540803334,
    tx_count: 1 } ]
        "status": "OK"
    }
}

Implementation Notes

getblock() method returns information on a single block


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
hash Yes Block hash you wish to retreive string d8a24f43719a1088c9311dbbef17cef5141fa02bf29986a38dae59e20297c768

Output Parameters 26 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
alreadyGeneratedCoins total number of coins generated in the network upto that block string
alreadyGeneratedTransactions total number of transactions present in the network upto that block integer
baseReward calculated reward integer
block_size size of the block integer
depth height away from the known top block integer
difficulty difficulty of the requested block integer
effectiveSizeMedian fixed constant for max size of block integer
hash hash of the requested block string
height height of the requested block integer
major_version Major version integer
minor_version Minor version integer
nonce Nonce integer
orphan_status whether the requested block was an orphan or not bool
penalty penalty in block reward determined for deviation string
prev_hash hash of the previous block string
reward total reward of the block after removing penalty string
sizeMedian calculated median size from last 100 blocks integer
timestamp the time at which the block is occured on chain since Unix epoch integer
totalFeeAmount total fees for the transactions in the block integer
transactions Array of transactions in the block array
transactionsCumulativeSize total sum of size of all transactions in the block integer
status status of the request string
transactions.amount_out output amount of the transaction string
transactions.fee fees for the transaction string
transactions.hash hash of the transaction string
transactions.size size of the transaction string

TRY IT OUT

Example : d8a24f43719a1088c9311dbbef17cef5141fa02bf29986a38dae59e20297c768



curl -d '{"jsonrpc":"2.0","method":"f_block_json","params":{params}}' http://machine.domain:port/json_rpc

<?php
$hash = '980ff...';
$response = $blocd->getBlock($hash);
echo $response;

daemon.getBlock({
  hash: '5439e.....'
}).then((block) => {
  // do something
}).catch((error) => {
  // do something
})

hash := "980ff..."
response := daemon.GetBlock(hash)
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
        "block":{
            "alreadyGeneratedCoins: '71833702006',
  alreadyGeneratedTransactions: 339705,
  baseReward: 204165,
  blockSize: 3079,
  depth: 30,
  difficulty: 43080047,
  effectiveSizeMedian: 1000000,
  hash:
   'd8a24f43719a1088c9311dbbef17cef5141fa02bf29986a38dae59e20297c768',
  height: 104304,
  major_version: 4,
  minor_version: 0,
  nonce: 83887409,
  orphan_status: false,
  penalty: 0,
  prev_hash:
   '6dc529cbafdd441a2ae31bea908902d3eb833499f681265bbe2ebf800daed120',
  reward: 204168,
  sizeMedian: 236,
  timestamp: 1540803975,
  totalFeeAmount: 3,
  transactions:
   [ { amount_out: 204168,
       fee: 0,
       hash:
        '3db2b990e500fe07d44f7599483120ba989fad2a9fc5574178f7d399c185c4d9',
       size: 236 },
     { amount_out: 100000,
       fee: 1,
       hash:
        'c6bbf4754a31dc1821a6bce7fc0e9bdf2fe164b86c156eb24145ae8b7538a266',
       size: 452 },
     { amount_out: 60099,
       fee: 1,
       hash:
        '0d009323d3bc7d223d56dda487b174dc9a6e25c31861288a58ef1dd77e9e8b31',
       size: 487 },
     { amount_out: 338373,
       fee: 1,
       hash:
        'd2b4d1d314b0a3627b0853b9083a42c141aaae8998718a28605d981c912a1a9d',
       size: 1689 } ],
  transactionsCumulativeSize: 2864
        },
        "status":"OK"
    }
}

Implementation Notes

gettransaction() method returns information on single transaction.


Input Parameters 1 inputs
Only display the first 3 inputs. Click for more inputs.

Argument Mandatory Description Format Example
hash Yes hash of the transaction string 4c4d2ddb0277ce958ab41228ca24fa609c47d658d2955005d822ae697fba999d

Output Parameters 21 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
block details of the block in which transaction is present json
status status of the request string
tx sub-transactions in the transaction json
txDetails details of the transaction json
block.cumul_size size of the block string
block.difficulty difficulty of the block integer
block.hash hash of the block string
block.height height of the block integer
block.timestamp the time at which the block is occured on chain since Unix epoch integer
block.tx_count number of transactions in the block integer
transaction.amount_out total amount present in the transaction integer
transaction.fee total fees of the transaction integer
transaction.hash hash of the transaction string
transaction.mixin mixin of the transaction integer
transaction.paymentId payment Id of the transaction string
transaction.size total size of the transaction integer
transaction.extra Transaction extra which can be any information in hex string
transaction.unlocktime delay in unlocking the amount integer
transaction.version integer
transaction.vin array of input transactions array
transaction.vout array of output transactions array

TRY IT OUT

Example : 4c4d2ddb0277ce958ab41228ca24fa609c47d658d2955005d822ae697fba999d



curl -d '{"jsonrpc":"2.0","method":"f_transaction_json","params":{{params}}' http://machine.domain:port/json_rpc

<?php
$hash = '702ad...';
$response = $blocd->getTransaction($hash);
echo $response;

daemon.getTransaction({
  hash: '665d5cdd1aab703c0bfd872333ba26a65b282a76600da46260e39300565d9f5a'
}).then((transaction) => {
  // do something
}).catch((error) => {
  // do something
})

hash := "702ad..."
response := daemon.GetTransaction(hash)
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
        "block:
   { cumul_size: 2277,
     difficulty: 42725128,
     hash:
      'c11c3f9f8e6376585cf598906541051f07ed49a877a0884e2c8e757cac9af156',
     height: 104343,
     timestamp: 1540808154,
     tx_count: 3 },
  status: 'OK',
  tx:
   { '':
      '967bb63721cb2f6e2c15318674bd2cc2aa8ee1eb7d922b0bd76febf1ea85240186b79ace51c646a20f97495509510ae70620129f055dd8ea3b07116c8e07da0a',
     extra:
      '013c12608a04af937e0197972a22e4700f8f572b44af9a8b806ee410a11fcdbde0',
     unlock_time: 0,
     version: 1,
     vin: [ [Object] ],
     vout: [ [Object], [Object], [Object], [Object], [Object] ] },
  txDetails:
   { amount_out: 9999,
     fee: 1,
     hash:
      '4c4d2ddb0277ce958ab41228ca24fa609c47d658d2955005d822ae697fba999d',
     mixin: 4,
     paymentId: '',
     size: 515
        }
    }
}

Implementation Notes

gettransactionpool() returns the list of transaction hashes present in mempool (waiting to be included into the next block)


There are no inputs for this Function


Output Parameters 2 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
status status of the request string
transactions array of transactions in mempool array

TRY IT OUT



curl -d '{"jsonrpc":"2.0","method":"f_on_transactions_pool_json","params":{params}}' http://machine.domain:port/json_rpc

<?php
$response = $blocd->getTransactionPool();
echo $response;

daemon.getTransactionPool().then((transactions) => {
  // do something
}).catch((error) => {
  // do something
})

response := daemon.GetTransactionPool()
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
        "status":"OK",
        "transactions":[ { amount_out: 234320,
    fee: 1,
    hash:
     'f45737c88670722e7d71fbba46d44abddf5e9d35115b0df22a071beb82db294f',
    size: 934 },
  { amount_out: 59000,
    fee: 0,
    hash:
     '4d960625ccf1d29e53ec875b80914ce3a51c3db5192f98c4b80becd3b580a6dc',
    size: 1448 } ]
    }
}

Implementation Notes

getblockcount() method returns the current chain height.


There are no inputs for this Function


Output Parameters 2 outputs
Only display the first 3 outputs. Click for more outputs.

Argument Description Format
count Current blockchain height integer
status Status of request string

TRY IT OUT



curl -d '{"jsonrpc":"2.0", "method":"getblockcount", "params":{params}}' http://localhost:2086/json_rpc

<?php
$response = $blocd->getBlockCount();
echo $response;

daemon.getBlockCount().then((blockCount) => {
  // do something
}).catch((error) => {
  // do something
})

response := daemon.GetBlockCount()
fmt.Println(response)

Expected Output

{
    "jsonrpc":"2.0",
    "result":{
        "count": 104357,
        "status":"OK"
    }
}