Chainers / Ditch

Create and broadcast transactions to Graphene-based blockchains
MIT License
33 stars 26 forks source link
csharp golos graphene steem

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:

Additional features:

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);