This solution's current purpose is to report on Blockchain data within either a specified range, or within a certain number of blocks from the most recent block at time of request.
There are two solutions provided for ease of use:
- A WebAPI containing a single controller exposing the two main calls. This comes with a Swagger UI endpoint as a way of interacting. Note: depending on the volume of data requested, this could be really slow - a Postman or Curl request may be better. This API's purpose is really only to to provide the data for consumers to use.
- A Blazor Application with a UI allowing viewers to see a tabbed report broken down into three sections
- Summary
- Externally Owned Account data
- Contract Data
- The default startup project in Visual Studio is The BlockExplorer.Blazor
- A compatible IDE to run, test and debug or
- .Net Core 3.1
- A Terminal if using the CLI (e.g. PowerShell or VS Code Terminal (or what ever you prefer))
- Knowledge of any of 1-3
- Open the solution file (in
/src/BlockExplorer.sln
) in Visual Studio, Build (Ctrl+Shift+B) - If using CLI
- Navigate to
/src/
- Type in
dotnet build
- Navigate to
- Open the solution file (in
/src/BlockExplorer.sln
) in Visual Studio- Build (Ctrl+Shift+B)
- Right click on the Test project and select
Run tests
- alternatively the Test Explorer may provide options as well
- If using CLI
- Navigate to
/src/
- Type in
dotnet test
- Navigate to
A note on testing - the testing at present is very rudimentary and will be improved to:
- Cover all missing areas
- Service level tests (running in memory with a mocked BlockChain)
- Integration tests (checking some transactions on mainnet)
- Filter to show either addresses with
received > 0
,sent > 0
or both - Extensive value validation on the API endpoints (e.g. always a number for blocks)
- Blazor double hit for the prerender needs fixing
- Service tests
- Integration tests
- More descriptive UI content and usage explanation
- Proper exception handling
- Blockchain client circuit breakers in case of repeated issues
- Performance performance and performance adjustments
- Rate limited endpoints may be hit too quickly for all the block data and could error
- An alternate way may be needed to work out if it is a contract without having to look it up
- Caching options?
- For either the Blazor solution or the API one
- Navigate to the respective project folder
- Change the
RpcAddress
value in theappsettings.json
file to your Node address (this could be mainnet, testnet or something like Ganache)
- Open the solution file (in
/src/BlockExplorer.sln
) in Visual Studio- Build (Ctrl+Shift+B)
- Press F5 to run (you could skip point 1, but I prefer to build)
- If using CLI
- Make sure nothing is running on port 5000 (http) /5001 (https) as the services bind to these
- Navigate to
/src/BlockExplorer.Blazor
or/src/BlockExplorer.Api
- Type in
dotnet run
- Open a browser and got to:
- https://localhost:5001/swagger/index.html for the WebAPI Swagger
- https://localhost:5001/ for the Blazor Application
BlockExplorer.Api
WebAPI with controller to return dataBlockExplorer.Api.Models
Models returned by the API that could be turned into a Nuget package for consumersBlockExplorer.Blazor
Blazor project UIBlockExplorer.Clients
Blockchain clients implementing the Domain specified contract - this currently is just NethereumBlockExplorer.Domain
Internal domain models, configuration and service definitionsBlockExplorer.Handlers
Handler implementations for retrieving and mapping the domain data for the API/BlazorBlockExplorer.Tests.UnitTests
Basic unit tests