NethereumEthereum .Net cross platform integration library
Nethereum
Azure DevOps CI Code Gen: CI dev packages:
Technical support, chat and collaboration at Discord: https://discord.gg/u3Ej2BReNn
What is Nethereum ?
Nethereum is the .Net integration library for Ethereum, simplifying the access and smart contract interaction with Ethereum nodes both public or permissioned like Geth, Parity or Quorum.
Nethereum is developed targeting netstandard 1.1, netstandard 2.0, netcore 2.1, netcore 3.1, net451 and also as a portable library, hence it is compatible with all the operating systems (Windows, Linux, MacOS, Android and OSX) and has been tested on cloud, mobile, desktop, Xbox, hololens and windows IoT.
Nethereum Playground. Try Nethereum now in your browser.
Go to http://playground.nethereum.com to browse and execute all the different samples on how to use Nethereum directly in your browser. The same version is hosted in IPFS at http://playground.nethereum.eth.link/ or the same https://gateway.pinata.cloud/ipfs/QmPgWmX3HsxCBCDVv8adEhLzeJd2VstcyGh1T9ipKrvU4Y/
Do you need support, want to have a chat, or want to help?
Please join the Discord server using this link: https://discord.gg/u3Ej2BReNn We should be able to answer there any simple queries, general comments or requests, everyone is welcome. If you want to help or have any ideas for a pull request just come and chat.
Documentation
The documentation and guides can be found at Read the docs.
Features
- JSON RPC / IPC Ethereum core methods.
- Geth management API (admin, personal, debugging, miner).
- Parity management API.
- Quorum integration.
- Simplified smart contract interaction for deployment, function calling, transaction and event filtering and decoding of topics.
- Unity 3d Unity integration.
- ABI to .Net type encoding and decoding, including attribute based for complex object deserialization.
- Hd Wallet
- Transaction, RLP and message signing, verification and recovery of accounts.
- Libraries for standard contracts Token, ENS and Uport
- Integrated TestRPC testing to simplify TDD and BDD (Specflow) development.
- Key storage using Web3 storage standard, compatible with Geth and Parity.
- Simplified account life cycle for both managed by third party client (personal) or stand alone (signed transactions).
- Low level Interception of RPC calls.
- Code generation of smart contracts services.
Quick installation
Nethereum provides two types of packages. Standalone packages targeting Netstandard 1.1, net451 and where possible net351 to support Unity3d. There is also a Nethereum.Portable library which combines all the packages into a single portable library. As netstandard evolves and is more widely supported, the portable library might be eventually deprecated.
To install the latest version:
Windows users
To install the main packages you can either:
PM > Install-Package Nethereum.Web3
or
PM > Install-Package Nethereum.Portable
Mac/Linux users
dotnet add package Nethereum.Web3
or
dotnet add package Nethereum.Portable
Simple Code generation of Contract definitions
If you are working with smart contracts, you can quickly code generate contract definitions using the vscode solidity extension (please check the documentation for other options)
Main Libraries
Project Source | Nuget_Package | Description |
---|---|---|
Nethereum.Portable | Portable class library combining all the different libraries in one package | |
Nethereum.Web3 | Ethereum Web3 Class Library simplifying the interaction via RPC. Includes contract interaction, deployment, transaction, encoding / decoding and event filters | |
Nethereum.Unity | Unity3d integration, libraries can be found in the Nethereum releases | |
Nethereum.Geth | Nethereum.Geth is the extended Web3 library for Geth. This includes the non-generic RPC API client methods to interact with the Go Ethereum Client (Geth) like Admin, Debug, Miner | |
Nethereum.Quorum | Extension to interact with Quorum, the permissioned implementation of Ethereum supporting data privacy created by JP Morgan | |
Nethereum.Parity | Nethereum.Parity is the extended Web3 library for Parity. Including the non-generic RPC API client methods to interact with Parity. (WIP) |
Core Libraries
Project Source | Nuget_Package | Description |
---|---|---|
Nethereum.ABI | Encoding and decoding of ABI Types, functions, events of Ethereum contracts | |
Nethereum.EVM | Ethereum Virtual Machine API | |
Nethereum.Hex | HexTypes for encoding and decoding String, BigInteger and different Hex helper functions | |
Nethereum.RPC | Core RPC Class Library to interact via RCP with an Ethereum client | |
Nethereum.JsonRpc.Client | Nethereum JsonRpc.Client core library to use in conjunction with either the JsonRpc.RpcClient, the JsonRpc.IpcClient or other custom Rpc provider | |
Nethereum.JsonRpc.RpcClient | JsonRpc Rpc Client using Http | |
Nethereum JsonRpc IpcClient | JsonRpc IpcClient provider for Windows, Linux and Unix | |
Nethereum.RLP | RLP encoding and decoding | |
Nethereum.KeyStore | Keystore generation, encryption and decryption for Ethereum key files using the Web3 Secret Storage definition, https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition | |
Nethereum.Signer | Nethereum signer library to sign and verify messages, RLP and transactions using an Ethereum account private key | |
Nethereum.Contracts | Core library to interact via RPC with Smart contracts in Ethereum | |
Nethereum.IntegrationTesting | Integration testing module | |
Nethereum.HDWallet | Generates an HD tree of Ethereum compatible addresses from a randomly generated seed phrase (using BIP32 and BIP39) |
Note: IPC is supported for Windows, Unix and Linux but is only available using Nethereum.Web3 not Nethereum.Portable
Smart contract API Libraries
Project Source | Nuget_Package | Description |
---|---|---|
Nethereum.StandardTokenEIP20 | Nethereum.StandardTokenEIP20 Ethereum Service to interact with ERC20 compliant contracts |
|
Nethereum.Uport | Uport registry library | |
Nethereum.ENS | Ethereum Name service library (original ENS) WIP to upgrade to latest ENS |
Utilities
Project Source | Description |
---|---|
Nethereum.Generator.Console | |
Nethereum.Console | A collection of command line utilities to interact with Ethereum and account management |
Testchains | Pre-configured devchains for fast response (PoA) |
DappHybrid | A cross-platform hybrid hosting mechanism for web based decentralised applications |
Training modules
Project Source | Description |
---|---|
Nethereum.Workbooks | Xamarin Workbook tutorials including executable code |
Nethereum.Tutorials | Tutorials to run on VS Studio |
Code samples
Source | Description |
---|---|
Keystore generator | Keystore file generator |
Faucet | Web application template for an Ether faucet |
Nethereum Flappy | The source code files for the Unity3d game integrating with Ethereum |
Nethereum Game Sample | Sample game demonstrating how to integrate Nethereum with UrhoSharp's SamplyGame to build a cross-platform game interacting with Ethereum |
Nethereum UI wallet sample | Cross platform wallet example using Nethereum, Xamarin.Forms and MvvmCross, targeting: Android, iOS, Windows Mobile, Desktop (windows 10 uwp), IoT with the Raspberry PI and Xbox. |
Nethereum Windows wallet sample | Windows forms wallet sample providing the core functionality for Loading accounts from different mediums, Ether transfer, Standard token interaction. This is going to be the basis for the future cross-platform wallet / dapp |
Nethereum Windows wallet sample | Windows forms wallet sample providing the core functionality for Loading accounts from different mediums, Ether transfer, Standard token interaction. This is going to be the basis for the future cross-platform wallet / dapp |
Blazor/Blockchain Explorer | Wasm blockchain explorer based on Blazor and ReactiveUI |
Video guides
There a few video guides, which might be helpful to get started. NOTE: These videos are for version 1.0, so some areas have changed.
Please use the Nethereum playground for the latest samples.
Introductions
These are two videos that can take you through all the initial steps from creating a contract to deployment, one in the classic windows, visual studio environment and another in a cross platform mac and visual studio code.
Windows, Visual Studio
This video takes you through the steps of creating the a smart contract, compile it, start a private chain and deploy it using Nethereum.
Introduction to Calls, Transactions, Events, Filters and Topics
This hands on demo provides an introduction to calls, transactions, events filters and topics
Mappings, Structs, Arrays and complex Functions Output (DTOs)
This video provides an introduction on how to store and retrieve data from structs, mappings and arrays decoding multiple output parameters to Data Transfer Objects
Thanks and Credits
- Many thanks to Cass for the fantastic logo (https://github.com/cassiopaia) and everyone in Maker for providing very early feedback.
- Many thanks to everyone who has submitted a request for extra features, help or bugs either here in github, gitter or other channels, you are continuously shaping this project. A big shout out specially to @slothbag, @matt.tan, @knocte, @TrekDev, @raymens, @rickzanux, @naddison36, @bobsummerwill, @brendan87, @dylanmckendry that were using Nethereum and providing great feedback from the beginning. @djsowa Marcin Sowa for his help on IPC in Linux.
- Everyone in the Ethereum, Consensys and the blockchain community.
- Huge shout out to everyone developing all the different Ethereum implementations Geth, Parity, EthereumJ, EthCpp, ethereum-js (and every other utility around it), python (in the different shapes), ruby (digix guys), solidity, vyper, serpent, web3 implementations (web3js the first) and ethjs, web3j, etc, etc and last but not least the .Net Bitcoin implementation.