Create and broadcast transactions to Graphene-based blockchains
A huge update for Ditch and Cryptography.ECDSA is finally ready for use!
https://github.com/Chainers/Ditch https://github.com/Chainers/Cryptography.ECDSA
PM> Install-Package Ditch.Steem -Version 3.1.3
PM> Install-Package Ditch.Golos -Version 3.1.3
https://www.youtube.com/watch?v=G6Ee1h97s-s
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);
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);
var op = new WithdrawVestingOperation(User.Login, new Asset(1, Config.SteemAssetNumVests));
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
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);
var op = new TransferToVestingOperation(User.Login, User.Login, new Asset(1, Config.SteemAssetNumSteem));
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
var op = new TransferOperation(User.Login, User.Login, new Asset(1, Config.SteemAssetNumSbd), "optional msg");
var response = Api.BroadcastOperations(User.ActiveKeys, CancellationToken.None, op);
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
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.
Get:
Post:
//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);
Get:
Post:
//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);
Get:
Post:
//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);
Current opportunities:
Supported operations:
Development plans: