Modular RPC client for C# NEO blockchain.
Still on testing phase, do not use it on the MainNet!
This project will be rename to neo-modules and it will host small different packages to help C# devs to start working on Neo. It follows a similar struture as Nethereum to ease the migration of Ethereum devs to Neo. This will include:
- base types used on neo-project;
- hex and string operations;
- KeyPair generation encryption /decryption, NEP6 implementation
- Signing of transactions and other more top level operations (to be decided)
- ABI
Each of these will get is own nuget package.
Develop with decoupling in mind to make maintenance and new RPC methods implemented more quickly:
- Client base - Neo.JsonRpc.Client project
- RPC client implementation - Neo.JsonRpc.RpcClient project
- DTO'S, Services, Helpers - Neo.RPC (main project)
- Tests - Neo.RPC.Tests
- Demo - Simple demonstration project
Setup the rpc client node
var rpcClient = new RpcClient(new Uri("http://seed5.neo.org:10332"));
var NeoApiService = new NeoApiService(rpcClient);
With NeoApiService you have all the methods available, organized by: Accounts, Assets, Block, Contract, Node, Transaction
Then you just need to choose the wanted service, call SendRequestAsync()
and pass the necessary parameters if needed.
e.g.
var accountsService = NeoApiService.Accounts;
var state = accountsService.GetAccountState.SendRequestAsync("ADDRESS HERE");
If you don't need all the services, you can simply create an instance of the desired service.
var blockService = new NeoApiBlockService(new RpcClient(new Uri("http://seed5.neo.org:10332")));
var bestBlockHash = await blockService.GetBestBlockHash.SendRequestAsync();
All rpc calls return a DTO or a simple type like string or int.
You can also create a service to query NEP5 tokens. Note For the results to be human readable, these methods do not return the original result from the rpc node.
var client = new RpcClient(new Uri("http://seed5.neo.org:10332"));
var scriptHash = "08e8c4400f1af2c20c28e0018f29535eb85d15b6"; //TNC token
var nep5Service = new NeoNep5Service(client, scriptHash);
var name = await nep5Service.GetName();
var decimals = await nep5Service.GetDecimals();
var totalsupply = await nep5Service.GetTotalSupply(decimals);
var symbol = await nep5Service.GetSymbol();
var balance = await nep5Service.GetBalance("0x0ff9070d64d19076d08947ba4a82b72709f30baf", decimals);
Token info:
Name: Trinity Network Credit
Symbol: TNC
Decimals: 8
TotalSupply: 1000000000
Balance: 1457.82
- Bruno Freitas - BrunoFreitasgit
- Some base code comes from Nethereum
This project is licensed under the MIT License - see the LICENSE.md file for details