Giter VIP home page Giter VIP logo

hashgraph's Introduction

Hashgraph

.NET Core Client Library for Hedera Hashgraph

Documentation

We've started working on our documentation, you can see our progress here.

Please Note: This library is very new and as we gain experience interacting with the Hedera Network any commit to this project may cause breaking changes. Please be patient as we gain the necessary experience to provide a best in class library to access the Hedera Network.

Example

The Client object orchestrates the request construction and communication with the hedera network. It requires a small amount of configuration when created. At a minimum to retrieve an account balance, the client must be configured with a Gateway and Payer Account. The Gateway object represents the internet network address and account for the node processing requests and the Payer Account represents the account that will sign and pay for the query. The following code example illustrates retrieving an account balance for an Address:

class Program
{
    static async Task Main(string[] args)
    {                                                 // For Example:
        var gatewayUrl = args[0];                     //   2.testnet.hedera.com:50211
        var gatewayAccountNo = long.Parse(args[1]);   //   5 (gateway node 0.0.5)
        var payerAccountNo = long.Parse(args[2]);     //   20 (account 0.0.20)
        var payerPrivateKey = Hex.ToBytes(args[3]);   //   302e0201... (48 byte Ed25519 private in hex)
        var queryAccountNo = long.Parse(args[4]);     //   2300 (account 0.0.2300)
        try
        {
            await using var client = new Client(ctx =>
            {
                ctx.Gateway = new Gateway(gatewayUrl, 0, 0, gatewayAccountNo);
                ctx.Payer = new Account(0, 0, payerAccountNo, payerPrivateKey);
            });
            var account = new Address(0, 0, queryAccountNo);
            var balance = await client.GetAccountBalanceAsync(account);
            Console.WriteLine($"Account Balance for {account.AccountNum} is {balance} tinybars.");
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex.Message);
            Console.Error.WriteLine(ex.StackTrace);
        }
    }
}

Installation

dotnet add package Hashgraph

Hashgraph requires .NET Core Version 3.x

Contributing

While we are in the process of building the preliminary infrastructure for this project, please direct any feedback, requests or questions to Hedera’s Discord channel.

Cloning

This project references the Hedera Protobuf project as a git submodule (currently the vNext Branch). It is recommended to include --recurse-submodules options when cloning the repository so that the *.proto files from the submodule are present when building the project:

$ git clone --recurse-submodules https://github.com/bugbytesinc/Hashgraph.git

Build Status

Build Status

Build Requirements

This project relies protobuf support found in .net core 3, previous versions of the .net core framework will not work. (At the time of this writing we are in preview5)

Visual Studio is not required to build the library, however the project references the NSec.Cryptography library, which loads the libsodium.dll library which relies upon the VC++ runtime. In order to execute tests, the Microsoft Visual C++ Redistributable must be installed on the build agent if Visual Studio is not.

License

Hashgraph is licensed under the Apache 2.0 license.

hashgraph's People

Contributors

bugbytesinc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.