Skip to main content

๐ŸฒGet Started

Requirements

You have a knowledge in .NET Core/ASP.NET Core , you can start here ASP.NET Core fundamentals | Microsoft Docs.

Add New WebApp Projectโ€‹

New Web App

Configure the WebApp Projectโ€‹

New Web App

Add the Nuget package to the WebApp Projectโ€‹

New Web App

Download and Install the latest BscScan.NetCore from NuGet using Package Manager, CLI or by adding it to the Package Reference:

PM> Install-Package BscScan.NetCore -Version 1.0.2
> dotnet add package BscScan.NetCore --version 1.0.2
<PackageReference Include="BscScan.NetCore" Version="1.0.2" />
Requirements

BscScan Api-Key Token is required to use the API. If you don't have one, you can create one at bscscan.com. Or you can follow the tutorial) to create an account.

Configure BscScanOptions in appsettings.json file of the WebApp Projectโ€‹

Update the file appsettings.Development.json for development environment and appsettings.json for production environment:

 "BscScanOptions": {
"Token": "ZXD3CX98EJ2C5MIDYFPQJB6SK******", // Api-Key Token from bscscan.com
"Uri": "https://api.bscscan.com/api" // or https://api-testnet.bscscan.com/ for testnet
}

Add the Configuration to the WebApp Project Program.csโ€‹

Update Program.cs file:

//imports
using BscScan.NetCore;
using BscScan.NetCore.Configuration;

var builder = WebApplication.CreateBuilder(args);

//read the configuration from appsettings.json and add it to the builder
var bscScanConfiguration = new BscScanConfiguration();
builder.Configuration.GetSection(nameof(BscScanOptions)).Bind(bscScanConfiguration.BscScanOptions);
builder.Services.AddSingleton(bscScanConfiguration);
builder.Services.AddBscScan(bscScanConfiguration);

Now you are ready to use the BscScan.NetCore API.