The Casper .NET SDK allows developers to interact with the Casper Network using the .NET languages. The project itself is being developed with C#.
The SDK documentation, examples and tutorials can be found here.
The Casper.Network.SDK for .NET is published as a nuget package in nuget.org.
To add a reference to the SDK in your project, use the Package Manager in Visual Studio or the dotnet
cli tool.
Install-Package Casper.Network.SDK
dotnet add package Casper.Network.SDK
NCTL is a CLI application to control one or multiple Casper networks locally. Many developers wish to spin up relatively small test networks to localize their testing before deploying to the blockchain.
To simplify even more the set up of a local network, you may run NCTL within a docker container. To start a container and publish the ports of one the nodes, write the following command:
docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl
Refer to the casper-nctl-docker
repository for further details on how to use NCTL with docker.
To build this library, install .NET 5.0 or higher and build with command:
dotnet build --configuration Release
To run the tests, use this command:
dotnet test --filter 'TestCategory!~NCTL'
On Windows use a PowerShell terminal to run the tests.
To test against netstandard2.0
framework, launch the tests as follows:
TEST_FRAMEWORK=netstandard2.0 dotnet test --filter 'TestCategory!~NCTL'
The command above excludes integration tests. If you're running a Casper network locally with NCTL, follow these steps to run the integrations tests:
-
Copy the faucet key from your NCTL environment to
Casper.Network.SDK.Test/TestData/faucetact.pem
. If you're running the NCTL docker image, activate nctl commands and runnctl-view-faucet-secret-key > Casper.Network.SDK.Test/TestData/faucetact.pem
. -
Adjust, if needed, the IPs and ports in the file
Casper.Network.SDK.Test/TestData/test.runsettings
. -
Run the tests:
dotnet test --settings Casper.Network.SDK.Test/test.runsettings --filter 'TestCategory~NCTL'
NOTE: Make sure your NCTL network has booted up and nodes are emitting blocks before running the tests.
To test against netstandard2.0
framework, launch the tests as follows:
TEST_FRAMEWORK=netstandard2.0 dotnet test --settings Casper.Network.SDK.Test/test.runsettings --filter 'TestCategory~NCTL'
Click the button to start coding in Gitpod with an online IDE.