def broadcast_tx(self, tx):
s = io.BytesIO()
tx.stream(s)
tx_as_hex = b2h(s.getvalue())
data = urlencode(dict(tx=tx_as_hex)).encode("utf8")
URL = "http://blockchain.info/pushtx"
try:
d = urlopen(URL, data=data).read()
return d
except HTTPError as ex:
try:
d = ex.read()
ex.message = d
except:
pass
raise ex
评论列表
文章目录