Skip to content

Instantly share code, notes, and snippets.

@donma
Last active November 9, 2018 02:43
Show Gist options
  • Save donma/1cd474d3c4028f313e577b8c0aed98ee to your computer and use it in GitHub Desktop.
Save donma/1cd474d3c4028f313e577b8c0aed98ee to your computer and use it in GitHub Desktop.
C# Etherscan Simple SDK get Block Number
var service = new EtherscanParse.TrasactionAgent(YOUR_TOKEN);
var info = service.GetTrasactionInfo(TXID);
Console.WriteLine("Gas Limit:" + Convert.ToInt32(info.result.gas, 16).ToString());
Console.WriteLine("Gas Price:" + ((decimal)Int64.Parse(info.result.gasPrice.Replace("0x", ""), NumberStyles.AllowHexSpecifier) / 1000000000000000000).ToString(""));
Console.WriteLine("From:"+info.result.from);
Console.WriteLine("To:" + info.result.to);
Console.WriteLine("hash(TXID):" + info.result.hash);
Console.WriteLine("value:" + ((decimal)Int64.Parse(info.result.value.Replace("0x", ""), NumberStyles.AllowHexSpecifier) / 1000000000000000000).ToString(""));
Console.WriteLine("blockHash:" + info.result.blockHash);
Console.WriteLine("blockNumber:" + Convert.ToInt32(info.result.blockNumber, 16).ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment