MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / blockr_fetchtx

Function blockr_fetchtx

src/lib/pybitcointools/bci.py:328–345  ·  view source on GitHub ↗
(txhash, network='btc')

Source from the content-addressed store, hash-verified

326
327
328def blockr_fetchtx(txhash, network='btc'):
329 if network == 'testnet':
330 blockr_url = 'http://tbtc.blockr.io/api/v1/tx/raw/'
331 elif network == 'btc':
332 blockr_url = 'http://btc.blockr.io/api/v1/tx/raw/'
333 else:
334 raise Exception(
335 'Unsupported network {0} for blockr_fetchtx'.format(network))
336 if isinstance(txhash, list):
337 txhash = ','.join([x.encode('hex') if not re.match('^[0-9a-fA-F]*$', x)
338 else x for x in txhash])
339 jsondata = json.loads(make_request(blockr_url+txhash).decode("utf-8"))
340 return [d['tx']['hex'] for d in jsondata['data']]
341 else:
342 if not re.match('^[0-9a-fA-F]*$', txhash):
343 txhash = txhash.encode('hex')
344 jsondata = json.loads(make_request(blockr_url+txhash).decode("utf-8"))
345 return jsondata['data']['tx']['hex']
346
347
348def helloblock_fetchtx(txhash, network='btc'):

Callers

nothing calls this directly

Calls 2

make_requestFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected