/Ditch

Create and broadcast transactions to Graphene-based blockchains

Primary LanguageC#MIT LicenseMIT

Build Status

Wiki Documentation Site Telegram (ru) Telegram (en) Follow us (ru) Follow us (en)

Ditch

The essence of the library is to generate a transaction according to the required operations (vote, comment, etc.), sign the transaction and broadcast to the Graphene-based blockchain.

Supported chains:

  • Golos (v0.18.3) NuGet version
  • Steem (v0.19.10) NuGet version
  • EOS (v1.1.0) NuGet version
  • BitShares NuGet version

Additional features:

  • Transliteration (Cyrillic to Latin)
  • Base58 converter
  • Can connect by https or socket (wss)

Usage

//set global properties
public void SetUp()
{
    HttpClient = new HttpClient();
    HttpManager = new HttpManager(HttpClient);
    Api = new OperationManager(HttpManager);
    //Api = new OperationManager(new WebSocketManager());
    
    Api.ConnectTo("https://api.steemit.com", CancellationToken.None);        
    //Api.ConnectTo("wss://ws.golos.io", CancellationToken.None);
    
    YouPrivateKeys = new List<byte[]>
    {
        Base58.GetBytes("5**************************************************") \\WIF
    };
    YouLogin = "username";
}

//Create new post with some beneficiaries
var postOp = new PostOperation("parentPermlink", YouLogin, "Title", "Body", "jsonMetadata");
var benOp = new BeneficiariesOperation(YouLogin, postOp.Permlink, new Asset(1, Config.SteemAssetNumSbd), new Beneficiary("someBeneficiarName", 1000));
var responce = Api.BroadcastOperations(YouPrivateKeys, new[]{postOp, benOp},CancellationToken.None);

//UpVote
var voteOp = new UpVoteOperation(YouLogin, "someUserName", "somePermlink");
var responce = Api.BroadcastOberations(YouPrivateKeys, voteOp, CancellationToken.None);

//Follow
var followOp = new FollowOperation(YouLogin, "someUserName", FollowType.Blog, YouLogin);
var responce = Api.BroadcastOperations(YouPrivateKeys, followOp, CancellationToken.None);