Skip to content
forked from abitmore/Ditch

Create and broadcast transactions to Graphene-based blockchains

License

Notifications You must be signed in to change notification settings

crexonline/Ditch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (hf 0.17.1)
  • Steem (hf 0.19.4)
  • EOS (DAWN 3.0)

Additional features:

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

Usage

//set global properties
public void SetUp()
{
    var jss = new JsonSerializerSettings
        {
            DateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",
            Culture = CultureInfo.InvariantCulture
        };
    
    //_operationManager = new OperationManager(new WebSocketManager(jss), jss);
    _operationManager = new OperationManager(new HttpManager(jss), jss);
    
    // Steem
    //var url = _operationManager.TryConnectTo(new List<string> {"wss://steemd.steemit.com", }, CancellationToken.None);
    var url = _operationManager.TryConnectTo(new List<string> { "https://api.steemit.com", }, CancellationToken.None);
    
    // Golos
    //var url = _operationManager.TryConnectTo(new List<string> { "wss://ws.golos.io", }, CancellationToken.None);
    //var url = _operationManager.TryConnectTo(new List<string> { "https://public-ws.golos.io", }, CancellationToken.None);
    
    if (!string.IsNullOrEmpty(url))
        Console.WriteLine($"Conected to {url}");
    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, _operationManager.SbdSymbol, new Beneficiary("someBeneficiarName", 1000));
var responce = _operationManager.BroadcastOperations(YouPrivateKeys, CancellationToken.None, postOp, benOp);

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

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

About

Create and broadcast transactions to Graphene-based blockchains

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 91.7%
  • CSS 5.9%
  • JavaScript 1.6%
  • Other 0.8%