Skip to main content

🎯Blocks API Endpoints

Notes

Endpoints with πŸ…ΏπŸ†πŸ…Ύ are under the API Pro subscription. To upgrade your API plan, browse through the BscScan APIs page.

//imports
using BscScan.NetCore.Contracts;

//inject
private readonly IBscScanBlocksService _bscScanBlocksService;

πŸ“¦Get Block Rewards by BlockNo​

Returns the block reward awarded for validating a certain block.​

//Sample Request 🍎

var blockRewards =
await _bscScanBlocksService.GetBlockRewardsByBlockNoAsync(2170000);

πŸ“¦Get Estimated Block Countdown Time by BlockNo​

Returns the estimated time remaining, in seconds, until a certain block is validated.​

//Sample Request 🍎

var estimatedBlockCountdownTime =
await _bscScanBlocksService.GetEstimatedBlockCountdownTimeByBlockNoAsync(119268990);

πŸ“¦Get Block Number by Timestamp​

Returns the block number that was validated at a certain timestamp.​

//Sample Request 🍎

var blockNumber =
await _bscScanBlocksService.GetBlockNumberByTimestampAsync(1601510400);

πŸ“¦Get Daily Average Block Size πŸ…ΏπŸ†πŸ…Ύβ€‹

Returns the daily average block size within a date range.​

//Sample Request 🍎

var parameters = new DailyAverageBlockSizeRequest
{
StartDate = new DateOnly(2021,8,1),
EndDate = new DateOnly(2021,8,31),
Sort = Sort.Asc
};
var avgBlockSize =
await _bscScanBlocksService.GetDailyAverageBlockSizeAsync(parameters);

πŸ“¦Get Daily Block Count and Rewards πŸ…ΏπŸ†πŸ…Ύβ€‹

Returns the number of blocks validated daily and the amount of block rewards.​

//Sample Request 🍎

var parameters = new DailyBlockCountAndRewardRequest
{
StartDate = new DateOnly(2021,8,1),
EndDate = new DateOnly(2021,8,31),
Sort = Sort.Asc
};
var dailyBlockCountAndRewards =
await _bscScanBlocksService.GetDailyBlockCountsAndRewardsAsync(parameters);

πŸ“¦Get Daily Block Rewards πŸ…ΏπŸ†πŸ…Ύβ€‹

Returns the amount of block rewards distributed to validators daily.​

//Sample Request 🍎

var parameters = new DailyBlockRequest
{
StartDate = new DateOnly(2021,8,1),
EndDate = new DateOnly(2021,8,31),
Sort = Sort.Asc
};
var dailyBlockRewards =
await _bscScanBlocksService.GetDailyBlockRewardsAsync(parameters);

πŸ“¦Get Daily Average Time for A Block to be Included in the BNB Smart Chain πŸ…ΏπŸ†πŸ…Ύβ€‹

Returns the daily average of time needed for a block to be successfully validated.​

//Sample Request 🍎

var parameters = new DailyBlockRequest
{
StartDate = new DateOnly(2021,8,1),
EndDate = new DateOnly(2021,8,31),
Sort = Sort.Asc
};
var dailyAvgBlockRewards =
await _bscScanBlocksService.GetDailyAverageTimeForABlockAsync(parameters);