/// <summary> /// The method is used to broadcast the transaction asynchronously over the blockchain /// using the account of the user /// </summary> /// <param name="contentdata">the transaction generated by the operations</param> /// <param name="privateKey">private key of the user</param> /// <typeparam name="T">type of the transaction's json body</typeparam> /// <returns> transaction response data</returns> protected async Task <TransactionResponse> StartBroadcastingAsync <T>(T contentdata, string privateKey) { var trans = new Transaction(Config); var key = new Key(Config); TransactionResponse finalResponse; try { var transresponse = await trans.CreateSimpleTransactionAsync(contentdata); if (transresponse == null) { return(null); } var transaction = JsonConvert.SerializeObject(transresponse.Result); var digest = key.GetTransactionDigest(transaction, ChainId, new byte[64]); var signature = key.SignDigest(digest, privateKey, new byte[130]); var response = key.AddSignature(transaction, signature, new byte[transaction.Length + 200]); finalResponse = await trans.BroadcastTransactionAsync(response); } catch (Exception ex) { throw; } return(finalResponse); }