C# implementation of the Nimiq RPC client specs.
This repository is archived: Nimiq PoS has been launched and this RPC client only supports the old PoW RPC specification. As of now, there is no C# RPC client implementation. Please contact us if you are interested in implementing and supporting the Nimiq ecosystem for C#.
To get started sending requests to a Nimiq node, we create a NimiqClient object.
var config = new Config(
scheme: "http",
host: "127.0.0.1",
port: 8648,
user: "luna",
password: "moon"
);
var client = new NimiqClient(config);
// make rpc call to get current block number
var blockNumber = await client.blockNumber();
Console.WriteLine(blockNumber);Note: When no config object is passed in the initialization it will use the default values in the Nimiq node.
The complete API documentation is available here.
Check out the original Nimiq RPC specs for the behind-the-scenes RPC calls.
Use the Package Manager from Visual Studio IDE to install the NimiqClient package as a dependency to your project.
Alternatively, you can install the package from the project folder using dotnet from the command line:
dotnet add package NimiqClientAfter cloning the repository, open the solution file NimiqClientProjects.sln located in the repository root folder in Visual Studio.
All done, happy coding!
You need a start a Testnet Nimiq node:
nodejs index.js --protocol=dumb --type=full --network=test --rpcThe tests are stored in \NimiqClientTest and can be run from the Visual Studio IDE. Alternatively you can run all the tests from the command line from the repository root directory:
dotnet testThe documentation is generated automatically with DocFX. To create the documentation, run the following commands from the repository root directory.
First install the DocFX package:
nuget install docfx.console -version 2.51.0Copy the file README.md to the same folder with the name index.md:
(Windows)
copy /y README.md index.md(Unix-like)
cp -r README.md index.mdRemove the old generated documentation:
(Windows)
rmdir /s /q docs(Unix-like)
rm -fr docsRun DocFX with the configuration file docfx.json via the mono command:
mono docfx.console.2.51.0/tools/docfx.exe docfx.jsonNote: Mono is distributed with the .Net SDK, if it isn't already installed on your system download and install the tool from here.
Finally add a blank file in the \docs folder with the name .nojekyll for the documentation hosted on GitHub Pages:
(Windows)
echo > docs\.nojekyll(Unix-like)
echo > docs/.nojekyllThis implementation was originally contributed by rraallvv.
Bug reports and pull requests are welcome! Please refer to the issue tracker for ideas.