Skip to main content

๐ŸŽฏGeth Proxy 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 IBscScanGethProxyService _bscScanGethProxyService;

๐Ÿ”ถeth_blockNumberโ€‹

Returns the number of most recent block.โ€‹

//Sample Request ๐ŸŽ

var blockNumber = await _bscScanGethProxyService.EthBlockNumberAsync();

๐Ÿ”ถeth_getBlockByNumberโ€‹

Returns information about a block by block number.โ€‹

//Sample Request ๐ŸŽ

var blockByNumber = await _bscScanGethProxyService.EthGetBlockByNumberAsync("0xa11446");

๐Ÿ”ถeth_getBlockTransactionCountByNumberโ€‹

Returns the number of transactions in a block.โ€‹

//Sample Request ๐ŸŽ

var blockTransactionCountByNumber =
await _bscScanGethProxyService.EthGetBlockTransactionCountByNumberAsync("0xa11446");

๐Ÿ”ถeth_getTransactionByHashโ€‹

Returns information about a transaction requested by transaction hash.โ€‹

//Sample Request ๐ŸŽ
var transactionByHash =
await _bscScanGethProxyService
.EthGetTransactionByHashAsync(txhash:"0x9983332a52df5ad1dabf8fa81b1642e9383f302a399c532fc47ecb6a7a967166");


๐Ÿ”ถeth_getTransactionByBlockNumberAndIndexโ€‹

Returns information about a transaction by block number and transaction index position.โ€‹

//Sample Request ๐ŸŽ
var transactionByBlockNumberAndIndex =
await _bscScanGethProxyService
.EthGetTransactionByBlockNumberAndIndexAsync(tag:"0xa11446", index:"0x1");


๐Ÿ”ถeth_getTransactionCountโ€‹

Returns the number of transactions performed by an address.โ€‹

//Sample Request ๐ŸŽ
var transactionCount =
await _bscScanGethProxyService
.EthGetTransactionCountAsync(address:"0x4430b3230294D12c6AB2aAC5C2cd68E80B16b581");

๐Ÿ”ถeth_sendRawTransactionโ€‹

Submits a pre-signed transaction for broadcast to the BNB Smart Chain network.โ€‹

//Sample Request ๐ŸŽ
var sendRawTransaction =
await _bscScanGethProxyService
.EthSendRawTransactionAsync(hex:"0xf904808000831cfde080");

๐Ÿ”ถeth_getTransactionReceiptโ€‹

Returns the receipt of a transaction that has been validated.โ€‹

//Sample Request ๐ŸŽ
var transactionReceipt =
await _bscScanGethProxyService
.EthGetTransactionReceiptAsync("0x2122b2317d6cf409846f80e829c1e45ecb30306907ba0a00a02730c78890739f");

๐Ÿ”ถeth_callโ€‹

Executes a new message call immediately without creating a transaction on the block chain.โ€‹

//Sample Request ๐ŸŽ
var call = await _bscScanGethProxyService
.EthCallAsync(to:"0xAEEF46DB4855E25702F8237E8f403FddcaF931C0",
data:"0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724");

๐Ÿ”ถeth_getCodeโ€‹

Returns code at a given address.โ€‹

//Sample Request ๐ŸŽ
var code = await _bscScanGethProxyService
.EthGetCodeAsync(address:"0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82");

๐Ÿ”ถeth_getStorageAtโ€‹

Returns the value from a storage position at a given address.โ€‹

//Sample Request ๐ŸŽ
var storageAt = await _bscScanGethProxyService
.EthGetStorageAtAsync(address:"0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
position:"0x0");

๐Ÿ”ถeth_gasPriceโ€‹

Returns the current price per gas in wei.โ€‹

//Sample Request ๐ŸŽ
var gasPrice = await _bscScanGethProxyService
.EthGasPriceAsync();

๐Ÿ”ถeth_estimateGasโ€‹

Makes a call or transaction, which won't be added to the blockchain and returns the gas used.โ€‹

//Sample Request ๐ŸŽ
var parameters = new EthEstimateGasRequest
{
Data = "0x4e71d92d",
To = "0xEeee7341f206302f2216e39D715B96D8C6901A1C",
Value = "0xff22",
GasPrice = "0x51da038cc",
Gas = "0x5f5e0ff"
};

var estimateGas = await _bscScanGethProxyService
.EthEstimateGasAsync(parameters);