HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
API Reference

setDefaultBlock

Sets the default block used as a reference for tronWeb.trx.getBlock, tronWeb.trx.getBlockTransactionCount, tronWeb.trx.getTransactionFromBlock

Usage

tronWeb.setDefaultBlock('blockID');

Parameters
Possible input values can be 'latest', 'earliest', left blank or block number.

ParameterDescriptionData Type
latestThe reference block is the latest block;String
earliestThe reference block is the genesis block;String
left blankNo reference block
block numberThe reference block is the corresponding block.0 or the positive integer

Returns
String

Example

>tronWeb.setDefaultBlock('latest');
'latest'

> tronWeb.setDefaultBlock();
false

> tronWeb.setDefaultBlock('earliest');
'Earliest'

> tronWeb.setDefaultBlock(585367);
undefined