# OctaCore.BlocksApi

All URIs are relative to *https://api.octacore.io*

Method | HTTP request | Description
------------- | ------------- | -------------
[**getAllTransactionsByBlockHashPost**](BlocksApi.md#getAllTransactionsByBlockHashPost) | **POST** /getAllTransactionsByBlockHash | getAllTransactionsByBlockHash
[**getAllTransactionsByBlockNumberPost**](BlocksApi.md#getAllTransactionsByBlockNumberPost) | **POST** /getAllTransactionsByBlockNumber | getAllTransactionsByBlockNumber
[**getBlockDataByHashPost**](BlocksApi.md#getBlockDataByHashPost) | **POST** /getBlockDataByHash | getBlockDataByHash
[**getBlockDataByNumberPost**](BlocksApi.md#getBlockDataByNumberPost) | **POST** /getBlockDataByNumber | getBlockDataByNumber
[**getBlockHeaderByHashPost**](BlocksApi.md#getBlockHeaderByHashPost) | **POST** /getBlockHeaderByHash | Returns the block header.
[**getBlockHeaderByNumberPost**](BlocksApi.md#getBlockHeaderByNumberPost) | **POST** /getBlockHeaderByNumber | getBlockHeaderByNumber
[**getLatestBlockNumberPost**](BlocksApi.md#getLatestBlockNumberPost) | **POST** /getLatestBlockNumber | getLatestBlockNumber
[**getTransactionCountByBlockHashPost**](BlocksApi.md#getTransactionCountByBlockHashPost) | **POST** /getTransactionCountByBlockHash | getTransactionCountByBlockHash


<a name="getAllTransactionsByBlockHashPost"></a>
# **getAllTransactionsByBlockHashPost**
> getAllTransactionsByBlockHashPost(chain, input)

getAllTransactionsByBlockHash

The /getAllTransactionsByBlockHash API endpoint allows you to retrieve all transactions included in a specific block on the blockchain, based on the block's hash. A block hash is a unique identifier that is generated for each block, and can be used to look up the block and its contents on the blockchain. ### Use cases: + Displaying the transactions of a specific block on a blockchain explorer. + Allowing a user to view the transactions included in a specific block within a decentralized application.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsHash(); // ModelsHash | Block Hash


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getAllTransactionsByBlockHashPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsHash**](ModelsHash.md)| Block Hash | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getAllTransactionsByBlockNumberPost"></a>
# **getAllTransactionsByBlockNumberPost**
> getAllTransactionsByBlockNumberPost(chain, input)

getAllTransactionsByBlockNumber

Returns all transactions of the block from the network based on the provided block number. The /getAllTransactionsByBlockNumber API endpoint allows you to retrieve all transactions included in a specific block on the blockchain, based on the block's number. The block number is the sequential index of a block within the blockchain, starting from 0 for the genesis block. ### Use cases: + Displaying the transactions of a specific block on a blockchain explorer. + Allowing a user to view the transactions included in a specific block within a decentralized application.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsBlockNumber(); // ModelsBlockNumber | Block Number


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getAllTransactionsByBlockNumberPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsBlockNumber**](ModelsBlockNumber.md)| Block Number | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getBlockDataByHashPost"></a>
# **getBlockDataByHashPost**
> getBlockDataByHashPost(chain, input)

getBlockDataByHash

Returns the block from the network based on the provided hash. The /getBlockDataByHash API endpoint allows you to retrieve the data of a specific block on the blockchain, based on the block's hash. A block hash is a unique identifier that is generated for each block, and can be used to look up the block and its contents on the blockchain. ### Use cases: + Displaying the data of a specific block on a blockchain explorer.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsHash(); // ModelsHash | Block Hash


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getBlockDataByHashPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsHash**](ModelsHash.md)| Block Hash | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getBlockDataByNumberPost"></a>
# **getBlockDataByNumberPost**
> getBlockDataByNumberPost(chain, input)

getBlockDataByNumber

Returns the block from the network based on the provided block number. The /getBlockDataByHash API endpoint allows you to retrieve the data of a specific block on the blockchain, based on the block's number. ### Use cases: + Displaying the data of a specific block on a blockchain explorer.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsBlockNumber(); // ModelsBlockNumber | Block Number


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getBlockDataByNumberPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsBlockNumber**](ModelsBlockNumber.md)| Block Number | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getBlockHeaderByHashPost"></a>
# **getBlockHeaderByHashPost**
> getBlockHeaderByHashPost(chain, input)

Returns the block header.

Returns the block header. This endpoint takes block hash as input. The /getBlockHeaderByHash API endpoint allows you to retrieve the header of a specific block on the blockchain, based on the block's hash. The block header contains basic information about the block, such as its number, timestamp, and the hash of the previous block. ### Use cases: + Displaying the header of a specific block on a blockchain explorer. + Allowing a user to view the header of a specific block within a decentralized application.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsHash(); // ModelsHash | Block Hash


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getBlockHeaderByHashPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsHash**](ModelsHash.md)| Block Hash | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getBlockHeaderByNumberPost"></a>
# **getBlockHeaderByNumberPost**
> getBlockHeaderByNumberPost(chain, input)

getBlockHeaderByNumber

Returns the block from the network based on the provided block number. The /getBlockDataByHash API endpoint allows you to retrieve the data of a specific block on the blockchain, based on the block's number. ### Use cases: + Displaying the data of a specific block on a blockchain explorer.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsBlockNumber(); // ModelsBlockNumber | Block Hash


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getBlockHeaderByNumberPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsBlockNumber**](ModelsBlockNumber.md)| Block Hash | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getLatestBlockNumberPost"></a>
# **getLatestBlockNumberPost**
> getLatestBlockNumberPost()

getLatestBlockNumber

Returns the latest block number from ethereum chain. The /getLatestEthBlockNumber API endpoint allows you to retrieve the number of the most recent block on the Ethereum blockchain. The block number is the sequential index of a block within the blockchain, starting from 0 for the genesis block. ### Use cases: + Displaying the latest block number on a blockchain explorer. + Allowing a user to stay up-to-date with the latest block within a decentralized application.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getLatestBlockNumberPost(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getTransactionCountByBlockHashPost"></a>
# **getTransactionCountByBlockHashPost**
> getTransactionCountByBlockHashPost(chain, input)

getTransactionCountByBlockHash

Returns the number of transactions in a block. This endpoint takes the block hash as input. The /getTransactionCountByBlockHash API endpoint allows you to retrieve the number of transactions included in a specific block on the blockchain, based on the block's hash. A block hash is a unique identifier that is generated for each block, and can be used to look up the block and its contents on the blockchain. ### Use cases: + Displaying the number of transactions in a specific block on a blockchain explorer. + Allowing a user to view the number of transactions included in a specific block within a decentralized application.

### Example
```javascript
var OctaCore = require('octa_core');
var defaultClient = OctaCore.ApiClient.instance;

// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix = 'Token';

var apiInstance = new OctaCore.BlocksApi();

var chain = "chain_example"; // String | Chain to be requested in.

var input = new OctaCore.ModelsHash(); // ModelsHash | Block Hash


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.getTransactionCountByBlockHashPost(chain, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **chain** | **String**| Chain to be requested in. | 
 **input** | [**ModelsHash**](ModelsHash.md)| Block Hash | 

### Return type

null (empty response body)

### Authorization

[JWT](../README.md#JWT)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

