def gen(testdb, request): gen = data.testnet14(testdb) chain = gen.chain blocks = gen.blocks # Test block with an interesting transaction. blocks.append( gen.block( prev=blocks[-1], transactions=[ gen.coinbase(value=50.01e8), gen.tx(txIn=[gen.txin(prevout=blocks[1]['transactions'][0]['txOut'][0], scriptSig='XXX')], txOut=[gen.txout(addr='n1pTUVnjZ6GHxujaoJ62P9NBMNjLr5N2EQ', value=9.99e8), gen.txout(addr='2NFTctsgcAmrgtiboLJUx9q8qu5H1qVpcAb', value=20e8), gen.txout(multisig={"m":2, "pubkeys":data.PUBKEYS[2:5]}, value=20e8)])]) ) if 'ABE_TEST_SAVE_BLKFILE' in os.environ: gen.save_blkfile(os.environ['ABE_TEST_SAVE_BLKFILE'], blocks) # XXX Lots of code duplicated in test_block_order.py. datadir = py.path.local(tempfile.mkdtemp(prefix='abe-test-')) request.addfinalizer(datadir.remove) gen.save_blkfile(str(datadir.join('blk0001.dat')), blocks) gen.store = testdb.load('--datadir', json.dumps([{ 'dirname': str(datadir), 'chain': chain.name, 'loader': 'blkfile'}])) gen.chain = gen.store.get_chain_by_name(chain.name) return gen
def max200(testdb): try: Abe.util.sha3_256('x') except Exception as e: pytest.skip('SHA3 not working: e') dirname = os.path.join(os.path.split(__file__)[0], 'max200') store = testdb.load('--datadir', dirname) return store
def gen(testdb, request): gen = data.testnet14(testdb) chain = gen.chain blocks = gen.blocks # A - C* - D** # \ # E - B* # # * contains tx1 # ** contains tx2 tx1 = gen.tx(txIn=[ gen.txin(prevout=blocks[1]['transactions'][0]['txOut'][0], scriptSig='XXX') ], txOut=[ gen.txout(addr='n1pTUVnjZ6GHxujaoJ62P9NBMNjLr5N2EQ', value=50e8) ]) A = blocks[-1] C = gen.block(prev=A, transactions=[gen.coinbase(), tx1]) E = gen.block(prev=A) B = gen.block(prev=E, transactions=[gen.coinbase(), tx1]) tx2 = gen.tx(txIn=[ gen.txin(prevout=C['transactions'][1]['txOut'][0], scriptSig='YYY') ], txOut=[ gen.txout(addr='2NFTctsgcAmrgtiboLJUx9q8qu5H1qVpcAb', value=50e8) ]) D = gen.block(prev=C, transactions=[gen.coinbase(), tx2]) blocks += [B, C, D, E] # XXX Lots of code duplicated in test_std_tx.py. datadir = py.path.local(tempfile.mkdtemp(prefix='abe-test-')) request.addfinalizer(datadir.remove) gen.save_blkfile(str(datadir.join('blk0001.dat')), blocks) gen.store = testdb.load( '--datadir', json.dumps([{ 'dirname': str(datadir), 'chain': chain.name, 'loader': 'blkfile' }])) gen.chain = gen.store.get_chain_by_name(chain.name) return gen
def gen(testdb, request): chain = Abe.Chain.create('Testnet') blocks = [] gen = datagen.Gen(chain=chain, db=testdb, blocks=blocks) # The Bitcoin/Testnet genesis transaction. genesis_coinbase = gen.coinbase( scriptSig=gen.encode_script( '\xff\xff\x00\x1d', '\x04', 'The Times 03/Jan/2009 Chancellor on brink of second bailout for banks'), txOut=[gen.txout(pubkey=PUBKEYS[0], value=50*10**8)]) # Testnet Blocks 0 and 1. blocks.append(gen.block(transactions=[genesis_coinbase], nTime=1296688602, nNonce=414098458)) blocks.append( gen.block(prev=blocks[-1], nTime=1296688928, nNonce=1924588547, transactions=[gen.coinbase(scriptSig='0420e7494d017f062f503253482f'.decode('hex'), txOut=[gen.txout(pubkey=PUBKEYS[1], value=50*10**8)])]) ) # Test blocks with random coinbase addresses and bogus proof-of-work. for i in xrange(12): blocks.append( gen.block(prev=blocks[-1]) ) # Test block with an interesting transaction. blocks.append( gen.block( prev=blocks[-1], transactions=[ gen.coinbase(value=50.01e8), gen.tx(txIn=[gen.txin(prevout=blocks[1]['transactions'][0]['txOut'][0], scriptSig='XXX')], txOut=[gen.txout(addr='n1pTUVnjZ6GHxujaoJ62P9NBMNjLr5N2EQ', value=9.99e8), gen.txout(addr='2NFTctsgcAmrgtiboLJUx9q8qu5H1qVpcAb', value=20e8), gen.txout(multisig={"m":2, "pubkeys":PUBKEYS[2:5]}, value=20e8)])]) ) if 'ABE_TEST_SAVE_BLKFILE' in os.environ: gen.save_blkfile(os.environ['ABE_TEST_SAVE_BLKFILE'], blocks) datadir = py.path.local(tempfile.mkdtemp(prefix='abe-test-')) request.addfinalizer(datadir.remove) gen.save_blkfile(str(datadir.join('blk0001.dat')), blocks) gen.store = testdb.load('--datadir', json.dumps([{ 'dirname': str(datadir), 'chain': chain.name, 'loader': 'blkfile'}])) gen.chain = gen.store.get_chain_by_name(chain.name) return gen
def gen(testdb, request): gen = data.testnet14(testdb) chain = gen.chain blocks = gen.blocks # A - C* - D** # \ # E - B* # # * contains tx1 # ** contains tx2 tx1 = gen.tx(txIn=[gen.txin(prevout=blocks[1]['transactions'][0]['txOut'][0], scriptSig='XXX')], txOut=[gen.txout(addr='n1pTUVnjZ6GHxujaoJ62P9NBMNjLr5N2EQ', value=50e8)]) A = blocks[-1] C = gen.block(prev=A, transactions=[gen.coinbase(), tx1]) E = gen.block(prev=A) B = gen.block(prev=E, transactions=[gen.coinbase(), tx1]) tx2 = gen.tx(txIn=[gen.txin(prevout=C['transactions'][1]['txOut'][0], scriptSig='YYY')], txOut=[gen.txout(addr='2NFTctsgcAmrgtiboLJUx9q8qu5H1qVpcAb', value=50e8)]) D = gen.block(prev=C, transactions=[gen.coinbase(), tx2]) blocks += [B, C, D, E] # XXX Lots of code duplicated in test_std_tx.py. datadir = py.path.local(tempfile.mkdtemp(prefix='abe-test-')) request.addfinalizer(datadir.remove) gen.save_blkfile(str(datadir.join('blk0001.dat')), blocks) gen.store = testdb.load('--datadir', json.dumps([{ 'dirname': str(datadir), 'chain': chain.name, 'loader': 'blkfile'}])) gen.chain = gen.store.get_chain_by_name(chain.name) return gen
def btc200(testdb): dirname = os.path.join(os.path.split(__file__)[0], 'btc200') store = testdb.load('--datadir', dirname) return store
def gen(testdb, request): chain = Abe.Chain.create('Testnet') blocks = [] gen = datagen.Gen(chain=chain, db=testdb, blocks=blocks) # The Bitcoin/Testnet genesis transaction. genesis_coinbase = gen.coinbase(scriptSig=gen.encode_script( '\xff\xff\x00\x1d', '\x04', 'The Times 03/Jan/2009 Chancellor on brink of second bailout for banks' ), txOut=[ gen.txout(pubkey=PUBKEYS[0], value=50 * 10**8) ]) # Testnet Blocks 0 and 1. blocks.append( gen.block(transactions=[genesis_coinbase], nTime=1296688602, nNonce=414098458)) blocks.append( gen.block( prev=blocks[-1], nTime=1296688928, nNonce=1924588547, transactions=[ gen.coinbase( scriptSig='0420e7494d017f062f503253482f'.decode('hex'), txOut=[gen.txout(pubkey=PUBKEYS[1], value=50 * 10**8)]) ])) # Test blocks with random coinbase addresses and bogus proof-of-work. for i in xrange(12): blocks.append(gen.block(prev=blocks[-1])) # Test block with an interesting transaction. blocks.append( gen.block( prev=blocks[-1], transactions=[ gen.coinbase(value=50.01e8), gen.tx(txIn=[ gen.txin(prevout=blocks[1]['transactions'][0]['txOut'][0], scriptSig='XXX') ], txOut=[ gen.txout(addr='n1pTUVnjZ6GHxujaoJ62P9NBMNjLr5N2EQ', value=9.99e8), gen.txout( addr='2NFTctsgcAmrgtiboLJUx9q8qu5H1qVpcAb', value=20e8), gen.txout(multisig={ "m": 2, "pubkeys": PUBKEYS[2:5] }, value=20e8) ]) ])) if 'ABE_TEST_SAVE_BLKFILE' in os.environ: gen.save_blkfile(os.environ['ABE_TEST_SAVE_BLKFILE'], blocks) datadir = py.path.local(tempfile.mkdtemp(prefix='abe-test-')) request.addfinalizer(datadir.remove) gen.save_blkfile(str(datadir.join('blk0001.dat')), blocks) gen.store = testdb.load( '--datadir', json.dumps([{ 'dirname': str(datadir), 'chain': chain.name, 'loader': 'blkfile' }])) gen.chain = gen.store.get_chain_by_name(chain.name) return gen