Releases: Chainers/Ditch
New operations
A huge update for Ditch and Cryptography.ECDSA is finally ready for use!
GitHub:
https://github.com/Chainers/Ditch
https://github.com/Chainers/Cryptography.ECDSA
Release Notes:
- Private and Public key generation (+support Steem convention)
- AccountCreateOperation
- AccountUpdateOperation
- WithdrawVestingOperation
- WitnessUpdateOperation
- TransferToVestingOperation
- TransferOperation
Instalation
PM> Install-Package Ditch.Steem -Version 3.1.3
PM> Install-Package Ditch.Golos -Version 3.1.3
How to use
Generate Private and Public keys
https://www.youtube.com/watch?v=G6Ee1h97s-s
AccountCreateOperation
var name = "userlogin";
var op = new AccountCreateOperation
{
Fee = new Asset(3000, Config.SteemAssetNumSteem),
Creator = User.Login,
NewAccountName = User.Login,
JsonMetadata = "",
};
var privateKey = Secp256K1Manager.GenerateRandomKey();
var privateWif = "P" + Base58.EncodePrivateWif(privateKey);
var subWif = Base58.GetSubWif(name, privateWif, "owner");
var pk = Base58.DecodePrivateWif(subWif);
var subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
op.Owner.KeyAuths.Add(new KeyValuePair<PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));
subWif = Base58.GetSubWif(name, privateWif, "active");
pk = Base58.DecodePrivateWif(subWif);
subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
op.Active.KeyAuths.Add(new KeyValuePair<PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));
subWif = Base58.GetSubWif(name, privateWif, "posting");
pk = Base58.DecodePrivateWif(subWif);
subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
op.Posting.KeyAuths.Add(new KeyValuePair<PublicKeyType, ushort>(new PublicKeyType(subPublicKey), 1));
subWif = Base58.GetSubWif(name, privateWif, "memo");
pk = Base58.DecodePrivateWif(subWif);
subPublicKey = Secp256K1Manager.GetPublicKey(pk, true);
op.MemoKey = new PublicKeyType(subPublicKey);
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
AccountUpdateOperation
var args = new FindAccountsArgs()
{
Accounts = new[] { User.Login }
};
var resp = Api.FindAccounts(args, CancellationToken.None);
var acc = resp.Result.Accounts[0];
var op = new AccountUpdateOperation(User.Login, acc.MemoKey, "new settings in json format. see acc.JsonMetadata");
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
WithdrawVestingOperation
var op = new WithdrawVestingOperation(User.Login, new Asset(1, Config.SteemAssetNumVests));
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
WitnessUpdateOperation
var op = new WitnessUpdateOperation(User.Login, string.Empty, new PublicKeyType("STM1111111111111111111111111111111114T1Anm"), new LegacyChainProperties(1000, new LegacyAsset(1, Config.SteemAssetNumSteem), 131072), new Asset(1, Config.SteemAssetNumSteem));
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
TransferToVestingOperation
var op = new TransferToVestingOperation(User.Login, User.Login, new Asset(1, Config.SteemAssetNumSteem));
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
TransferOperation
var op = new TransferOperation(User.Login, User.Login, new Asset(1, Config.SteemAssetNumSbd), "optional msg");
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
Ditch.EOS
Added support for EOS Api (https://eosio.github.io/eos/group__eosiorpc.html)
Chain API
get_info
get_block
get_account
get_code
get_table_rows
abi_json_to_bin
abi_bin_to_json
push_transaction
push_transactions
get_required_keys
Wallet API
wallet_create
wallet_open
wallet_lock
wallet_lock_all
wallet_import_key
wallet_list
wallet_list_keys
wallet_get_public_keys
wallet_set_timeout
wallet_sign_trx
Ditch features release v3.0.9
Added support for Apis
- private_message_api
- market_history_api
- account_by_key_api
- follow_api
- login_api
Code refactoring
- renamed class Money to Asset
Ditch features release v2.2.7
Added:
-
GetActiveWitnesses - Displays a list of all active delegates.
-
GetMinerQueue - Creates a list of the miners waiting to enter the DPOW chain to create the block.
-
GetSchema - Return a JSON description of object representations
-
GetSavingsWithdrawFrom - Returns the output data from 'SAFE' for this user
-
GetSavingsWithdrawTo - Returns the output data from 'SAFE' for this user
-
GetWitnessByAccount - Get the witness owned by a given account
-
GetWitnessesByVote - This method is used to fetch witnesses with pagination.
-
GetWitnesses - Get a list of witnesses by ID
-
LookupWitnessAccounts - Get names and IDs for registered witnesses
-
GetWitnessCount - Get the total number of witnesses registered with the blockchain
-
GetOrderBook - Gets the current order book for STEEM:SBD market
-
GetOpenOrders - Get open orders
-
Bug fixing
Last version where Steem and Golos supported in one way.
Ditch features release v2.2.2
Supported operations
Get:
- DynamicGlobalProperties
- Content
- GetAccounts
- GetCustomRequest
- VerifyAuthority
- GetFollowing
- GetFollowers
- LookupAccountNames
- LookupAccounts
- GetAccountCount
- GetAccountBandwidth
- GetWitnessSchedule
- GetState
- GetNextScheduledHardfork
- GetKeyReferences
- GetHardforkVersion
- GetFeedHistory
- GetCurrentMedianHistoryPrice
- GetConfig
- GetChainProperties
- GetConversionRequests
- GetAccountHistory
- GetAccountReferences
- (new!) GetTrendingTags
- (new!) GetBlockHeader
- (new!) GetBlock
- (new!) GetOpsInBlock
- (new!) GetTrendingCategories
- (new!) GetBestCategories
- (new!) GetActiveCategories
- (new!) GetRecentCategories
- (new!) GetOwnerHistory
- (new!) GetRecoveryRequest
- (new!) GetEscrow
- (new!) GetWithdrawRoutes
Post:
- VoteOperation (vote)
- UpVoteOperation inherit VoteOperation
- DownVoteOperation inherit VoteOperation
- FlagOperation inherit VoteOperation
- CustomJsonOperation (custom_json)
- RePostOperation inherit CustomJsonOperation
- FollowOperation inherit CustomJsonOperation
- UnfollowOperation inherit FollowOperation
- CommentOperation (comment)
- PostOperation inherit CommentOperation
- ReplyOperation inherit CommentOperation
- CommentOptionsOperation (comment_options)
- BeneficiaresOperation (beneficiaries) inherit CommentOptionsOperation
Supported chains:
- Golos
- Steem
Additional features:
- Transliteration (Cyrillic to Latin)
- Base58 converter
Usage
//set global properties
public void SetUp()
{
Chain = ChainManager.GetChainInfo(KnownChains.Steem);
OperationManager = new OperationManager(Chain.Url, Chain.ChainId, Chain.JsonSerializerSettings);
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 BeneficiaresOperation(YouLogin, postOp.Permlink, Chain.SbdSymbol, new Beneficiary("someBeneficiarName", 1000));
var responce = _operationManager.BroadcastOberations(YouPrivateKeys, postOp, benOp);
//UpVote
var voteOp = new UpVoteOperation(YouLogin, "someUserName", "somePermlink");
var responce = _operationManager.BroadcastOberations(YouPrivateKeys, voteOp);
//Follow
var followOp = new FollowOperation(YouLogin, "someUserName", FollowType.Blog, YouLogin);
var responce = _operationManager.BroadcastOperations(YouPrivateKeys, followOp);
Ditch features release v2.1.10
Supported operations
Get:
- DynamicGlobalProperties
- Content
- GetAccounts
- GetCustomRequest
- (new!) VerifyAuthority
- (new!) GetFollowing
- (new!) GetFollowers
- (new!) LookupAccountNames
- (new!) LookupAccounts
- (new!) GetAccountCount
- (new!) GetAccountBandwidth
- (new!) GetWitnessSchedule
- (new!) GetState
- (new!) GetNextScheduledHardfork
- (new!) GetKeyReferences
- (new!) GetHardforkVersion
- (new!) GetFeedHistory
- (new!) GetCurrentMedianHistoryPrice
- (new!) GetConfig
- (new!) GetChainProperties
- (new!) GetConversionRequests
- (new!) GetAccountHistory
- (new!) GetAccountReferences
Post:
- VoteOperation (vote)
- UpVoteOperation inherit VoteOperation
- DownVoteOperation inherit VoteOperation
- FlagOperation inherit VoteOperation
- CustomJsonOperation (custom_json)
- RePostOperation inherit CustomJsonOperation
- FollowOperation inherit CustomJsonOperation
- UnfollowOperation inherit FollowOperation
- CommentOperation (comment)
- PostOperation inherit CommentOperation
- (new!) ReplyOperation inherit CommentOperation
- CommentOptionsOperation (comment_options)
- BeneficiaresOperation (beneficiaries) inherit CommentOptionsOperation
Supported chains:
- Golos
- Steem
Additional features:
- (new!) Transliteration (Cyrillic to Latin)
- (new!) Base58 converter
Usage
//set global properties
public void SetUp()
{
Chain = ChainManager.GetChainInfo(KnownChains.Steem);
OperationManager = new OperationManager(Chain.Url, Chain.ChainId, Chain.JsonSerializerSettings);
YouPrivateKeys = new List<byte[]>
{
Base58.GetBytes("WIF")
};
YouLogin = "username";
}
//Create new post with some beneficiaries
var postOp = new PostOperation("parentPermlink", YouLogin, "Title", "Body", "jsonMetadata");
var benOp = new BeneficiaresOperation(YouLogin, postOp.Permlink, Chain.SbdSymbol, new Beneficiary("someBeneficiarName", 1000));
var responce = _operationManager.BroadcastOberations(YouPrivateKeys, postOp, benOp);
//UpVote
var voteOp = new UpVoteOperation(YouLogin, "someUserName", "somePermlink");
var responce = _operationManager.BroadcastOberations(YouPrivateKeys, voteOp);
//Follow
var followOp = new FollowOperation(YouLogin, "someUserName", FollowType.Blog, YouLogin);
var responce = _operationManager.BroadcastOperations(YouPrivateKeys, followOp);
Basic functionality
Changes
- The project now supports .NetStandard
- Changed the way to build transactions (become more flexible).
- New operations
Supported operations
Get:
- DynamicGlobalProperties
- Content
- GetAccounts
- GetCustomRequest
Post:
- VoteOperation (vote)
- UpVoteOperation inherit VoteOperation
- DownVoteOperation inherit VoteOperation
- FlagOperation inherit VoteOperation
- CustomJsonOperation (custom_json)
- RePostOperation inherit CustomJsonOperation
- FollowOperation inherit CustomJsonOperation
- UnfollowOperation inherit FollowOperation
- CommentOperation (comment)
- PostOperation inherit CommentOperation
- CommentOptionsOperation (comment_options)
- BeneficiaresOperation (beneficiaries) inherit CommentOptionsOperation
Supported chains:
- Golos
- Steemit
Usage
//set global properties
GlobalSettings.Init(Name, PostingKey, ChainManager.KnownChains.Steem);
_operationManager = new OperationManager();
//Create new post with some beneficiaries
var op1 = new PostOperation(parentPermlink, GlobalSettings.Login, permlink, title, body, jsonMetadata);
var op2 = new BeneficiaresOperation(GlobalSettings.Login, permlink, GlobalSettings.ChainInfo.SbdSymbol, new Beneficiary(beneficiar, 1000));
var responce = _operationManager.BroadcastOberations(op1, op2);
//UpVote
var op1 = new UpVoteOperation(GlobalSettings.Login, author, permlink);
var responce = _operationManager.BroadcastOberations(op1);
Ditch main features
Current opportunities:
- compose operations into transactions
- sign transactions
- convert transactions to JsonRpc
- broadcast to steem/golos
Supported operations:
- vote
Development plans:
- performance improvement
- support other operations (comment etc.)