Exemplo n.º 1
0
        public static (bool suc, string hash) PushTx2Bc(string netStr, Transaction tx, bool useTor = false)
        {
            try
            {
                string req = "";


                if (useTor)
                {
                    req = Tech.webreqTor($"https://api.blockcypher.com/v1/btc/{netStr}/txs/push", "POST", JsonConvert.SerializeObject(new { tx = tx.ToHex() }));
                }
                else
                {
                    req = Tech.webreq($"https://api.blockcypher.com/v1/btc/{netStr}/txs/push", "POST", JsonConvert.SerializeObject(new { tx = tx.ToHex() }));
                }

                var parse = JsonConvert.DeserializeObject <BCtcPushResult>(req);

                return(true, parse.tx.hash);
            }
            catch (Exception e)
            {
                return(false, "");
            }
        }