public JsonResult Index() { var rawTxs = RpcHelper.RequestJson <TxPoolResp>("f_on_transactions_pool_json", new Dictionary <string, object>()).result.transactions; var txHashes = new List <string>(); foreach (var rawTx in rawTxs) { txHashes.Add(rawTx.hash); } var tx_args = new Dictionary <string, object>(); tx_args.Add("transactionHashes", txHashes.ToArray()); var txs = RpcHelper.Request <TxDetailResp>("get_transaction_details_by_hashes", tx_args); List <CachedTx> transactions = new List <CachedTx>(); if (txs != null) { foreach (var rawTx in txs.transactions) { var memPoolTx = TransactionHelpers.MapTx(rawTx); memPoolTx.height = 0; transactions.Add(memPoolTx); } } return(new JsonResult(JsonConvert.SerializeObject(transactions))); }
private JsonResult GetDirect(int Height, int startHeight, int chainHeight) { List <int> blockHeights = new List <int>(); for (var x = startHeight; x < chainHeight; x++) { blockHeights.Add(x); } //fetch the transactions directly from the Blockchain var args = new Dictionary <string, object>(); args.Add("blockHeights", blockHeights); var blocks = RpcHelper.Request <BlockResp>("get_blocks_details_by_heights", args).blocks; List <CachedTx> transactions = new List <CachedTx>(); foreach (var block in blocks) { foreach (var transaction in block.transactions) { var cachedTx = TransactionHelpers.MapTx(transaction); //persist tx's to cache if (cachedTx != null) { transactions.Add(cachedTx); } } } return(new JsonResult(JsonConvert.SerializeObject(transactions))); }