etherscan.dotnet.client 1.0.5

dotnet add package etherscan.dotnet.client --version 1.0.5                
NuGet\Install-Package etherscan.dotnet.client -Version 1.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="etherscan.dotnet.client" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add etherscan.dotnet.client --version 1.0.5                
#r "nuget: etherscan.dotnet.client, 1.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install etherscan.dotnet.client as a Cake Addin
#addin nuget:?package=etherscan.dotnet.client&version=1.0.5

// Install etherscan.dotnet.client as a Cake Tool
#tool nuget:?package=etherscan.dotnet.client&version=1.0.5                

EtherScan .NET Client

A comprehensive .NET client library for interacting with the EtherScan API.

For detailed endpoint information, see the official EtherScan V2 API Documentation.

Contents

Installation

dotnet add package EtherScan.Dotnet.Client

Features

  • Full coverage of EtherScan API endpoints
  • Strongly typed request/response models
  • Async/await support
  • Comprehensive error handling
  • Multi-chain support
  • Built-in rate limiting handling
  • Automatic Wei to Ether conversion

Quick Start

using EtherScan.Dotnet.Client;
using EtherScan.Dotnet.Client.Models.Account.Request;
using EtherScan.Dotnet.Client.Models.Enumerations;

var client = new EtherScanClient("YOUR_API_KEY", ChainNetwork.EthereumMainnet, new HttpClient());

// Get account balance
var balance = await client.GetAccountBalanceAsync(new AccountBalanceRequest 
{ 
    Address = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" 
});

Console.WriteLine($"Balance: {balance.Result?.BalanceInEther} ETH");

Usage Examples

Account Module

// Get multiple account balances
var balances = await client.GetMultipleAccountBalanceAsync(
    new AccountBalanceRequest 
    { 
        Address = "0x742d...44e,0xdac1...ec7" 
    });

// Get transactions
var txs = await client.GetTransactionsByAddressAsync(new TransactionRequest
{
    Address = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    StartBlock = 0,
    EndBlock = 99999999,
    Sort = "desc"
});

Contract Module

// Get contract ABI
var abi = await client.GetContractAbiAsync(new ContractAbiRequest 
{ 
    Address = "0xdac17f958d2ee523a2206206994597c13d831ec7" 
});

// Get contract source code
var source = await client.GetContractSourceCodeAsync(new ContractSourceCodeRequest 
{ 
    Address = "0xdac17f958d2ee523a2206206994597c13d831ec7" 
});

Supported Chains

API Reference

See IEtherScanClient.cs for complete API documentation.

Error Handling

The client provides detailed error information through the Response<T> class:

public class Response<T>
{
    public string Status { get; set; }
    public bool IsSuccess => Status == "1" && Message == "OK";
    public string Message { get; set; }
    public T? Result { get; set; }
}

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 79 1/25/2025
1.0.4 61 1/25/2025
1.0.2 70 1/25/2025