π―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.β
- Request
- Response
- ...
//Sample Request π
var blockRewards =
await _bscScanBlocksService.GetBlockRewardsByBlockNoAsync(2170000);
//will return a new object BlockRewards with values: π
var blockRewards = new BlockRewards {
Staus="1",
Message="OK",
Result= new BlockRewardData{
BlockNumber = "2170000",
TimeStamp ="1605182836",
BlockMiner ="0x68bf0b8b6fb4e317a0f9d6f03eaf8ce6675bc60d",
BlockReward ="13657915000000000",
Uncles = null, // List<string>
UncleInclusionReward = "0"
}
};
π For more information Check out Get Block Rewards by BlockNo
π¦Get Estimated Block Countdown Time by BlockNoβ
Returns the estimated time remaining, in seconds, until a certain block is validated.β
- Request
- Response
- ...
//Sample Request π
var estimatedBlockCountdownTime =
await _bscScanBlocksService.GetEstimatedBlockCountdownTimeByBlockNoAsync(119268990);
//will return a new object EstimatedBlockCountdownTime with values: π
var estimatedBlockCountdownTime = new EstimatedBlockCountdownTime {
Staus="1",
Message="OK",
Result= new EstimatedBlockCountdownTimeData{
CurrentBlock = "15911100",
CountdownBlock ="119268990",
RemainingBlock ="103357890",
EstimateTimeInSec ="10073685.0"
}
};
π For more information Check out Get Estimated Block Countdown Time by BlockNo
π¦Get Block Number by Timestampβ
Returns the block number that was validated at a certain timestamp.β
- Request
- Response
- ...
//Sample Request π
var blockNumber =
await _bscScanBlocksService.GetBlockNumberByTimestampAsync(1601510400);
//will return a new object BlockNumber with values: π
var blockNumber = new BlockNumber {
Staus="1",
Message="OK",
Result= "946206"
};
π For more information Check out Get Block Number by Timestamp
π¦Get Daily Average Block Size π
Ώππ
Ύ
β
Returns the daily average block size within a date range.β
- Request
- Response
- ...
//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);
//will return a new object DailyAverageBlockSize with values: π
var avgBlockSize = new DailyAverageBlockSize {
Staus="1",
Message="OK",
Result= new List<DailyAverageBlockSizeData>
{
new()
{
UTCDate = "2021-08-01",
UnixTimeStamp = "1627776000",
BlockSizeBytes = 96364
},
new()
{
UTCDate = "2021-08-02",
UnixTimeStamp = "1627862400",
BlockSizeBytes = 94832
},
new()
{
UTCDate = "2021-08-31",
UnixTimeStamp = "1630368000",
BlockSizeBytes = 90159
}
}
};
π For more information Check out Get Daily Average Block Size `π
Ώππ
Ύ`
π¦Get Daily Block Count and Rewards π
Ώππ
Ύ
β
Returns the number of blocks validated daily and the amount of block rewards.β
- Request
- Response
- ...
//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);
//will return a new object DailyBlockCountAndRewards with values: π
var dailyBlockCountAndRewards = new DailyBlockCountAndRewards {
Staus="1",
Message="OK",
Result= new List<DailyBlockCountAndRewardsData>
{
new()
{
UTCDate = "2021-08-01",
UnixTimeStamp = "1627776000",
BlockCount = 27783,
BlockRewardsEth = "9216.309553593894910979"
},
new()
{
UTCDate = "2021-08-02",
UnixTimeStamp = "1627862400",
BlockCount = 27941,
BlockRewardsEth = "8474.944904178535758101"
},
new()
{
UTCDate = "2021-08-31",
UnixTimeStamp = "1630368000",
BlockCount = 28357,
BlockRewardsEth = "7213.736543000372715456"
}
}
};
π For more information Check out Get Daily Block Count and Rewards `π
Ώππ
Ύ`
π¦Get Daily Block Rewards π
Ώππ
Ύ
β
Returns the amount of block rewards distributed to validators daily.β
- Request
- Response
- ...
//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);
//will return a new object DailyBlockRewards with values: π
var dailyBlockRewards = new DailyBlockRewards {
Staus="1",
Message="OK",
Result= new List<DailyBlockRewardsData>
{
new()
{
UTCDate = "2021-08-01",
UnixTimeStamp = "1627776000",
BlockRewardsEth = "9216.309553593894910979"
},
new()
{
UTCDate = "2021-08-02",
UnixTimeStamp = "1627862400",
BlockRewardsEth = "8474.944904178535758101"
},
new()
{
UTCDate = "2021-08-31",
UnixTimeStamp = "1630368000",
BlockRewardsEth = "7213.736543000372715456"
}
}
};
π For more information Check out Get Daily Block Rewards `π
Ώππ
Ύ`
π¦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.β
- Request
- Response
- ...
//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);
//will return a new object DailyAverageTimeForBlock with values: π
var dailyAvgBlockRewards = new DailyAverageTimeForBlock {
Staus="1",
Message="OK",
Result= new List<DailyAverageTimeForBlockData>
{
new()
{
UTCDate = "2021-08-01",
UnixTimeStamp = "1627776000",
BlockTimeSec = "3.11"
},
new()
{
UTCDate = "2021-08-02",
UnixTimeStamp = "1627862400",
BlockTimeSec = "3.09"
},
new()
{
UTCDate = "2021-08-31",
UnixTimeStamp = "1630368000",
BlockTimeSec = "3.05"
}
}
};
π For more information Check out Get Daily Average Time for A Block to be Included in the BNB Smart Chain `π
Ώππ
Ύ`