From 2bc972f4c764ca03c584ac64415dd6e932c58f1e Mon Sep 17 00:00:00 2001 From: Dimitry Date: Tue, 11 Aug 2015 17:26:21 +0300 Subject: [PATCH 01/57] BLock2: state test filling issue --- test/libethereum/state.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 4c9d998b22c..2aa6dd0f43b 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -59,7 +59,6 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) const State importedStatePost = importer.m_statePost; bytes output; - // execute transaction Listener::ExecTimeGuard guard{i.first}; output = importer.executeTest(); From 4f299044411b3bbfd4b54b9dea265847caf2e4f3 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 12 Aug 2015 17:16:40 +0300 Subject: [PATCH 02/57] restore lost changes blockmining --- test/libethereum/blockchain.cpp | 269 +++++++++++++++++--------------- 1 file changed, 145 insertions(+), 124 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 0be4d66228d..83a50a1f79b 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -29,6 +29,8 @@ #include #include +#include + using namespace std; using namespace json_spirit; using namespace dev; @@ -53,6 +55,8 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vect void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { + _fillin = true; + for (auto& i: _v.get_obj()) { mObject& o = i.second.get_obj(); @@ -69,12 +73,25 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) ImportTest importer(o, _fillin, testType::BlockChainTests); TransientDirectory td_stateDB_tmp; BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); - State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); - importer.importState(o["pre"].get_obj(), trueState); + ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); + + /// Trick + //merge into init state string our test predefined state and change difficulty for testing + //string genesisState = *(const_cast(&c_genesisInfoFrontier/*c_genesisInfoOlympic*/)); + /*size_t pos = genesisState.find("alloc"); + string sss = json_spirit::write_string(o["pre"], true); + sss.replace(0, 1, ""); + sss.replace(sss.length() - 2, 2, ","); + genesisState.insert(pos + 9, sss); + genesisState.replace(genesisState.find("0x400000000"), 7, "0x20000"); + note << genesisState; + */ + /// + //Imported blocks from the start std::vector blockSets; //Block(bytes) => UncleList(Blocks(bytes)) @@ -129,10 +146,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) TransientDirectory td_stateDB, td_bc; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); - OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state(database, BaseState::Empty); - Block block(database, BaseState::Empty, biGenesisBlock.beneficiary()); - state = importer.m_statePre; + //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); + State state = importer.m_statePre; state.commit(); //import previous blocks @@ -186,9 +201,14 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) cnote << "error in importing uncle! This produces an invalid block (May be by purpose for testing)."; } } + bc.sync(uncleBlockQueue, state.db(), 4); - block.commitToSeal(bc); + //block.commitToSeal(bc); + //Block block(State::openDB(bc.genesisHash()), BaseState::Empty, biGenesisBlock.beneficiary()); + Block block = bc.genesisBlock(State::openDB(bc.genesisHash())); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK + //Block block (State::openDB(biGenesisBlock.hash())); + //Block block(state.db(), BaseState::Empty); //mine a new block on top of previously imported try { @@ -208,125 +228,126 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } -// blObj["rlp"] = toHex(state.blockData(), 2, HexPrefix::Add); - -// //get valid transactions -// Transactions txList; -// for (auto const& txi: txs.topTransactions(std::numeric_limits::max())) -// txList.push_back(txi); -// blObj["transactions"] = writeTransactionsToJson(txList); - -// BlockHeader current_BlockHeader = state.info(); - -// RLPStream uncleStream; -// uncleStream.appendList(vBiUncles.size()); -// for (unsigned i = 0; i < vBiUncles.size(); ++i) -// { -// RLPStream uncleRlp; -// vBiUncles[i].streamRLP(uncleRlp); -// uncleStream.appendRaw(uncleRlp.out()); -// } - -// if (blObj.count("blockHeader")) -// overwriteBlockHeader(current_BlockHeader, blObj); - -// if (blObj.count("blockHeader") && blObj["blockHeader"].get_obj().count("bruncle")) -// current_BlockHeader.populateFromParent(vBiBlocks[vBiBlocks.size() -1]); - -// if (vBiUncles.size()) -// { -// // update unclehash in case of invalid uncles -// current_BlockHeader.setSha3Uncles(sha3(uncleStream.out())); -// updatePoW(current_BlockHeader); -// } - -// // write block header -// mObject oBlockHeader; -// writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); -// blObj["blockHeader"] = oBlockHeader; -// vBiBlocks.push_back(current_BlockHeader); - -// // compare blocks from state and from rlp -// RLPStream txStream; -// txStream.appendList(txList.size()); -// for (unsigned i = 0; i < txList.size(); ++i) -// { -// RLPStream txrlp; -// txList[i].streamRLP(txrlp); -// txStream.appendRaw(txrlp.out()); -// } - -// RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); - -// blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); - -// if (sha3(RLP(state.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) -// { -// cnote << "block header mismatch state.blockData() vs updated state.info()\n"; -// cerr << toHex(state.blockData()) << "vs" << toHex(block2.out()); -// } - -// if (sha3(RLP(state.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) -// cnote << "txs mismatch\n"; - -// if (sha3(RLP(state.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) -// cnote << "uncle list mismatch\n" << RLP(state.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); - -// try -// { -// state.sync(bc); -// bc.import(block2.out(), state.db()); -// state.sync(bc); -// state.commit(); - -// //there we get new blockchain status in state which could have more difficulty than we have in trueState -// //attempt to import new block to the true blockchain -// trueBc.sync(uncleBlockQueue, trueState.db(), 4); -// trueBc.attemptImport(block2.out(), trueState.db()); -// trueState.sync(trueBc); - -// blockSet newBlock; -// newBlock.first = block2.out(); -// newBlock.second = uncleBlockQueueList; -// if (importBlockNumber < blockSets.size()) -// { -// //make new correct history of imported blocks -// blockSets[importBlockNumber] = newBlock; -// for (size_t i = importBlockNumber + 1; i < blockSets.size(); i++) -// blockSets.pop_back(); -// } -// else -// blockSets.push_back(newBlock); -// } -// // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given -// catch (...) -// { -// cnote << "block is invalid!\n"; -// blObj.erase(blObj.find("blockHeader")); -// blObj.erase(blObj.find("uncleHeaders")); -// blObj.erase(blObj.find("transactions")); -// } -// blArray.push_back(blObj); -// this_thread::sleep_for(chrono::seconds(1)); + blObj["rlp"] = toHex(block.blockData(), 2, HexPrefix::Add); + + //get valid transactions + Transactions txList; + for (auto const& txi: txs.topTransactions(std::numeric_limits::max())) + txList.push_back(txi); + blObj["transactions"] = writeTransactionsToJson(txList); + + BlockHeader current_BlockHeader = block.info(); + + RLPStream uncleStream; + uncleStream.appendList(vBiUncles.size()); + for (unsigned i = 0; i < vBiUncles.size(); ++i) + { + RLPStream uncleRlp; + vBiUncles[i].streamRLP(uncleRlp); + uncleStream.appendRaw(uncleRlp.out()); + } + + if (blObj.count("blockHeader")) + overwriteBlockHeader(current_BlockHeader, blObj, bc.info()); + + if (blObj.count("blockHeader") && blObj["blockHeader"].get_obj().count("bruncle")) + current_BlockHeader.populateFromParent(vBiBlocks[vBiBlocks.size() -1]); + + if (vBiUncles.size()) + { + // update unclehash in case of invalid uncles + current_BlockHeader.setSha3Uncles(sha3(uncleStream.out())); + updatePoW(current_BlockHeader); + } + + // write block header + mObject oBlockHeader; + writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); + blObj["blockHeader"] = oBlockHeader; + vBiBlocks.push_back(current_BlockHeader); + + // compare blocks from state and from rlp + RLPStream txStream; + txStream.appendList(txList.size()); + for (unsigned i = 0; i < txList.size(); ++i) + { + RLPStream txrlp; + txList[i].streamRLP(txrlp); + txStream.appendRaw(txrlp.out()); + } + + RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); + + blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); + + if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) + { + cnote << "block header mismatch block.blockData() vs updated block.info()\n"; + cerr << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(block2.out())[0].data()); + } + + if (sha3(RLP(block.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) + cnote << "txs mismatch\n"; + + if (sha3(RLP(block.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) + cnote << "uncle list mismatch\n" << RLP(block.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); + + try + { + block.sync(bc); + bc.import(block2.out(), block.db()); + block.sync(bc); + //block.commit(); + + + //there we get new blockchain status in state which could have more difficulty than we have in trueState + //attempt to import new block to the true blockchain + trueBc.sync(uncleBlockQueue, trueState.db(), 4); + trueBc.attemptImport(block2.out(), trueState.db()); + //trueState.sync(trueBc); + + blockSet newBlock; + newBlock.first = block2.out(); + newBlock.second = uncleBlockQueueList; + if (importBlockNumber < blockSets.size()) + { + //make new correct history of imported blocks + blockSets[importBlockNumber] = newBlock; + for (size_t i = importBlockNumber + 1; i < blockSets.size(); i++) + blockSets.pop_back(); + } + else + blockSets.push_back(newBlock); + } + // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given + catch (...) + { + cnote << "block is invalid!\n"; + blObj.erase(blObj.find("blockHeader")); + blObj.erase(blObj.find("uncleHeaders")); + blObj.erase(blObj.find("transactions")); + } + blArray.push_back(blObj); + this_thread::sleep_for(chrono::seconds(1)); } //for blocks -// if (o.count("expect") > 0) -// { -// AccountMaskMap expectStateMap; -// State stateExpect(OverlayDB(), BaseState::Empty, biGenesisBlock.beneficiary()); -// ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); -// ImportTest::checkExpectedState(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); -// o.erase(o.find("expect")); -// } - -// o["blocks"] = blArray; -// o["postState"] = fillJsonWithState(trueState); -// o["lastblockhash"] = toString(trueBc.info().hash()); - -// //make all values hex in pre section -// State prestate(OverlayDB(), BaseState::Empty); -// ImportTest::importState(o["pre"].get_obj(), prestate); -// o["pre"] = fillJsonWithState(prestate); + if (o.count("expect") > 0) + { + AccountMaskMap expectStateMap; + State stateExpect(OverlayDB(), BaseState::Empty); + ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); + ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + o.erase(o.find("expect")); + } + + o["blocks"] = blArray; + o["postState"] = fillJsonWithState(trueState); + o["lastblockhash"] = toString(trueBc.info().hash()); + + //make all values hex in pre section + State prestate(OverlayDB(), BaseState::Empty); + ImportTest::importState(o["pre"].get_obj(), prestate); + o["pre"] = fillJsonWithState(prestate); }//_fillin else { From 93f6e0abe7aad582333f62e9d044d0c4352dbd93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 12 Aug 2015 19:57:04 +0200 Subject: [PATCH 03/57] Link consecutive basic blocks after all blocks are compiled. --- evmjit/libevmjit/Array.h | 2 +- evmjit/libevmjit/BasicBlock.cpp | 8 +++--- evmjit/libevmjit/Compiler.cpp | 46 +++++++++++++++++++++------------ evmjit/libevmjit/Compiler.h | 2 +- evmjit/libevmjit/Stack.cpp | 2 -- 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/evmjit/libevmjit/Array.h b/evmjit/libevmjit/Array.h index a2db976b320..c85c8c1f980 100644 --- a/evmjit/libevmjit/Array.h +++ b/evmjit/libevmjit/Array.h @@ -58,7 +58,7 @@ class Array : public CompilerHelper llvm::Function* createExtendFunc(); llvm::Function* getReallocFunc(); - LazyFunction m_pushFunc = {[this](){ return createArrayPushFunc(); }}; // TODO: If works on MSVC, remove form initialization list + LazyFunction m_pushFunc = {[this](){ return createArrayPushFunc(); }}; LazyFunction m_setFunc = {[this](){ return createArraySetFunc(); }}; LazyFunction m_getPtrFunc = {[this](){ return createGetPtrFunc(); }}; LazyFunction m_getFunc = {[this](){ return createArrayGetFunc(); }}; diff --git a/evmjit/libevmjit/BasicBlock.cpp b/evmjit/libevmjit/BasicBlock.cpp index 47b590103e7..6ded81c7301 100644 --- a/evmjit/libevmjit/BasicBlock.cpp +++ b/evmjit/libevmjit/BasicBlock.cpp @@ -110,11 +110,13 @@ void LocalStack::set(size_t _index, llvm::Value* _word) void LocalStack::finalize(llvm::IRBuilder<>& _builder, llvm::BasicBlock& _bb) { auto blockTerminator = _bb.getTerminator(); - assert(blockTerminator); - if (blockTerminator->getOpcode() != llvm::Instruction::Ret) + if (!blockTerminator || blockTerminator->getOpcode() != llvm::Instruction::Ret) { // Not needed in case of ret instruction. Ret invalidates the stack. - _builder.SetInsertPoint(blockTerminator); + if (blockTerminator) + _builder.SetInsertPoint(blockTerminator); + else + _builder.SetInsertPoint(&_bb); // Update items fetched from global stack ignoring the poped ones assert(m_globalPops <= m_input.size()); // pop() always does get() diff --git a/evmjit/libevmjit/Compiler.cpp b/evmjit/libevmjit/Compiler.cpp index 182b5fef8c4..c3f7194bbef 100644 --- a/evmjit/libevmjit/Compiler.cpp +++ b/evmjit/libevmjit/Compiler.cpp @@ -95,6 +95,32 @@ std::vector Compiler::createBasicBlocks(code_iterator _codeBegin, co void Compiler::fillJumpTable() { + for (auto it = m_mainFunc->begin(); it != m_mainFunc->end(); ++it) + { + auto term = it->getTerminator(); + if (!term) + { + // Block may have no terminator if the next instruction is a jump destination. + auto next = it->getNextNode(); + if (next == m_mainFunc->end()) + next = m_stopBB; + llvm::IRBuilder<>{it}.CreateBr(next); + } + else if (auto jump = llvm::dyn_cast(term)) + { + if (jump->isConditional()) + { + if (!jump->getSuccessor(1)) + { + auto next = it->getNextNode(); + if (next == m_mainFunc->end()) + next = m_stopBB; + jump->setSuccessor(1, next); + } + } + } + } + assert(m_jumpTableBB); if (llvm::pred_empty(m_jumpTableBB)) { @@ -160,13 +186,8 @@ std::unique_ptr Compiler::compile(code_iterator _begin, code_itera auto firstBB = blocks.empty() ? m_stopBB : blocks.front().llvm(); m_builder.CreateCondBr(normalFlow, firstBB, m_abortBB, Type::expectTrue); - for (auto it = blocks.begin(); it != blocks.end(); ++it) - { - // TODO: Rewrite - auto nextIt = it + 1; - auto nextBasicBlock = (nextIt != blocks.end()) ? nextIt->llvm() : nullptr; // TODO: What with Stop block? - compileBasicBlock(*it, runtimeManager, arith, memory, ext, gasMeter, nextBasicBlock, stack, jumpTable); - } + for (auto& block: blocks) + compileBasicBlock(block, runtimeManager, arith, memory, ext, gasMeter, stack, jumpTable); // Code for special blocks: m_builder.SetInsertPoint(m_stopBB); @@ -182,12 +203,9 @@ std::unique_ptr Compiler::compile(code_iterator _begin, code_itera void Compiler::compileBasicBlock(BasicBlock& _basicBlock, RuntimeManager& _runtimeManager, - Arith256& _arith, Memory& _memory, Ext& _ext, GasMeter& _gasMeter, llvm::BasicBlock* _nextBasicBlock, Stack& _globalStack, + Arith256& _arith, Memory& _memory, Ext& _ext, GasMeter& _gasMeter, Stack& _globalStack, llvm::SwitchInst& jumpTable) { - if (!_nextBasicBlock) // this is the last block in the code - _nextBasicBlock = m_stopBB; - m_builder.SetInsertPoint(_basicBlock.llvm()); LocalStack stack{_globalStack}; @@ -560,7 +578,7 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, RuntimeManager& _runti auto target = stack.pop(); auto jumpInst = (inst == Instruction::JUMP) ? m_builder.CreateBr(jumpBlock) : - m_builder.CreateCondBr(m_builder.CreateICmpNE(stack.pop(), Constant::get(0), "jump.check"), jumpBlock, _nextBasicBlock); + m_builder.CreateCondBr(m_builder.CreateICmpNE(stack.pop(), Constant::get(0), "jump.check"), jumpBlock, nullptr); if (auto constant = llvm::dyn_cast(target)) { @@ -790,10 +808,6 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, RuntimeManager& _runti _gasMeter.commitCostBlock(); - // Block may have no terminator if the next instruction is a jump destination. - if (!_basicBlock.llvm()->getTerminator()) - m_builder.CreateBr(_nextBasicBlock); - stack.finalize(m_builder, *_basicBlock.llvm()); // TODO: Use references m_builder.SetInsertPoint(_basicBlock.llvm()->getFirstNonPHI()); // TODO: Move to LocalStack::finalize diff --git a/evmjit/libevmjit/Compiler.h b/evmjit/libevmjit/Compiler.h index af45acedb39..740e14ac8ab 100644 --- a/evmjit/libevmjit/Compiler.h +++ b/evmjit/libevmjit/Compiler.h @@ -31,7 +31,7 @@ class Compiler std::vector createBasicBlocks(code_iterator _begin, code_iterator _end, llvm::SwitchInst& _switchInst); void compileBasicBlock(BasicBlock& _basicBlock, class RuntimeManager& _runtimeManager, class Arith256& _arith, class Memory& _memory, class Ext& _ext, class GasMeter& _gasMeter, - llvm::BasicBlock* _nextBasicBlock, class Stack& _globalStack, llvm::SwitchInst& _jumpTable); + class Stack& _globalStack, llvm::SwitchInst& _jumpTable); void fillJumpTable(); diff --git a/evmjit/libevmjit/Stack.cpp b/evmjit/libevmjit/Stack.cpp index 273aa3855f9..037d71f1deb 100644 --- a/evmjit/libevmjit/Stack.cpp +++ b/evmjit/libevmjit/Stack.cpp @@ -7,8 +7,6 @@ #include "RuntimeManager.h" #include "Utils.h" -#include // DEBUG only - namespace dev { namespace eth From 0cad5c008cceebe4b75117be29fa29279fe5a2a1 Mon Sep 17 00:00:00 2001 From: Tasha CARL Date: Thu, 13 Aug 2015 08:05:39 +0200 Subject: [PATCH 04/57] fixed typos and unified expressions --- eth/main.cpp | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 68f1da7264d..5076637d383 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -83,20 +83,20 @@ void help() << " --olympic Use the Olympic (0.9) protocol." << endl << " --frontier Use the Frontier (1.0) protocol." << endl << " --private Use a private chain." << endl - << " --genesis-json Import the genesis block information from the given json file." << endl + << " --genesis-json Import the genesis block information from the given JSON file." << endl << endl << " -o,--mode Start a full node or a peer node (default: full)." << endl << endl #if ETH_JSONRPC || !ETH_TRUE << " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl << " --json-rpc-port Specify JSON-RPC server port (implies '-j', default: " << SensibleHttpPort << ")." << endl - << " --admin Specify admin session key for JSON-RPC (default: auto-generated and printed at startup)." << endl + << " --admin Specify admin session key for JSON-RPC (default: auto-generated and printed at start-up)." << endl #endif - << " -K,--kill First kill the blockchain." << endl + << " -K,--kill Kill the blockchain first." << endl << " -R,--rebuild Rebuild the blockchain from the existing database." << endl << " --rescue Attempt to rescue a corrupt database." << endl << endl - << " --import-presale Import a presale key; you'll need to type the password to this." << endl + << " --import-presale Import a pre-sale key; you'll need to specify the password to this key." << endl << " -s,--import-secret Import a secret key into the key store and use as the default." << endl << " -S,--import-session-secret Import a secret key into the key store and use as the default for this session only." << endl << " --sign-key
Sign all transactions with the key of the given address." << endl @@ -106,74 +106,74 @@ void help() << " --sentinel Set the sentinel for reporting bad blocks or chain issues." << endl << endl << "Client transacting:" << endl - /*<< " -B,--block-fees Set the block fee profit in the reference unit e.g. ¢ (default: 15)." << endl - << " -e,--ether-price Set the ether price in the reference unit e.g. ¢ (default: 30.679)." << endl - << " -P,--priority <0 - 100> Default % priority of a transaction (default: 50)." << endl*/ - << " --ask Set the minimum ask gas price under which no transactions will be mined (default " << toString(c_defaultGasPrice) << " )." << endl - << " --bid Set the bid gas price for to pay for transactions (default " << toString(c_defaultGasPrice) << " )." << endl + /*<< " -B,--block-fees Set the block fee profit in the reference unit, e.g. ¢ (default: 15)." << endl + << " -e,--ether-price Set the ether price in the reference unit, e.g. ¢ (default: 30.679)." << endl + << " -P,--priority <0 - 100> Set the default priority percentage (%) of a transaction (default: 50)." << endl*/ + << " --ask Set the minimum ask gas price under which no transaction will be mined (default " << toString(c_defaultGasPrice) << " )." << endl + << " --bid Set the bid gas price to pay for transactions (default " << toString(c_defaultGasPrice) << " )." << endl << endl << "Client mining:" << endl - << " -a,--address Set the coinbase (mining payout) address to addr (default: auto)." << endl - << " -m,--mining Enable mining, optionally for a specified number of blocks (default: off)" << endl - << " -f,--force-mining Mine even when there are no transactions to mine (default: off)" << endl - << " --mine-on-wrong-chain Mine even when we know it's the wrong chain (default: off)" << endl + << " -a,--address Set the coinbase (mining payout) address to given address (default: auto)." << endl + << " -m,--mining Enable mining, optionally for a specified number of blocks (default: off)." << endl + << " -f,--force-mining Mine even when there are no transactions to mine (default: off)." << endl + << " --mine-on-wrong-chain Mine even when we know that it is the wrong chain (default: off)." << endl << " -C,--cpu When mining, use the CPU." << endl - << " -G,--opencl When mining use the GPU via OpenCL." << endl - << " --opencl-platform When mining using -G/--opencl use OpenCL platform n (default: 0)." << endl - << " --opencl-device When mining using -G/--opencl use OpenCL device n (default: 0)." << endl - << " -t, --mining-threads Limit number of CPU/GPU miners to n (default: use everything available on selected platform)" << endl + << " -G,--opencl When mining, use the GPU via OpenCL." << endl + << " --opencl-platform When mining using -G/--opencl, use OpenCL platform n (default: 0)." << endl + << " --opencl-device When mining using -G/--opencl, use OpenCL device n (default: 0)." << endl + << " -t, --mining-threads Limit number of CPU/GPU miners to n (default: use everything available on selected platform)." << endl << endl << "Client networking:" << endl << " --client-name Add a name to your client's version string (default: blank)." << endl - << " --bootstrap Connect to the default Ethereum peerservers (default unless --no-discovery used)." << endl - << " --no-bootstrap Do not connect to the default Ethereum peerservers (default only when --no-discovery is used)." << endl - << " -x,--peers Attempt to connect to given number of peers (default: 11)." << endl - << " --peer-stretch Accepted connection multiplier (default: 7)." << endl + << " --bootstrap Connect to the default Ethereum peer servers (default unless --no-discovery used)." << endl + << " --no-bootstrap Do not connect to the default Ethereum peer servers (default only when --no-discovery is used)." << endl + << " -x,--peers Attempt to connect to a given number of peers (default: 11)." << endl + << " --peer-stretch Give the accepted connection multiplier (default: 7)." << endl - << " --public-ip Force advertised public ip to given (default: auto)." << endl + << " --public-ip Force advertised public IP to the given IP (default: auto)." << endl << " --listen-ip (:) Listen on the given IP for incoming connections (default: 0.0.0.0)." << endl << " --listen Listen on the given port for incoming connections (default: 30303)." << endl - << " -r,--remote (:) Connect to remote host (default: none)." << endl - << " --port Connect to remote port (default: 30303)." << endl - << " --network-id Only connect to other hosts with this network id." << endl + << " -r,--remote (:) Connect to the given remote host (default: none)." << endl + << " --port Connect to the given remote port (default: 30303)." << endl + << " --network-id Only connect to other hosts with this network id." << endl << " --upnp Use UPnP for NAT (default: on)." << endl - << " --peerset Space delimited list of type type:publickey@ipAddress[:port]" << endl + << " --peerset Space delimited list of peers; element format: type:publickey@ipAddress[:port]." << endl << " Types:" << endl - << " default Attempt connection when no other peers are available and pinning is disable." << endl + << " default Attempt connection when no other peers are available and pinning is disabled." << endl << " require Keep connected at all times." << endl // TODO: // << " --trust-peers Space delimited list of publickeys." << endl - << " --no-discovery Disable Node discovery, implies --no-bootstrap." << endl + << " --no-discovery Disable node discovery, implies --no-bootstrap." << endl << " --pin Only accept or connect to trusted peers." << endl << " --hermit Equivalent to --no-discovery --pin." << endl - << " --sociable Forces discovery and no pinning." << endl + << " --sociable Force discovery and no pinning." << endl << endl; MinerCLI::streamHelp(cout); cout << "Client structured logging:" << endl - << " --structured-logging Enable structured logging (default output to stdout)." << endl + << " --structured-logging Enable structured logging (default: output to stdout)." << endl << " --structured-logging-format Set the structured logging time format." << endl << " --structured-logging-url Set the structured logging destination (currently only file:// supported)." << endl << endl << "Import/export modes:" << endl - << " --from Export only from block n; n may be a decimal, a '0x' prefixed hash, or 'latest'." << endl - << " --to Export only to block n (inclusive); n may be a decimal, a '0x' prefixed hash, or 'latest'." << endl + << " --from Export only from block n; n may be a decimal, a '0x' pre-fixed hash, or 'latest'." << endl + << " --to Export only to block n (inclusive); n may be a decimal, a '0x' pre-fixed hash, or 'latest'." << endl << " --only Equivalent to --export-from n --export-to n." << endl - << " --dont-check Avoids checking some of the aspects of blocks. Faster importing, but only do if you know the data is valid." << endl + << " --dont-check Prevent checking some block aspects. Faster importing, but to apply only when the data is known to be valid." << endl << endl << "General Options:" << endl - << " -d,--db-path Load database from path (default: " << getDataDir() << ")" << endl + << " -d,--db-path Load database from path (default: " << getDataDir() << ")." << endl #if ETH_EVMJIT || !ETH_TRUE - << " --vm Select VM. Options are: interpreter, jit, smart. (default: interpreter)" << endl + << " --vm Select VM; options are: interpreter, jit or smart (default: interpreter)." << endl #endif << " -v,--verbosity <0 - 9> Set the log verbosity from 0 to 9 (default: 8)." << endl << " -V,--version Show the version and exit." << endl << " -h,--help Show this help message and exit." << endl << endl << "Experimental / Proof of Concept:" << endl - << " --shh Enable Whisper" << endl + << " --shh Enable Whisper." << endl << endl ; exit(0); From f231ffdf0ddc742f9049233c88602127d550cf3c Mon Sep 17 00:00:00 2001 From: Tasha CARL Date: Thu, 13 Aug 2015 08:10:50 +0200 Subject: [PATCH 05/57] Added name and license info as required --- eth/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eth/main.cpp b/eth/main.cpp index 5076637d383..8815273f2c5 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -14,8 +14,10 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file main.cpp +/** + * @file main.cpp * @author Gav Wood + * @author Tasha Carl - I here by place all my contributions in this file under MIT licence, as specified by http://opensource.org/licenses/MIT. * @date 2014 * Ethereum client. */ From 1d5c8c28d7a31098fc72b7f7253bf19e7cb9948b Mon Sep 17 00:00:00 2001 From: Tasha CARL Date: Thu, 13 Aug 2015 08:34:53 +0200 Subject: [PATCH 06/57] 'coinbase' to 'etherbase' (parameters, help text) The coinbase/etherbase terminology causes confusion in the community. The mining payout is referenced everywhere as etherbase, except in some places where referenced as coinbase. Since coinbase might be a TM and etherbase is mostly used, I suggest to stick with etherbase. --- eth/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 8815273f2c5..2c1dcaeef61 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -115,7 +115,7 @@ void help() << " --bid Set the bid gas price to pay for transactions (default " << toString(c_defaultGasPrice) << " )." << endl << endl << "Client mining:" << endl - << " -a,--address Set the coinbase (mining payout) address to given address (default: auto)." << endl + << " -a,--address Set the etherbase (mining payout) address to given address (default: auto)." << endl << " -m,--mining Enable mining, optionally for a specified number of blocks (default: off)." << endl << " -f,--force-mining Mine even when there are no transactions to mine (default: off)." << endl << " --mine-on-wrong-chain Mine even when we know that it is the wrong chain (default: off)." << endl @@ -494,7 +494,7 @@ int main(int argc, char** argv) cerr << "-c is DEPRECATED. It will be removed for the Frontier. Use --client-name instead." << endl; clientName = argv[++i]; } - else if ((arg == "-a" || arg == "--address" || arg == "--coinbase-address") && i + 1 < argc) + else if ((arg == "-a" || arg == "--address" || arg == "--etherbase-address" || arg == "--coinbase-address") && i + 1 < argc) try { beneficiary = h160(fromHex(argv[++i], WhenError::Throw)); } From c050fc39e96e53d0595791f1f03463e0b8b79ed6 Mon Sep 17 00:00:00 2001 From: Tasha CARL Date: Thu, 13 Aug 2015 12:52:22 +0200 Subject: [PATCH 07/57] Corrects pre-coffee typo --- eth/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 2c1dcaeef61..de3412b33d3 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -160,8 +160,8 @@ void help() << " --structured-logging-url Set the structured logging destination (currently only file:// supported)." << endl << endl << "Import/export modes:" << endl - << " --from Export only from block n; n may be a decimal, a '0x' pre-fixed hash, or 'latest'." << endl - << " --to Export only to block n (inclusive); n may be a decimal, a '0x' pre-fixed hash, or 'latest'." << endl + << " --from Export only from block n; n may be a decimal, a '0x' prefixed hash, or 'latest'." << endl + << " --to Export only to block n (inclusive); n may be a decimal, a '0x' prefixed hash, or 'latest'." << endl << " --only Equivalent to --export-from n --export-to n." << endl << " --dont-check Prevent checking some block aspects. Faster importing, but to apply only when the data is known to be valid." << endl << endl From 157c4a0f8c86e8e3f501cf802e71f39ccfd7fe02 Mon Sep 17 00:00:00 2001 From: Tasha CARL Date: Thu, 13 Aug 2015 12:58:31 +0200 Subject: [PATCH 08/57] Undo ether/coinbase renaming, will be changed later to for example beneficary --- eth/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index de3412b33d3..358ca02663f 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -115,7 +115,7 @@ void help() << " --bid Set the bid gas price to pay for transactions (default " << toString(c_defaultGasPrice) << " )." << endl << endl << "Client mining:" << endl - << " -a,--address Set the etherbase (mining payout) address to given address (default: auto)." << endl + << " -a,--address Set the coinbase (mining payout) address to given address (default: auto)." << endl << " -m,--mining Enable mining, optionally for a specified number of blocks (default: off)." << endl << " -f,--force-mining Mine even when there are no transactions to mine (default: off)." << endl << " --mine-on-wrong-chain Mine even when we know that it is the wrong chain (default: off)." << endl @@ -494,7 +494,7 @@ int main(int argc, char** argv) cerr << "-c is DEPRECATED. It will be removed for the Frontier. Use --client-name instead." << endl; clientName = argv[++i]; } - else if ((arg == "-a" || arg == "--address" || arg == "--etherbase-address" || arg == "--coinbase-address") && i + 1 < argc) + else if ((arg == "-a" || arg == "--address" || arg == "--coinbase-address") && i + 1 < argc) try { beneficiary = h160(fromHex(argv[++i], WhenError::Throw)); } From 299fc12a58195012707c5e91017f7e807fd96f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 13 Aug 2015 13:27:10 +0200 Subject: [PATCH 09/57] Resolve jumps after code compilation. --- evmjit/libevmjit/Compiler.cpp | 80 +++++++++++++++-------------------- evmjit/libevmjit/Compiler.h | 4 +- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/evmjit/libevmjit/Compiler.cpp b/evmjit/libevmjit/Compiler.cpp index c3f7194bbef..e473005096b 100644 --- a/evmjit/libevmjit/Compiler.cpp +++ b/evmjit/libevmjit/Compiler.cpp @@ -29,6 +29,8 @@ namespace eth namespace jit { +static const auto c_destIdxLabel = "destIdx"; + Compiler::Compiler(Options const& _options): m_options(_options), m_builder(llvm::getGlobalContext()) @@ -93,48 +95,41 @@ std::vector Compiler::createBasicBlocks(code_iterator _codeBegin, co return blocks; } -void Compiler::fillJumpTable() +void Compiler::resolveJumps() { - for (auto it = m_mainFunc->begin(); it != m_mainFunc->end(); ++it) + // Iterate through all EVM instructions blocks (skip first 4 - special blocks). + for (auto it = std::next(m_mainFunc->begin(), 4); it != m_mainFunc->end(); ++it) { + auto jumpTable = llvm::cast(m_jumpTableBB->getTerminator()); + auto jumpTableInput = llvm::cast(m_jumpTableBB->begin()); + auto nextBlock = it->getNextNode() != m_mainFunc->end() ? it->getNextNode() : m_stopBB; auto term = it->getTerminator(); + if (!term) { // Block may have no terminator if the next instruction is a jump destination. - auto next = it->getNextNode(); - if (next == m_mainFunc->end()) - next = m_stopBB; - llvm::IRBuilder<>{it}.CreateBr(next); + llvm::IRBuilder<>{it}.CreateBr(nextBlock); } else if (auto jump = llvm::dyn_cast(term)) { - if (jump->isConditional()) + // Resolve jump + if (jump->getSuccessor(0) == m_jumpTableBB) { - if (!jump->getSuccessor(1)) + auto destIdx = llvm::cast(jump->getMetadata(c_destIdxLabel)->getOperand(0))->getValue(); + if (auto constant = llvm::dyn_cast(destIdx)) { - auto next = it->getNextNode(); - if (next == m_mainFunc->end()) - next = m_stopBB; - jump->setSuccessor(1, next); + // If destination index is a constant do direct jump to the destination block. + auto bb = jumpTable->findCaseValue(constant).getCaseSuccessor(); + jump->setSuccessor(0, bb); } + else + jumpTableInput->addIncoming(destIdx, it); // Fill up PHI node + + if (jump->isConditional()) + jump->setSuccessor(1, nextBlock); // Set next block for conditional jumps } } } - - assert(m_jumpTableBB); - if (llvm::pred_empty(m_jumpTableBB)) - { - m_jumpTableBB->eraseFromParent(); // remove if unused - return; - } - - // TODO: Extend this function as `resolveJumps()` and fill gaps in branch instructions. - auto target = llvm::cast(m_jumpTableBB->begin()); - for (auto pred: llvm::predecessors(m_jumpTableBB)) - { - auto targetMd = llvm::cast(pred->getTerminator()->getMetadata("target")->getOperand(0)); - target->addIncoming(targetMd->getValue(), pred); - } } std::unique_ptr Compiler::compile(code_iterator _begin, code_iterator _end, std::string const& _id) @@ -187,7 +182,7 @@ std::unique_ptr Compiler::compile(code_iterator _begin, code_itera m_builder.CreateCondBr(normalFlow, firstBB, m_abortBB, Type::expectTrue); for (auto& block: blocks) - compileBasicBlock(block, runtimeManager, arith, memory, ext, gasMeter, stack, jumpTable); + compileBasicBlock(block, runtimeManager, arith, memory, ext, gasMeter, stack); // Code for special blocks: m_builder.SetInsertPoint(m_stopBB); @@ -196,15 +191,14 @@ std::unique_ptr Compiler::compile(code_iterator _begin, code_itera m_builder.SetInsertPoint(m_abortBB); runtimeManager.exit(ReturnCode::OutOfGas); - fillJumpTable(); + resolveJumps(); return module; } void Compiler::compileBasicBlock(BasicBlock& _basicBlock, RuntimeManager& _runtimeManager, - Arith256& _arith, Memory& _memory, Ext& _ext, GasMeter& _gasMeter, Stack& _globalStack, - llvm::SwitchInst& jumpTable) + Arith256& _arith, Memory& _memory, Ext& _ext, GasMeter& _gasMeter, Stack& _globalStack) { m_builder.SetInsertPoint(_basicBlock.llvm()); LocalStack stack{_globalStack}; @@ -574,24 +568,16 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, RuntimeManager& _runti case Instruction::JUMP: case Instruction::JUMPI: { - auto jumpBlock = m_jumpTableBB; - auto target = stack.pop(); + auto destIdx = llvm::MDNode::get(m_builder.getContext(), llvm::ValueAsMetadata::get(stack.pop())); + + // Create branch instruction, initially to jump table. + // Destination will be optimized with direct jump during jump resolving if destination index is a constant. auto jumpInst = (inst == Instruction::JUMP) ? - m_builder.CreateBr(jumpBlock) : - m_builder.CreateCondBr(m_builder.CreateICmpNE(stack.pop(), Constant::get(0), "jump.check"), jumpBlock, nullptr); + m_builder.CreateBr(m_jumpTableBB) : + m_builder.CreateCondBr(m_builder.CreateICmpNE(stack.pop(), Constant::get(0), "jump.check"), m_jumpTableBB, nullptr); - if (auto constant = llvm::dyn_cast(target)) - { - // If target index is a constant do direct jump to the target block. - auto bb = jumpTable.findCaseValue(constant).getCaseSuccessor(); - jumpInst->setSuccessor(0, bb); - } - else - { - // Attach medatada to branch instruction with information about target index. - auto targetMd = llvm::MDNode::get(jumpInst->getContext(), llvm::LocalAsMetadata::get(target)); - jumpInst->setMetadata("target", targetMd); - } + // Attach medatada to branch instruction with information about destination index. + jumpInst->setMetadata(c_destIdxLabel, destIdx); break; } diff --git a/evmjit/libevmjit/Compiler.h b/evmjit/libevmjit/Compiler.h index 740e14ac8ab..3835d2e8180 100644 --- a/evmjit/libevmjit/Compiler.h +++ b/evmjit/libevmjit/Compiler.h @@ -31,9 +31,9 @@ class Compiler std::vector createBasicBlocks(code_iterator _begin, code_iterator _end, llvm::SwitchInst& _switchInst); void compileBasicBlock(BasicBlock& _basicBlock, class RuntimeManager& _runtimeManager, class Arith256& _arith, class Memory& _memory, class Ext& _ext, class GasMeter& _gasMeter, - class Stack& _globalStack, llvm::SwitchInst& _jumpTable); + class Stack& _globalStack); - void fillJumpTable(); + void resolveJumps(); /// Compiler options Options const& m_options; From b3f8338d56c1fcde218140f413797d87e46ae456 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 13 Aug 2015 15:40:42 +0200 Subject: [PATCH 10/57] NewAccount ui --- alethzero/CMakeLists.txt | 15 ++- alethzero/NewAccount.cpp | 78 +++++++++++++ alethzero/NewAccount.h | 44 +++++++ alethzero/NewAccount.ui | 245 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 381 insertions(+), 1 deletion(-) create mode 100644 alethzero/NewAccount.cpp create mode 100644 alethzero/NewAccount.h create mode 100644 alethzero/NewAccount.ui diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 29bfed25986..73061b38a2f 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -42,6 +42,7 @@ qt5_wrap_ui(ui_AllAccounts.h AllAccounts.ui) qt5_wrap_ui(ui_LogPanel.h LogPanel.ui) qt5_wrap_ui(ui_BrainWallet.h BrainWallet.ui) qt5_wrap_ui(ui_OtherAccounts.h OtherAccounts.ui) +qt5_wrap_ui(ui_NewAccount.h NewAccount.ui) file(GLOB HEADERS "*.h") @@ -54,7 +55,19 @@ endif () # eth_add_executable is defined in cmake/EthExecutableHelper.cmake eth_add_executable(${EXECUTABLE} ICON alethzero - UI_RESOURCES alethzero.icns Main.ui Connect.ui Debugger.ui Transact.ui ExportState.ui GetPassword.ui GasPricing.ui AllAccounts.ui LogPanel.ui BrainWallet.ui OtherAccounts.ui + UI_RESOURCES alethzero.icns + Main.ui + Connect.ui + Debugger.ui + Transact.ui + ExportState.ui + GetPassword.ui + GasPricing.ui + AllAccounts.ui + LogPanel.ui + BrainWallet.ui + OtherAccounts.ui + NewAccount.ui WIN_RESOURCES alethzero.rc ) diff --git a/alethzero/NewAccount.cpp b/alethzero/NewAccount.cpp new file mode 100644 index 00000000000..dfa808e1935 --- /dev/null +++ b/alethzero/NewAccount.cpp @@ -0,0 +1,78 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file NewAccount.h + * @author Gav Wood + * @date 2015 + */ + +#include "NewAccount.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "ui_NewAccount.h" +using namespace std; +using namespace dev; +using namespace az; +using namespace eth; + +DEV_AZ_NOTE_PLUGIN(NewAccount); + +NewAccount::NewAccount(MainFace* _m): + Plugin(_m, "NewAccount") +{ + connect(addMenuItem("New Account...", "menuTools", true), SIGNAL(triggered()), SLOT(create())); +} + +NewAccount::~NewAccount() +{ +} + +void NewAccount::create() +{ + QDialog d; + Ui_NewAccount u; + u.setupUi(&d); + d.setWindowTitle("New Account Wallet"); + u.enterHexText->setEnabled(false); + u.enterPasswordText->setEnabled(false); + u.enterPasswordAgainText->setEnabled(false); + enum { NoVanity = 0, DirectICAP, FirstTwo, FirstTwoNextTwo, FirstThree, FirstFour, StringMatch }; + + QStringList items = {"No vanity (instant)", "Direct ICAP address", "Two pairs first (a few seconds)", "Two pairs first and second (a few minutes)", "Three pairs first (a few minutes)", "Four pairs first (several hours)", "Specific hex string"}; + u.selectTypeComboBox->addItems(items); + + void (QComboBox:: *indexChangedSignal)(int) = &QComboBox::currentIndexChanged; + connect(u.selectTypeComboBox, indexChangedSignal, [&](int index) { + u.enterHexText->setEnabled(index == StringMatch); + }); + + connect(u.additionalCheckBox, &QCheckBox::clicked, [&]() { + bool checked = u.additionalCheckBox->checkState() == Qt::CheckState::Checked; + u.enterPasswordText->setEnabled(checked); + u.enterPasswordAgainText->setEnabled(checked); + }); + + if (d.exec() == QDialog::Accepted) + { + //main()->noteKeysChanged(); + } +} diff --git a/alethzero/NewAccount.h b/alethzero/NewAccount.h new file mode 100644 index 00000000000..d1ba1b74769 --- /dev/null +++ b/alethzero/NewAccount.h @@ -0,0 +1,44 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file NewAccount.h + * @author Gav Wood + * @date 2015 + */ + +#pragma once + +#include "MainFace.h" + +namespace dev +{ +namespace az +{ + +class NewAccount: public QObject, public Plugin +{ + Q_OBJECT + +public: + NewAccount(MainFace* _m); + ~NewAccount(); + +private slots: + void create(); +}; + +} +} diff --git a/alethzero/NewAccount.ui b/alethzero/NewAccount.ui new file mode 100644 index 00000000000..48d463fd518 --- /dev/null +++ b/alethzero/NewAccount.ui @@ -0,0 +1,245 @@ + + + NewAccount + + + + 0 + 0 + 511 + 600 + + + + Dialog + + + + + + + 16777215 + 50 + + + + <html><head/><body><p><span style=" font-weight:600;">Select new account type:</span></p></body></html> + + + true + + + + + + + + 16777215 + 16777215 + + + + + + + + + 16777215 + 50 + + + + <html><head/><body><p>Enter some hex digits it should begin with.<br/>NOTE: The more you enter, the longer generation will take.</p></body></html> + + + + + + + + 16777215 + 20 + + + + + + + + + 16777215 + 50 + + + + <html><head/><body><p><span style=" font-weight:600;">Enter this account name:</span></p></body></html> + + + + + + + + 16777215 + 20 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'.Helvetica Neue DeskInterface'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + + + + + + 16777215 + 100 + + + + <html><head/><body><p><span style=" font-weight:600;">Would you like to add additional security for this key? This lets you protect it with a different password to other keys, but also means that you need to re-enter the key's password every time you wish to use the account.</span></p></body></html> + + + true + + + + + + + Yes + + + false + + + + + + + + 16777215 + 50 + + + + <html><head/><body><p><span style=" font-weight:600;">Enter password:</span></p></body></html> + + + + + + + true + + + + 16777215 + 20 + + + + + + + + + 16777215 + 50 + + + + <html><head/><body><p><span style=" font-weight:600;">Enter password again:</span></p></body></html> + + + + + + + true + + + + 16777215 + 20 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + &Create + + + true + + + + + + + + + + + create + clicked() + NewAccount + accept() + + + 462 + 484 + + + 449 + 504 + + + + + cancel + clicked() + NewAccount + reject() + + + 381 + 483 + + + 351 + 506 + + + + + From f36a002db2f3c63364315bea0ef9e73d3b23dfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 13 Aug 2015 18:18:56 +0200 Subject: [PATCH 11/57] Anable stack offloading for all OSs. Adjust offloading point. --- libethereum/ExtVM.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libethereum/ExtVM.cpp b/libethereum/ExtVM.cpp index 0606745b1b2..33b98df9838 100644 --- a/libethereum/ExtVM.cpp +++ b/libethereum/ExtVM.cpp @@ -35,13 +35,20 @@ static unsigned const c_depthLimit = 1024; /// Upper bound of stack space needed by single CALL/CREATE execution. Set experimentally. static size_t const c_singleExecutionStackSize = #ifdef NDEBUG - 12 * 1024; + 10 * 1024; #else - 33 * 1024; + 16 * 1024; #endif -/// Standard OSX thread stack limit. Should be reasonable for other platforms too. -static size_t const c_defaultStackSize = 512 * 1024; +/// Standard thread stack size. +static size_t const c_defaultStackSize = +#if defined(__linux) + 8 * 1024 * 1024; +#elif defined(_WIN32) + 16 * 1024 * 1024; +#else + 512 * 1024; // OSX and other OSs +#endif /// Stack overhead prior to allocation. static size_t const c_entryOverhead = 128 * 1024; @@ -80,7 +87,10 @@ void go(unsigned _depth, Executive& _e, OnOpFunc const& _onOp) // the rest of the calls up to the depth limit (c_depthLimit). if (_depth == c_offloadPoint) + { + cnote << "Stack offloading (depth: " << c_offloadPoint << ")"; goOnOffloadedStack(_e, _onOp); + } else _e.go(_onOp); } @@ -91,11 +101,7 @@ bool ExtVM::call(CallParameters& _p) Executive e(m_s, envInfo(), depth + 1); if (!e.call(_p, gasPrice, origin)) { -#if __clang__ // Enabled for clang only as the problem affects OSX go(depth, e, _p.onOp); -#else - e.go(_p.onOp); -#endif e.accrueSubState(sub); } _p.gas = e.gas(); From 9e40a05be124d8f09cba96af1cbb39a5460f0d37 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 13 Aug 2015 18:33:21 +0200 Subject: [PATCH 12/57] First dubby impl. --- alethzero/Transact.cpp | 160 +++++++++++++-------- alethzero/Transact.h | 11 +- alethzero/Transact.ui | 305 +++++++++++++++++++++++------------------ 3 files changed, 284 insertions(+), 192 deletions(-) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index 4ccba39b99b..f4b331d22a6 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -64,6 +64,8 @@ Transact::Transact(MainFace* _c, QWidget* _parent): setValueUnits(ui->valueUnits, ui->value, 0); on_destination_currentTextChanged(QString()); + + startTimer(100); } Transact::~Transact() @@ -334,6 +336,96 @@ pair Transact::toAccount() return p; } +void Transact::timerEvent(QTimerEvent*) +{ + Address from = fromAccount(); + Address to = toAccount().first; + + if (m_upperBound != m_lowerBound) + { + qint64 mid = (m_lowerBound + m_upperBound) / 2; + ExecutionResult er; + if (isCreation()) + er = ethereum()->create(from, value(), m_data, mid, gasPrice(), PendingBlock, FudgeFactor::Lenient); + else + er = ethereum()->call(from, value(), to, m_data, mid, gasPrice(), PendingBlock, FudgeFactor::Lenient); + if (er.excepted == TransactionException::OutOfGas || er.excepted == TransactionException::OutOfGasBase || er.excepted == TransactionException::OutOfGasIntrinsic || er.codeDeposit == CodeDeposit::Failed) + m_lowerBound = mid; + else + { + m_lastGood = er; + m_upperBound = mid; + } + + updateBounds(); + if (m_lowerBound == m_upperBound) + finaliseBounds(); + } +} + +void Transact::updateBounds() +{ + ui->minGas->setValue(m_lowerBound); + ui->maxGas->setValue(m_upperBound); + double oran = m_startUpperBound - m_startLowerBound; + double nran = m_upperBound - m_lowerBound; + int x = int(log2(oran / nran) * 100.0 / log2(oran * 2)); + ui->progressGas->setValue(x); +} + +void Transact::finaliseBounds() +{ + qint64 baseGas = (qint64)Transaction::gasRequired(m_data, 0); + GasRequirements gasReq = GasRequirements{m_upperBound, baseGas, m_upperBound - baseGas, (qint64)m_lastGood.gasRefunded, m_lastGood}; + + QString htmlInfo = QString("
INFO Gas required: %1 total = %2 base, %3 exec [%4 refunded later]
").arg(gasReq.neededGas).arg(gasReq.baseGas).arg(gasReq.executionGas).arg(gasReq.refundedGas); + + auto bail = [&](QString he) { + m_allGood = false; +// ui->send->setEnabled(false); + ui->code->setHtml(he + htmlInfo + ui->code->toHtml()); + }; + + auto s = fromAccount(); + auto b = ethereum()->balanceAt(s, PendingBlock); + + if (b < value() + gasReq.baseGas * gasPrice()) + { + // Not enough - bail. + bail("
ERROR Account doesn't contain enough for paying even the basic amount of gas required.
"); + return; + } + if (gasReq.neededGas > m_ethereum->gasLimitRemaining()) + { + // Not enough - bail. + bail("
ERROR Gas remaining in block isn't enough to allow the gas required.
"); + return; + } + if (gasReq.er.excepted != TransactionException::None) + { + bail("
ERROR " + QString::fromStdString(toString(gasReq.er.excepted)) + "
"); + return; + } + if (gasReq.er.codeDeposit == CodeDeposit::Failed) + { + bail("
ERROR Code deposit failed due to insufficient gas; " + QString::fromStdString(toString(gasReq.er.gasForDeposit)) + " GAS < " + QString::fromStdString(toString(gasReq.er.depositSize)) + " bytes * " + QString::fromStdString(toString(c_createDataGas)) + "GAS/byte
"); + return; + } + + // Update gas + if (ui->gas->value() == ui->gas->minimum()) + { + ui->gas->setMinimum(gasReq.neededGas); + ui->gas->setValue(gasReq.neededGas); + } + else + ui->gas->setMinimum(gasReq.neededGas); + + updateFee(); + ui->code->setHtml(htmlInfo + ui->code->toHtml()); + killTimer(m_gasCalcTimer); +} + GasRequirements Transact::determineGasRequirements() { // Determine the minimum amount of gas we need to play... @@ -343,12 +435,11 @@ GasRequirements Transact::determineGasRequirements() Address to = toAccount().first; ExecutionResult lastGood; - bool haveUpperBound = false; - qint64 lowerBound = baseGas; - qint64 upperBound = (qint64)ethereum()->gasLimitRemaining(); - for (unsigned i = 0; i < 30 && ((haveUpperBound && upperBound - lowerBound > 16) || !haveUpperBound); ++i) // get to with 100. + m_startLowerBound = baseGas; + m_startUpperBound = (qint64)ethereum()->gasLimitRemaining(); + for (unsigned i = 0; i < 30; ++i) { - qint64 mid = haveUpperBound ? (lowerBound + upperBound) / 2 : upperBound; + qint64 mid = m_startUpperBound; ExecutionResult er; if (isCreation()) er = ethereum()->create(from, value(), m_data, mid, gasPrice(), PendingBlock, FudgeFactor::Lenient); @@ -356,23 +447,19 @@ GasRequirements Transact::determineGasRequirements() er = ethereum()->call(from, value(), to, m_data, mid, gasPrice(), PendingBlock, FudgeFactor::Lenient); if (er.excepted == TransactionException::OutOfGas || er.excepted == TransactionException::OutOfGasBase || er.excepted == TransactionException::OutOfGasIntrinsic || er.codeDeposit == CodeDeposit::Failed) { - lowerBound = mid; - if (!haveUpperBound) - upperBound *= 2; + m_startLowerBound = mid; + m_startUpperBound *= 2; } else { - lastGood = er; - if (haveUpperBound) - upperBound = mid; - else - haveUpperBound = true; + m_lastGood = lastGood; + m_lowerBound = m_startLowerBound; + m_upperBound = m_startUpperBound; + startTimer(0); + return GasRequirements{m_upperBound, baseGas, m_upperBound - baseGas, (qint64)lastGood.gasRefunded, lastGood}; } } - - // Dry-run execution to determine gas requirement and any execution errors -// (qint64)(er.gasUsed + er.gasRefunded + c_callStipend); - return GasRequirements{upperBound, baseGas, upperBound - baseGas, (qint64)lastGood.gasRefunded, lastGood}; + return GasRequirements(); } void Transact::rejigData() @@ -386,8 +473,6 @@ void Transact::rejigData() if (!s) return; - auto b = ethereum()->balanceAt(s, PendingBlock); - m_allGood = true; QString htmlInfo; @@ -422,46 +507,11 @@ void Transact::rejigData() htmlInfo += "

Hex

" + QString(ETH_HTML_DIV(ETH_HTML_MONO)) + QString::fromStdString(toHex(m_data)) + ""; - auto gasReq = determineGasRequirements(); - htmlInfo = QString("
INFO Gas required: %1 total = %2 base, %3 exec [%4 refunded later]
").arg(gasReq.neededGas).arg(gasReq.baseGas).arg(gasReq.executionGas).arg(gasReq.refundedGas) + htmlInfo; - - if (b < value() + gasReq.baseGas * gasPrice()) - { - // Not enough - bail. - bail("
ERROR Account doesn't contain enough for paying even the basic amount of gas required.
"); - return; - } - if (gasReq.neededGas > m_ethereum->gasLimitRemaining()) - { - // Not enough - bail. - bail("
ERROR Gas remaining in block isn't enough to allow the gas required.
"); - return; - } - if (gasReq.er.excepted != TransactionException::None) - { - bail("
ERROR " + QString::fromStdString(toString(gasReq.er.excepted)) + "
"); - return; - } - if (gasReq.er.codeDeposit == CodeDeposit::Failed) - { - bail("
ERROR Code deposit failed due to insufficient gas; " + QString::fromStdString(toString(gasReq.er.gasForDeposit)) + " GAS < " + QString::fromStdString(toString(gasReq.er.depositSize)) + " bytes * " + QString::fromStdString(toString(c_createDataGas)) + "GAS/byte
"); - return; - } - // Add Natspec information if (!isCreation()) htmlInfo = "
INFO " + QString::fromStdString(natspecNotice(toAccount().first, m_data)).toHtmlEscaped() + "
" + htmlInfo; - // Update gas - if (ui->gas->value() == ui->gas->minimum()) - { - ui->gas->setMinimum(gasReq.neededGas); - ui->gas->setValue(gasReq.neededGas); - } - else - ui->gas->setMinimum(gasReq.neededGas); - - updateFee(); + determineGasRequirements(); ui->code->setHtml(htmlInfo); // ui->send->setEnabled(m_allGood); diff --git a/alethzero/Transact.h b/alethzero/Transact.h index 015e9d3ccc3..4056144c2f9 100644 --- a/alethzero/Transact.h +++ b/alethzero/Transact.h @@ -79,6 +79,8 @@ private slots: dev::eth::Client* ethereum() const { return m_ethereum; } void rejigData(); void updateNonce(); + void updateBounds(); + void finaliseBounds(); dev::Address fromAccount(); std::pair toAccount(); @@ -95,6 +97,8 @@ private slots: std::string natspecNotice(dev::Address _to, dev::bytes const& _data); dev::Secret findSecret(dev::u256 _totalReq) const; + void timerEvent(QTimerEvent*) override; + Ui::Transact* ui = nullptr; unsigned m_backupGas = 0; @@ -106,7 +110,12 @@ private slots: NatSpecFace* m_natSpecDB = nullptr; bool m_allGood = false; - bool m_determiningGas = false; + qint64 m_startLowerBound = 0; + qint64 m_startUpperBound = 0; + qint64 m_lowerBound = 0; + qint64 m_upperBound = 0; + eth::ExecutionResult m_lastGood; + int m_gasCalcTimer = 0; }; } diff --git a/alethzero/Transact.ui b/alethzero/Transact.ui index bd19808fd02..3c78e3db753 100644 --- a/alethzero/Transact.ui +++ b/alethzero/Transact.ui @@ -14,6 +14,13 @@ Transact + + + + &Debug + + + @@ -30,71 +37,149 @@ - - + + + + + + + + + + false + + + true + + + + + + + + - &Cancel + &Optimise - - Esc + + true - - + + - &Debug + &Execute + + + false - - - - - 0 - 0 - + + + + false + + + + + + + Qt::Vertical + + + QFrame::NoFrame + + + 0 + + + + + Qt::ClickFocus + + + QFrame::NoFrame + + + 0 + + + true + + + + + + + + + + + 430000000 + + + 0 + + + + + - &To + Copy &Unsigned + + + + + + + + + + &Gas - destination + gas - - - - - + + - + 0 0 - + &To + + + destination - - + + - &Amount + &Cancel - - value + + Esc - - + + - &Execute + Auto Nonce - + + true + + false @@ -111,20 +196,30 @@ - - - - @ + + + + + 0 + 0 + - - 0 + + - - 430000000 + + + + + + &Amount + + + value - + @@ -143,74 +238,6 @@ - - - - - - - - - - 430000000 - - - 0 - - - - - - - false - - - true - - - - - - - - - - Qt::Vertical - - - - QFrame::NoFrame - - - 0 - - - - - Qt::ClickFocus - - - QFrame::NoFrame - - - 0 - - - true - - - - - - - - &Gas - - - gas - - - @@ -221,43 +248,49 @@ - - - - - - - &Optimise + + + + @ - - true + + 0 + + + 430000000 - - - - false + + + + true + + + gas + + + min - - - - Auto Nonce + + + + 24 - - true - - - false + + Calculating gas... - - - - Copy &Unsigned + + + + gas + + + max From 4c81c34d6869719aa1963c73a71ea3432aa0290a Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 13 Aug 2015 17:43:47 +0200 Subject: [PATCH 13/57] fixed another case of misplaced invariant check --- libethereum/BlockChainSync.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index 1f0e2a535c7..d51c250489b 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -799,7 +799,6 @@ void PV60Sync::onPeerNewHashes(std::shared_ptr _peer, h256s const& void PV60Sync::abortSync() { - DEV_INVARIANT_CHECK; // Can't check invariants here since the peers is already removed from the list and the state is not updated yet. bool continueSync = false; if (m_state == SyncState::Blocks) From 6d29d724e42581ae71d5565383fb20d329e1ddab Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 13 Aug 2015 18:50:43 +0200 Subject: [PATCH 14/57] immediate invariants check --- libdevcore/Common.cpp | 8 ++++---- libdevcore/Common.h | 11 ++++++----- libethereum/BlockChainSync.cpp | 16 +++++++++------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/libdevcore/Common.cpp b/libdevcore/Common.cpp index 6fd97a781d2..e38d0136dfe 100644 --- a/libdevcore/Common.cpp +++ b/libdevcore/Common.cpp @@ -33,12 +33,12 @@ char const* Version = ETH_PROJECT_VERSION; const u256 UndefinedU256 = ~(u256)0; -void InvariantChecker::checkInvariants() const +void InvariantChecker::checkInvariants(HasInvariants const* _this, char const* _fn, char const* _file, int _line, bool _pre) { - if (!m_this->invariants()) + if (!_this->invariants()) { - cwarn << "Invariant failed in" << m_function << "at" << m_file << ":" << m_line; - ::boost::exception_detail::throw_exception_(FailedInvariant(), m_function, m_file, m_line); + cwarn << (_pre ? "Pre" : "Post") << "invariant failed in" << _fn << "at" << _file << ":" << _line; + ::boost::exception_detail::throw_exception_(FailedInvariant(), _fn, _file, _line); } } diff --git a/libdevcore/Common.h b/libdevcore/Common.h index ce637a2a6ac..158cea2553f 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -216,13 +216,12 @@ class HasInvariants class InvariantChecker { public: - InvariantChecker(HasInvariants* _this, char const* _fn, char const* _file, int _line): m_this(_this), m_function(_fn), m_file(_file), m_line(_line) { checkInvariants(); } - ~InvariantChecker() { checkInvariants(); } - -private: + InvariantChecker(HasInvariants* _this, char const* _fn, char const* _file, int _line): m_this(_this), m_function(_fn), m_file(_file), m_line(_line) { checkInvariants(_this, _fn , _file, _line, true); } + ~InvariantChecker() { checkInvariants(m_this, m_function, m_file, m_line, false); } /// Check invariants are met, throw if not. - void checkInvariants() const; + static void checkInvariants(HasInvariants const* _this, char const* _fn, char const* _file, int line, bool _pre); +private: HasInvariants const* m_this; char const* m_function; char const* m_file; @@ -232,8 +231,10 @@ class InvariantChecker /// Scope guard for invariant check in a class derived from HasInvariants. #if ETH_DEBUG #define DEV_INVARIANT_CHECK ::dev::InvariantChecker __dev_invariantCheck(this, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__) +#define DEV_INVARIANT_CHECK_HERE ::dev::InvariantChecker::checkInvariants(this, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, true) #else #define DEV_INVARIANT_CHECK (void)0; +#define DEV_INVARIANT_CHECK_HERE (void)0; #endif /// Simple scope-based timer helper. diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index d51c250489b..7692cb91c3b 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -260,13 +260,13 @@ void BlockChainSync::onPeerBlocks(std::shared_ptr _peer, RLP const else requestBlocks(_peer); // Some of the blocks might have been downloaded by helping peers, proceed anyway } - DEV_INVARIANT_CHECK; + DEV_INVARIANT_CHECK_HERE; } void BlockChainSync::onPeerNewBlock(std::shared_ptr _peer, RLP const& _r) { - DEV_INVARIANT_CHECK; RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; auto h = BlockInfo::headerHashFromBlock(_r[0].data()); if (_r.itemCount() != 2) @@ -441,7 +441,7 @@ void PV60Sync::transition(std::shared_ptr _peer, SyncState _s, boo // Looks like it's the best yet for total difficulty. Set to download. setState(_peer, SyncState::Blocks, isSyncing(_peer), _needHelp); // will kick off other peers to help if available. requestBlocks(_peer); - DEV_INVARIANT_CHECK; + DEV_INVARIANT_CHECK_HERE; return; } } @@ -453,7 +453,7 @@ void PV60Sync::transition(std::shared_ptr _peer, SyncState _s, boo { setState(_peer, SyncState::NewBlocks, true, _needHelp); requestBlocks(_peer); - DEV_INVARIANT_CHECK; + DEV_INVARIANT_CHECK_HERE; return; } } @@ -487,7 +487,7 @@ void PV60Sync::transition(std::shared_ptr _peer, SyncState _s, boo setState(_peer, SyncState::Idle, false); } // Otherwise it's fine. We don't care if it's Nothing->Nothing. - DEV_INVARIANT_CHECK; + DEV_INVARIANT_CHECK_HERE; return; } @@ -827,6 +827,7 @@ void PV60Sync::abortSync() // Just set to idle. Hashchain is keept, Sync will be continued if there are more peers to sync with setState(std::shared_ptr(), SyncState::Idle, false, true); } + DEV_INVARIANT_CHECK_HERE; } void PV60Sync::onPeerAborting() @@ -839,6 +840,7 @@ void PV60Sync::onPeerAborting() m_syncer.reset(); abortSync(); } + DEV_INVARIANT_CHECK_HERE; } bool PV60Sync::invariants() const @@ -1131,7 +1133,7 @@ void PV61Sync::onPeerHashes(std::shared_ptr _peer, h256s const& _h } requestSubchain(_peer); } - DEV_INVARIANT_CHECK; + DEV_INVARIANT_CHECK_HERE; } void PV61Sync::onPeerAborting() @@ -1173,7 +1175,7 @@ void PV61Sync::onPeerAborting() } else if (isPV61Syncing() && m_state == SyncState::Hashes) requestSubchains(); - DEV_INVARIANT_CHECK; + DEV_INVARIANT_CHECK_HERE; } SyncStatus PV61Sync::status() const From 0d05a40cc89fbf9056af6fd2adc6685a6f376dc8 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Thu, 13 Aug 2015 14:46:45 -0300 Subject: [PATCH 15/57] edit button changes, color of selected blocks --- mix/qml/Block.qml | 26 +++++++++++++++++--------- mix/qml/Watchers.qml | 21 ++++++++++++--------- mix/qml/img/rightarrowcircle.png | Bin 0 -> 1647 bytes mix/res.qrc | 1 + 4 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 mix/qml/img/rightarrowcircle.png diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index e64c9a52503..a533b7fd293 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -23,6 +23,11 @@ ColumnLayout property int blockIndex property variant scenario property string labelColor: "#414141" + + + property string selectedBlockColor: "#accbf2" + property string selectedBlockForeground: "#445e7f" + property int scenarioIndex signal txSelected(var txIndex) @@ -105,14 +110,15 @@ ColumnLayout } } - Label - { - text: qsTr("EDIT") - color: "#1397da" + Image { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 14 visible: number === -2 + source: "qrc:/qml/img/edit_combox.png" + height: 15 + fillMode: Image.PreserveAspectFit + MouseArea { anchors.fill: parent @@ -122,6 +128,7 @@ ColumnLayout projectModel.stateListModel.editState(scenarioIndex) } } + } } } @@ -237,11 +244,12 @@ ColumnLayout function select() { - rowContentTr.selected = true - rowContentTr.color = "#4F4F4F" - hash.color = "#EAB920" - func.color = "#EAB920" + rowContentTr.selected = true + rowContentTr.color = selectedBlockColor + hash.color = selectedBlockForeground + func.color = selectedBlockForeground txSelected(index) + } function deselect() @@ -345,7 +353,7 @@ ColumnLayout Image { id: debugImg - source: "qrc:/qml/img/rightarrow@2x.png" + source: "qrc:/qml/img/rightarrowcircle.png" width: debugActionWidth fillMode: Image.PreserveAspectFit anchors.horizontalCenter: parent.horizontalCenter diff --git a/mix/qml/Watchers.qml b/mix/qml/Watchers.qml index c7c6e833591..fc3c25bbae0 100644 --- a/mix/qml/Watchers.qml +++ b/mix/qml/Watchers.qml @@ -12,13 +12,16 @@ import "js/QEtherHelper.js" as QEtherHelper import "." Rectangle { - color: "#4F4F4F" + color: selectedBlockColor property variant tx property variant currentState property variant bc property var blockIndex property var txIndex + property string selectedBlockColor: "#accbf2" + property string selectedBlockForeground: "#445e7f" + function clear() { from.text = "" @@ -83,11 +86,11 @@ Rectangle { id: fromLabel text: qsTr("from") visible: false - color: "#EAB920" + color: selectedBlockForeground } Label { id: from - color: "#EAB920" + color: selectedBlockForeground elide: Text.ElideRight maximumLineCount: 1 clip: true @@ -97,11 +100,11 @@ Rectangle { id: toLabel text: qsTr("to") visible: false - color: "#EAB920" + color: selectedBlockForeground } Label { id: to - color: "#EAB920" + color: selectedBlockForeground elide: Text.ElideRight maximumLineCount: 1 clip: true @@ -109,7 +112,7 @@ Rectangle { } Label { id: value - color: "#EAB920" + color: selectedBlockForeground font.italic: true clip: true } @@ -118,9 +121,9 @@ Rectangle { Image { anchors.right: rowHeader.parent.right anchors.top: rowHeader.parent.top - anchors.topMargin: -3 - source: "qrc:/qml/img/edittransaction2.png" - height: 30 + anchors.topMargin: 5 + source: "qrc:/qml/img/edit_combox.png" + height: 15 fillMode: Image.PreserveAspectFit visible: from.text !== "" MouseArea diff --git a/mix/qml/img/rightarrowcircle.png b/mix/qml/img/rightarrowcircle.png new file mode 100644 index 0000000000000000000000000000000000000000..0e2259dfd9d2b75dd23eeac6a2385d5fb8d3f34e GIT binary patch literal 1647 zcmeAS@N?(olHy`uVBq!ia0vp^4nSDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg49pstArU1JzCKpT`MG+DAT@dwxdlMo3=B5*6$OdO*{LN8 zNvY|XdA3ULckfqH$V{%1*XSQL?vFu&J;D8jzb> zlBiITo0C^;Rbi_HHrEQs1_|pcDS(xfWZNo192Makpx~Tel&WB=XQrEMU}mmhZmDNz zYHn^~uA^XNU}&muV61O!plf7oWny4uVx#~CNh+i#(Mch>H3D2mX`VkM*2oZxQ#zd*s+860W~8or6i znRy^VO|ULsUn|eN;*!L?eX5&W47rrWR(-#xAB7 zmZlaa#%4ecOs`9Ra%paAUI|QZ3PP_FPQ9Q6ky`+?*(J3ovn(~mttdZN0qk+BOx$j< zz-b;-ZwhX=SmM;H4|I$^D0-2i8zuxyLm(zR@d7#UsP7{&QP3_e}n?DfdQg`hEGiH)oa$uX}CP zzEjnufkS{%$$_PVK~RAS!clm)?|@{1+?R&3f+_X4SwuIm*fqXCV5`9t@`yQMhG%=G z*D>o4c6ow@+!@T~4(9vUH}XHw{=sYJASA<{Ie}5Ua&DIWL7s?QH%6_QvlmS5+|S6m zLAD@vlF+6HEULbZLB^afSj!Ix_PtC`&`#F0ms z&wX>$UDd*rynVC&YnCq`XYhYqv06RxnEN5Kyd3!Z?<>VUpITt)(9~CZ%Z;&W z=I_;w*@wL@Z1lgS;gFwWCbcKdyTXrCd-t5pahIo;_B&2i`u^mePuZrE$=S`fDstXP!Kd)D@Kc#38nBKW2dHoHIgp-@OduIJHnOx79_xlaM(Y(Da zrA%Emaa{u8>hqI7ZLgW+Z?J8<{%V#f7Ce{koNxF1r#ZP^a>5?5*=h2s(yS|dPczx4 zGf&&9DQ3B@AzWup2=lq~pFTGwZ}3U`6}UL7A~me2$Zqzu_6J&%<@p1JPZ*}ntc{2l znE9lBZJgs1?h5XA@5>!k)=i3#PcNRVx=~$Ceg6*D49>@YR9`I0usiZ&t!`J?&m|hi z3MUs%KYF!b2ivY6d$;NAdl&hzw4wOixlI)_S08%1BQGGX=gr~O8@boWZn3nE?_FDD t`tzb?!un%t@=((iFp)JJzWI;SfWhL7Y)MG4?io-O;OXk;vd$@?2>@klV#ELd literal 0 HcmV?d00001 diff --git a/mix/res.qrc b/mix/res.qrc index c868ff34b68..6b6641d1c85 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -86,6 +86,7 @@ qml/img/restoreicon@2x.png qml/img/rightarrow.png qml/img/rightarrow@2x.png + qml/img/rightarrowcircle.png qml/img/saveicon.png qml/img/saveicon@2x.png qml/img/sendtransactionicon.png From cb2a5ec268f5d009f9ad51c931bb1fcfe39495ac Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 13 Aug 2015 23:31:25 +0200 Subject: [PATCH 16/57] new account plugin finished --- alethzero/Main.ui | 3 +- alethzero/MainWin.cpp | 77 ------------------------ alethzero/MainWin.h | 1 - alethzero/NewAccount.cpp | 125 +++++++++++++++++++++++++++++++++------ alethzero/NewAccount.h | 14 ++++- alethzero/NewAccount.ui | 99 ++++++++++++++++++------------- 6 files changed, 179 insertions(+), 140 deletions(-) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index b059b4e07e5..69846f34cb2 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -132,7 +132,7 @@ 0 0 1617 - 24 + 22 @@ -162,7 +162,6 @@ - diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index a789494132d..60455969ac5 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -2104,83 +2104,6 @@ void Main::keysChanged() onBalancesChange(); } -bool beginsWith(Address _a, bytes const& _b) -{ - for (unsigned i = 0; i < min(20, _b.size()); ++i) - if (_a[i] != _b[i]) - return false; - return true; -} - -void Main::on_newAccount_triggered() -{ - bool ok = true; - enum { NoVanity = 0, DirectICAP, FirstTwo, FirstTwoNextTwo, FirstThree, FirstFour, StringMatch }; - QStringList items = {"No vanity (instant)", "Direct ICAP address", "Two pairs first (a few seconds)", "Two pairs first and second (a few minutes)", "Three pairs first (a few minutes)", "Four pairs first (several hours)", "Specific hex string"}; - unsigned v = items.QList::indexOf(QInputDialog::getItem(this, "Vanity Key?", "Would you a vanity key? This could take several hours.", items, 1, false, &ok)); - if (!ok) - return; - - bytes bs; - if (v == StringMatch) - { - QString s = QInputDialog::getText(this, "Vanity Beginning?", "Enter some hex digits that it should begin with.\nNOTE: The more you enter, the longer generation will take.", QLineEdit::Normal, QString(), &ok); - if (!ok) - return; - bs = fromHex(s.toStdString()); - } - - KeyPair p; - bool keepGoing = true; - unsigned done = 0; - function f = [&]() { - KeyPair lp; - while (keepGoing) - { - done++; - if (done % 1000 == 0) - cnote << "Tried" << done << "keys"; - lp = KeyPair::create(); - auto a = lp.address(); - if (v == NoVanity || - (v == DirectICAP && !a[0]) || - (v == FirstTwo && a[0] == a[1]) || - (v == FirstTwoNextTwo && a[0] == a[1] && a[2] == a[3]) || - (v == FirstThree && a[0] == a[1] && a[1] == a[2]) || - (v == FirstFour && a[0] == a[1] && a[1] == a[2] && a[2] == a[3]) || - (v == StringMatch && beginsWith(lp.address(), bs)) - ) - break; - } - if (keepGoing) - p = lp; - keepGoing = false; - }; - vector ts; - for (unsigned t = 0; t < std::thread::hardware_concurrency() - 1; ++t) - ts.push_back(new std::thread(f)); - f(); - for (std::thread* t: ts) - { - t->join(); - delete t; - } - - QString s = QInputDialog::getText(this, "Create Account", "Enter this account's name"); - if (QMessageBox::question(this, "Create Account", "Would you like to use additional security for this key? This lets you protect it with a different password to other keys, but also means you must re-enter the key's password every time you wish to use the account.", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - { - bool ok = false; - std::string hint; - std::string password = getPassword("Create Account", "Enter the password you would like to use for this key. Don't forget it!", &hint, &ok); - if (!ok) - return; - m_keyManager.import(p.secret(), s.toStdString(), password, hint); - } - else - m_keyManager.import(p.secret(), s.toStdString()); - keysChanged(); -} - void Main::on_killAccount_triggered() { if (ui->ourAccounts->currentRow() >= 0) diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index b23a33697cf..c110f54e872 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -152,7 +152,6 @@ private slots: void on_preview_triggered(); // Account management - void on_newAccount_triggered(); void on_killAccount_triggered(); void on_importKey_triggered(); void on_reencryptKey_triggered(); diff --git a/alethzero/NewAccount.cpp b/alethzero/NewAccount.cpp index dfa808e1935..51b320c3632 100644 --- a/alethzero/NewAccount.cpp +++ b/alethzero/NewAccount.cpp @@ -15,17 +15,14 @@ along with cpp-ethereum. If not, see . */ /** @file NewAccount.h - * @author Gav Wood + * @author Marek Kotewicz * @date 2015 */ #include "NewAccount.h" #include #include -#include -#include #include -#include #include #include #include "ui_NewAccount.h" @@ -34,6 +31,14 @@ using namespace dev; using namespace az; using namespace eth; +bool beginsWith(Address _a, bytes const& _b) +{ + for (unsigned i = 0; i < min(20, _b.size()); ++i) + if (_a[i] != _b[i]) + return false; + return true; +} + DEV_AZ_NOTE_PLUGIN(NewAccount); NewAccount::NewAccount(MainFace* _m): @@ -49,30 +54,116 @@ NewAccount::~NewAccount() void NewAccount::create() { QDialog d; - Ui_NewAccount u; + Ui::NewAccount u; u.setupUi(&d); d.setWindowTitle("New Account Wallet"); - u.enterHexText->setEnabled(false); - u.enterPasswordText->setEnabled(false); - u.enterPasswordAgainText->setEnabled(false); - enum { NoVanity = 0, DirectICAP, FirstTwo, FirstTwoNextTwo, FirstThree, FirstFour, StringMatch }; + u.hexText->setEnabled(false); + u.passwordText->setEnabled(false); + u.passwordAgainText->setEnabled(false); - QStringList items = {"No vanity (instant)", "Direct ICAP address", "Two pairs first (a few seconds)", "Two pairs first and second (a few minutes)", "Three pairs first (a few minutes)", "Four pairs first (several hours)", "Specific hex string"}; - u.selectTypeComboBox->addItems(items); + QStringList items = + { + "No vanity (instant)", + "Direct ICAP address", + "Two pairs first (a few seconds)", + "Two pairs first and second (a few minutes)", + "Three pairs first (a few minutes)", + "Four pairs first (several hours)", + "Specific hex string" + }; + u.typeComboBox->addItems(items); void (QComboBox:: *indexChangedSignal)(int) = &QComboBox::currentIndexChanged; - connect(u.selectTypeComboBox, indexChangedSignal, [&](int index) { - u.enterHexText->setEnabled(index == StringMatch); + connect(u.typeComboBox, indexChangedSignal, [&](int index) + { + u.hexText->setEnabled(index == StringMatch); }); - connect(u.additionalCheckBox, &QCheckBox::clicked, [&]() { + connect(u.additionalCheckBox, &QCheckBox::clicked, [&]() + { bool checked = u.additionalCheckBox->checkState() == Qt::CheckState::Checked; - u.enterPasswordText->setEnabled(checked); - u.enterPasswordAgainText->setEnabled(checked); + u.passwordText->setEnabled(checked); + u.passwordAgainText->setEnabled(checked); + }); + + connect(u.create, &QPushButton::clicked, [&]() + { + if (u.additionalCheckBox->checkState() == Qt::CheckState::Checked && !validatePassword(u)) + { + u.passwordAgainLabel->setStyleSheet("QLabel { color : red }"); + u.passwordAgainLabel->setText("Invalid! Please re-enter password correctly:"); + return; + } + + d.accept(); }); if (d.exec() == QDialog::Accepted) + onDialogAccepted(u); + +} + +bool NewAccount::validatePassword(Ui::NewAccount const& _u) +{ + return QString::compare(_u.passwordText->toPlainText(), _u.passwordAgainText->toPlainText()) == 0; +} + +void NewAccount::onDialogAccepted(Ui::NewAccount const& _u) +{ + Type v = (Type)_u.typeComboBox->currentIndex(); + bytes bs = fromHex(_u.hexText->toPlainText().toStdString()); + KeyPair p = newKeyPair(v, bs); + QString s = _u.nameText->toPlainText(); + if (_u.additionalCheckBox->checkState() == Qt::CheckState::Checked) + { + std::string hint = _u.hintText->toPlainText().toStdString(); + std::string password = _u.passwordText->toPlainText().toStdString(); + main()->keyManager().import(p.secret(), s.toStdString(), password, hint); + } + else + main()->keyManager().import(p.secret(), s.toStdString()); + + main()->noteKeysChanged(); +} + +KeyPair NewAccount::newKeyPair(Type _type, bytes const& _prefix) +{ + KeyPair p; + bool keepGoing = true; + unsigned done = 0; + function f = [&]() { + KeyPair lp; + while (keepGoing) + { + done++; + if (done % 1000 == 0) + cnote << "Tried" << done << "keys"; + lp = KeyPair::create(); + auto a = lp.address(); + if (_type == NoVanity || + (_type == DirectICAP && !a[0]) || + (_type == FirstTwo && a[0] == a[1]) || + (_type == FirstTwoNextTwo && a[0] == a[1] && a[2] == a[3]) || + (_type == FirstThree && a[0] == a[1] && a[1] == a[2]) || + (_type == FirstFour && a[0] == a[1] && a[1] == a[2] && a[2] == a[3]) || + (_type == StringMatch && beginsWith(lp.address(), _prefix)) + ) + break; + } + if (keepGoing) + p = lp; + keepGoing = false; + }; + + vector ts; + for (unsigned t = 0; t < std::thread::hardware_concurrency() - 1; ++t) + ts.push_back(new std::thread(f)); + f(); + + for (std::thread* t: ts) { - //main()->noteKeysChanged(); + t->join(); + delete t; } + return p; } diff --git a/alethzero/NewAccount.h b/alethzero/NewAccount.h index d1ba1b74769..b0031e7f141 100644 --- a/alethzero/NewAccount.h +++ b/alethzero/NewAccount.h @@ -15,7 +15,7 @@ along with cpp-ethereum. If not, see . */ /** @file NewAccount.h - * @author Gav Wood + * @author Marek Kotewicz * @date 2015 */ @@ -23,6 +23,12 @@ #include "MainFace.h" + +namespace Ui +{ +class NewAccount; +} + namespace dev { namespace az @@ -38,6 +44,12 @@ class NewAccount: public QObject, public Plugin private slots: void create(); + +private: + enum Type { NoVanity = 0, DirectICAP, FirstTwo, FirstTwoNextTwo, FirstThree, FirstFour, StringMatch }; + bool validatePassword(Ui::NewAccount const& _u); + void onDialogAccepted(Ui::NewAccount const& _u); + KeyPair newKeyPair(Type _type, bytes const& _prefix); }; } diff --git a/alethzero/NewAccount.ui b/alethzero/NewAccount.ui index 48d463fd518..d793849d8ac 100644 --- a/alethzero/NewAccount.ui +++ b/alethzero/NewAccount.ui @@ -13,9 +13,12 @@ Dialog + + + - + 16777215 @@ -31,7 +34,7 @@ - + 16777215 @@ -41,7 +44,7 @@ - + 16777215 @@ -54,17 +57,17 @@ - + 16777215 - 20 + 21 - + 16777215 @@ -77,20 +80,13 @@ - + 16777215 - 20 + 21 - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'.Helvetica Neue DeskInterface'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - @@ -120,7 +116,7 @@ p, li { white-space: pre-wrap; } - + 16777215 @@ -133,20 +129,17 @@ p, li { white-space: pre-wrap; } - - - true - + 16777215 - 20 + 21 - + 16777215 @@ -159,14 +152,28 @@ p, li { white-space: pre-wrap; } - - - true + + + + 16777215 + 21 + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Enter hint:</span></p></body></html> + + + + + 16777215 - 20 + 50 @@ -188,6 +195,15 @@ p, li { white-space: pre-wrap; } + + + 83 + 16777215 + + + + Qt::LeftToRight + Cancel @@ -195,6 +211,21 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + + + + + 83 + 16777215 + + + + Qt::LeftToRight + &Create @@ -209,22 +240,6 @@ p, li { white-space: pre-wrap; } - - create - clicked() - NewAccount - accept() - - - 462 - 484 - - - 449 - 504 - - - cancel clicked() From f30991f6cbf657c18988a5d045ce0479629de8d0 Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 14 Aug 2015 08:09:14 +0200 Subject: [PATCH 17/57] make hint text field enabled only when entering password is enabled --- alethzero/plugins/namers/NewAccount.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/alethzero/plugins/namers/NewAccount.cpp b/alethzero/plugins/namers/NewAccount.cpp index 51b320c3632..64a3ea185d7 100644 --- a/alethzero/plugins/namers/NewAccount.cpp +++ b/alethzero/plugins/namers/NewAccount.cpp @@ -60,6 +60,7 @@ void NewAccount::create() u.hexText->setEnabled(false); u.passwordText->setEnabled(false); u.passwordAgainText->setEnabled(false); + u.hintText->setEnabled(false); QStringList items = { @@ -84,6 +85,7 @@ void NewAccount::create() bool checked = u.additionalCheckBox->checkState() == Qt::CheckState::Checked; u.passwordText->setEnabled(checked); u.passwordAgainText->setEnabled(checked); + u.hintText->setEnabled(checked); }); connect(u.create, &QPushButton::clicked, [&]() From 8fc404f2bbc567c10294011028a1c92acf5815e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 14 Aug 2015 12:12:31 +0200 Subject: [PATCH 18/57] Style changes. --- evmjit/libevmjit/Compiler.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/evmjit/libevmjit/Compiler.cpp b/evmjit/libevmjit/Compiler.cpp index e473005096b..9bde352c3ad 100644 --- a/evmjit/libevmjit/Compiler.cpp +++ b/evmjit/libevmjit/Compiler.cpp @@ -105,14 +105,9 @@ void Compiler::resolveJumps() auto nextBlock = it->getNextNode() != m_mainFunc->end() ? it->getNextNode() : m_stopBB; auto term = it->getTerminator(); - if (!term) - { - // Block may have no terminator if the next instruction is a jump destination. + if (!term) // Block may have no terminator if the next instruction is a jump destination. llvm::IRBuilder<>{it}.CreateBr(nextBlock); - } else if (auto jump = llvm::dyn_cast(term)) - { - // Resolve jump if (jump->getSuccessor(0) == m_jumpTableBB) { auto destIdx = llvm::cast(jump->getMetadata(c_destIdxLabel)->getOperand(0))->getValue(); @@ -128,7 +123,6 @@ void Compiler::resolveJumps() if (jump->isConditional()) jump->setSuccessor(1, nextBlock); // Set next block for conditional jumps } - } } } From 0ff44bd15c3fb00d93b01f811abf69964f2ec89a Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 14 Aug 2015 14:20:59 +0200 Subject: [PATCH 19/57] Async transact gas determination. --- alethzero/Transact.cpp | 73 +++++++++++++++++++++--------------------- alethzero/Transact.h | 3 +- alethzero/Transact.ui | 48 ++++++++++++++++++--------- 3 files changed, 71 insertions(+), 53 deletions(-) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index f4b331d22a6..ba767a6e7ce 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -106,7 +106,12 @@ bool Transact::isCreation() const u256 Transact::fee() const { - return ui->gas->value() * gasPrice(); + return gas() * gasPrice(); +} + +u256 Transact::gas() const +{ + return ui->gas->value() == -1 ? m_upperBound : ui->gas->value(); } u256 Transact::value() const @@ -199,10 +204,10 @@ void Transact::on_copyUnsigned_clicked() if (isCreation()) // If execution is a contract creation, add Natspec to // a local Natspec LEVELDB - t = Transaction(value(), gasPrice(), ui->gas->value(), m_data, nonce); + t = Transaction(value(), gasPrice(), gas(), m_data, nonce); else // TODO: cache like m_data. - t = Transaction(value(), gasPrice(), ui->gas->value(), toAccount().first, m_data, nonce); + t = Transaction(value(), gasPrice(), gas(), toAccount().first, m_data, nonce); qApp->clipboard()->setText(QString::fromStdString(toHex(t.rlp()))); } @@ -350,11 +355,11 @@ void Transact::timerEvent(QTimerEvent*) else er = ethereum()->call(from, value(), to, m_data, mid, gasPrice(), PendingBlock, FudgeFactor::Lenient); if (er.excepted == TransactionException::OutOfGas || er.excepted == TransactionException::OutOfGasBase || er.excepted == TransactionException::OutOfGasIntrinsic || er.codeDeposit == CodeDeposit::Failed) - m_lowerBound = mid; + m_lowerBound = m_lowerBound == mid ? m_upperBound : mid; else { m_lastGood = er; - m_upperBound = mid; + m_upperBound = m_upperBound == mid ? m_lowerBound : mid; } updateBounds(); @@ -371,58 +376,52 @@ void Transact::updateBounds() double nran = m_upperBound - m_lowerBound; int x = int(log2(oran / nran) * 100.0 / log2(oran * 2)); ui->progressGas->setValue(x); + ui->progressGas->setVisible(true); + ui->gas->setSpecialValueText(QString("Auto (%1 gas)").arg(m_upperBound)); } void Transact::finaliseBounds() { - qint64 baseGas = (qint64)Transaction::gasRequired(m_data, 0); - GasRequirements gasReq = GasRequirements{m_upperBound, baseGas, m_upperBound - baseGas, (qint64)m_lastGood.gasRefunded, m_lastGood}; + quint64 baseGas = (quint64)Transaction::gasRequired(m_data, 0); + ui->progressGas->setVisible(false); - QString htmlInfo = QString("
INFO Gas required: %1 total = %2 base, %3 exec [%4 refunded later]
").arg(gasReq.neededGas).arg(gasReq.baseGas).arg(gasReq.executionGas).arg(gasReq.refundedGas); + quint64 executionGas = m_upperBound - baseGas; + QString htmlInfo = QString("
INFO Gas required: %1 total = %2 base, %3 exec [%4 refunded later]
").arg(m_upperBound).arg(baseGas).arg(executionGas).arg((qint64)m_lastGood.gasRefunded); auto bail = [&](QString he) { - m_allGood = false; -// ui->send->setEnabled(false); - ui->code->setHtml(he + htmlInfo + ui->code->toHtml()); + ui->send->setEnabled(false); + ui->code->setHtml(he + htmlInfo + m_dataInfo); }; auto s = fromAccount(); auto b = ethereum()->balanceAt(s, PendingBlock); - if (b < value() + gasReq.baseGas * gasPrice()) + if (b < value() + baseGas * gasPrice()) { // Not enough - bail. bail("
ERROR Account doesn't contain enough for paying even the basic amount of gas required.
"); return; } - if (gasReq.neededGas > m_ethereum->gasLimitRemaining()) + if (m_upperBound > m_ethereum->gasLimitRemaining()) { // Not enough - bail. bail("
ERROR Gas remaining in block isn't enough to allow the gas required.
"); return; } - if (gasReq.er.excepted != TransactionException::None) + if (m_lastGood.excepted != TransactionException::None) { - bail("
ERROR " + QString::fromStdString(toString(gasReq.er.excepted)) + "
"); + bail("
ERROR " + QString::fromStdString(toString(m_lastGood.excepted)) + "
"); return; } - if (gasReq.er.codeDeposit == CodeDeposit::Failed) + if (m_lastGood.codeDeposit == CodeDeposit::Failed) { - bail("
ERROR Code deposit failed due to insufficient gas; " + QString::fromStdString(toString(gasReq.er.gasForDeposit)) + " GAS < " + QString::fromStdString(toString(gasReq.er.depositSize)) + " bytes * " + QString::fromStdString(toString(c_createDataGas)) + "GAS/byte
"); + bail("
ERROR Code deposit failed due to insufficient gas; " + QString::fromStdString(toString(m_lastGood.gasForDeposit)) + " GAS < " + QString::fromStdString(toString(m_lastGood.depositSize)) + " bytes * " + QString::fromStdString(toString(c_createDataGas)) + "GAS/byte
"); return; } - // Update gas - if (ui->gas->value() == ui->gas->minimum()) - { - ui->gas->setMinimum(gasReq.neededGas); - ui->gas->setValue(gasReq.neededGas); - } - else - ui->gas->setMinimum(gasReq.neededGas); - updateFee(); - ui->code->setHtml(htmlInfo + ui->code->toHtml()); + ui->code->setHtml(htmlInfo + m_dataInfo); + ui->send->setEnabled(true); killTimer(m_gasCalcTimer); } @@ -473,13 +472,12 @@ void Transact::rejigData() if (!s) return; - m_allGood = true; QString htmlInfo; auto bail = [&](QString he) { - m_allGood = false; -// ui->send->setEnabled(false); - ui->code->setHtml(he + htmlInfo); + ui->send->setEnabled(false); + m_dataInfo = he + htmlInfo; + ui->code->setHtml(m_dataInfo); }; // Determine m_info. @@ -513,8 +511,9 @@ void Transact::rejigData() determineGasRequirements(); - ui->code->setHtml(htmlInfo); -// ui->send->setEnabled(m_allGood); + m_dataInfo = htmlInfo; + ui->code->setHtml(m_dataInfo); + ui->send->setEnabled(true); } Secret Transact::findSecret(u256 _totalReq) const @@ -576,7 +575,7 @@ void Transact::on_send_clicked() { // If execution is a contract creation, add Natspec to // a local Natspec LEVELDB - ethereum()->submitTransaction(s, value(), m_data, ui->gas->value(), gasPrice(), nonce); + ethereum()->submitTransaction(s, value(), m_data, gas(), gasPrice(), nonce); #if ETH_SOLIDITY string src = ui->data->toPlainText().toStdString(); if (sourceIsSolidity(src)) @@ -595,7 +594,7 @@ void Transact::on_send_clicked() } else // TODO: cache like m_data. - ethereum()->submitTransaction(s, value(), toAccount().first, m_data, ui->gas->value(), gasPrice(), nonce); + ethereum()->submitTransaction(s, value(), toAccount().first, m_data, gas(), gasPrice(), nonce); close(); } @@ -614,8 +613,8 @@ void Transact::on_debug_clicked() { Block postState(ethereum()->postState()); Transaction t = isCreation() ? - Transaction(value(), gasPrice(), ui->gas->value(), m_data, postState.transactionsFrom(from)) : - Transaction(value(), gasPrice(), ui->gas->value(), toAccount().first, m_data, postState.transactionsFrom(from)); + Transaction(value(), gasPrice(), gas(), m_data, postState.transactionsFrom(from)) : + Transaction(value(), gasPrice(), gas(), toAccount().first, m_data, postState.transactionsFrom(from)); t.forceSender(from); Debugger dw(m_main, this); Executive e(postState, ethereum()->blockChain(), 0); diff --git a/alethzero/Transact.h b/alethzero/Transact.h index 4056144c2f9..723ff07dba3 100644 --- a/alethzero/Transact.h +++ b/alethzero/Transact.h @@ -88,6 +88,7 @@ private slots: void updateFee(); bool isCreation() const; dev::u256 fee() const; + dev::u256 gas() const; dev::u256 total() const; dev::u256 value() const; dev::u256 gasPrice() const; @@ -108,8 +109,8 @@ private slots: dev::eth::Client* m_ethereum = nullptr; MainFace* m_main = nullptr; NatSpecFace* m_natSpecDB = nullptr; - bool m_allGood = false; + QString m_dataInfo; qint64 m_startLowerBound = 0; qint64 m_startUpperBound = 0; qint64 m_lowerBound = 0; diff --git a/alethzero/Transact.ui b/alethzero/Transact.ui index 3c78e3db753..94b32984256 100644 --- a/alethzero/Transact.ui +++ b/alethzero/Transact.ui @@ -6,7 +6,7 @@ 0 0 - 543 + 604 695
@@ -23,17 +23,20 @@
+ + Automatic + gas - 1 + -1 430000000 - 10000 + -1 @@ -261,7 +264,20 @@
- + + + + gas + + + max + + + 450000000 + + + + true @@ -272,10 +288,22 @@ min + + 0 + + + 450000000 + - + + + + 0 + 0 + + 24 @@ -284,16 +312,6 @@
- - - - gas - - - max - - -
From 63f6e98d596cd011078a775b1eac9e9d9fa06a0e Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 14 Aug 2015 14:35:44 +0200 Subject: [PATCH 20/57] moved export state dialog to plugin --- alethzero/CMakeLists.txt | 3 +- alethzero/Main.ui | 6 -- alethzero/MainWin.cpp | 7 -- alethzero/MainWin.h | 1 - .../{ => plugins/blockchain}/ExportState.cpp | 91 +++++++++++-------- .../{ => plugins/blockchain}/ExportState.h | 15 +-- .../{ => plugins/blockchain}/ExportState.ui | 0 7 files changed, 61 insertions(+), 62 deletions(-) rename alethzero/{ => plugins/blockchain}/ExportState.cpp (66%) rename alethzero/{ => plugins/blockchain}/ExportState.h (84%) rename alethzero/{ => plugins/blockchain}/ExportState.ui (100%) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index e4dfabc5f4a..a9b2e3233f2 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -42,7 +42,6 @@ qt5_wrap_ui(ui_Main.h Main.ui) qt5_wrap_ui(ui_Connect.h Connect.ui) qt5_wrap_ui(ui_Debugger.h Debugger.ui) qt5_wrap_ui(ui_Transact.h Transact.ui) -qt5_wrap_ui(ui_ExportState.h ExportState.ui) qt5_wrap_ui(ui_GetPassword.h GetPassword.ui) qt5_wrap_ui(ui_GasPricing.h GasPricing.ui) @@ -60,7 +59,7 @@ endif () # eth_add_executable is defined in cmake/EthExecutableHelper.cmake eth_add_executable(${EXECUTABLE} ICON alethzero - UI_RESOURCES ${PLUGIN_UI} alethzero.icns Main.ui Connect.ui Debugger.ui Transact.ui ExportState.ui GetPassword.ui GasPricing.ui + UI_RESOURCES ${PLUGIN_UI} alethzero.icns Main.ui Connect.ui Debugger.ui Transact.ui GetPassword.ui GasPricing.ui WIN_RESOURCES alethzero.rc ) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index fe3eadb16fa..deb6a035c03 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -173,7 +173,6 @@ - @@ -1098,11 +1097,6 @@ font-size: 14pt &Load Javascript... - - - &Export State... - - false diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 7327f63a5b4..102c7143dba 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -73,7 +73,6 @@ #include "DappLoader.h" #include "DappHost.h" #include "WebPage.h" -#include "ExportState.h" #include "ui_Main.h" #include "ui_GetPassword.h" #include "ui_GasPricing.h" @@ -1029,12 +1028,6 @@ void Main::on_exportKey_triggered() } } -void Main::on_exportState_triggered() -{ - ExportStateDialog dialog(this); - dialog.exec(); -} - void Main::on_usePrivate_triggered() { QString pc; diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index ef4e8105662..84d94d66dba 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -163,7 +163,6 @@ private slots: // Tools void on_newTransaction_triggered(); void on_loadJS_triggered(); - void on_exportState_triggered(); // Stuff concerning the blocks/transactions/accounts panels void on_ourAccounts_itemClicked(QListWidgetItem* _i); diff --git a/alethzero/ExportState.cpp b/alethzero/plugins/blockchain/ExportState.cpp similarity index 66% rename from alethzero/ExportState.cpp rename to alethzero/plugins/blockchain/ExportState.cpp index 1e243f5d5db..c0f45c0e8c5 100644 --- a/alethzero/ExportState.cpp +++ b/alethzero/plugins/blockchain/ExportState.cpp @@ -19,77 +19,86 @@ * @date 2015 */ +#if ETH_FATDB + #include "ExportState.h" +#include #include #include #include -#include "MainWin.h" #include "ui_ExportState.h" using namespace std; using namespace dev; using namespace az; using namespace eth; -ExportStateDialog::ExportStateDialog(Main* _parent): - QDialog(_parent), - ui(new Ui::ExportState), - m_main(_parent) +DEV_AZ_NOTE_PLUGIN(ExportStateDialog); + +ExportStateDialog::ExportStateDialog(MainFace* _m): + QDialog(_m), + Plugin(_m, "Export State"), + m_ui(new Ui::ExportState) { - ui->setupUi(this); - connect(ui->close, &QPushButton::clicked, this, &ExportStateDialog::close); - connect(ui->accounts, &QListWidget::itemSelectionChanged, this, &ExportStateDialog::generateJSON); - connect(ui->contracts, &QListWidget::itemSelectionChanged, this, &ExportStateDialog::generateJSON); + m_ui->setupUi(this); + connect(m_ui->close, &QPushButton::clicked, this, &ExportStateDialog::close); + connect(m_ui->accounts, &QListWidget::itemSelectionChanged, this, &ExportStateDialog::generateJSON); + connect(m_ui->contracts, &QListWidget::itemSelectionChanged, this, &ExportStateDialog::generateJSON); fillBlocks(); + connect(addMenuItem("Export State...", "menuTools", true), SIGNAL(triggered()), SLOT(exec())); } ExportStateDialog::~ExportStateDialog() { -} -Client* ExportStateDialog::ethereum() const +} +void ExportStateDialog::showEvent(QShowEvent*) { - return m_main->ethereum(); + m_ui->block->clear(); + m_ui->block->clearEditText(); + m_ui->accounts->clear(); + m_ui->contracts->clear(); + fillBlocks(); } void ExportStateDialog::on_block_editTextChanged() { - QString text = ui->block->currentText(); - int i = ui->block->count(); + QString text = m_ui->block->currentText(); + int i = m_ui->block->count(); while (i-- >= 0) - if (ui->block->itemText(i) == text) + if (m_ui->block->itemText(i) == text) return; fillBlocks(); } void ExportStateDialog::on_block_currentIndexChanged(int _index) { - m_block = ui->block->itemData(_index).toUInt(); + m_block = m_ui->block->itemData(_index).toUInt(); fillContracts(); } void ExportStateDialog::fillBlocks() { BlockChain const& bc = ethereum()->blockChain(); - QStringList filters = ui->block->currentText().toLower().split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList filters = m_ui->block->currentText().toLower().split(QRegExp("\\s+"), QString::SkipEmptyParts); const unsigned numLastBlocks = 10; - if (ui->block->count() == 0) + if (m_ui->block->count() == 0) { unsigned i = numLastBlocks; for (auto h = bc.currentHash(); bc.details(h) && i; h = bc.details(h).parent, --i) { auto d = bc.details(h); - ui->block->addItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), d.number); + m_ui->block->addItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), d.number); if (h == bc.genesisHash()) break; } - if (ui->block->currentIndex() < 0) - ui->block->setCurrentIndex(0); + if (m_ui->block->currentIndex() < 0) + m_ui->block->setCurrentIndex(0); m_recentBlocks = numLastBlocks - i; } - int i = ui->block->count(); + int i = m_ui->block->count(); while (i > 0 && i >= m_recentBlocks) - ui->block->removeItem(i--); + m_ui->block->removeItem(i--); h256Hash blocks; for (QString f: filters) @@ -117,31 +126,31 @@ void ExportStateDialog::fillBlocks() for (auto const& h: blocks) { auto d = bc.details(h); - ui->block->addItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), d.number); + m_ui->block->addItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), d.number); } } void ExportStateDialog::fillContracts() { - ui->accounts->clear(); - ui->contracts->clear(); - ui->accounts->setEnabled(true); - ui->contracts->setEnabled(true); + m_ui->accounts->clear(); + m_ui->contracts->clear(); + m_ui->accounts->setEnabled(true); + m_ui->contracts->setEnabled(true); try { for (auto i: ethereum()->addresses(m_block)) { - string r = m_main->render(i); - (new QListWidgetItem(QString("%2: %1 [%3]").arg(formatBalance(ethereum()->balanceAt(i)).c_str()).arg(QString::fromStdString(r)).arg((unsigned)ethereum()->countAt(i)), ethereum()->codeAt(i).empty() ? ui->accounts : ui->contracts)) + string r = main()->render(i); + (new QListWidgetItem(QString("%2: %1 [%3]").arg(formatBalance(ethereum()->balanceAt(i)).c_str()).arg(QString::fromStdString(r)).arg((unsigned)ethereum()->countAt(i)), ethereum()->codeAt(i).empty() ? m_ui->accounts : m_ui->contracts)) ->setData(Qt::UserRole, QByteArray((char const*)i.data(), Address::size)); } } catch (InterfaceNotSupported const&) { - ui->accounts->setEnabled(false); - ui->contracts->setEnabled(false); - ui->json->setEnabled(false); - ui->json->setText(QString("This feature requires compilation with FATDB support.")); + m_ui->accounts->setEnabled(false); + m_ui->contracts->setEnabled(false); + m_ui->json->setEnabled(false); + m_ui->json->setText(QString("This feature requires compilation with FATDB support.")); } } @@ -150,14 +159,14 @@ void ExportStateDialog::generateJSON() std::stringstream json; json << "{\n"; std::string prefix; - for(QListWidgetItem* item: ui->accounts->selectedItems()) + for(QListWidgetItem* item: m_ui->accounts->selectedItems()) { auto hba = item->data(Qt::UserRole).toByteArray(); auto address = Address((byte const*)hba.data(), Address::ConstructFromPointer); json << prefix << "\t\"" << toHex(address.ref()) << "\": { \"wei\": \"" << ethereum()->balanceAt(address, m_block) << "\" }"; prefix = ",\n"; } - for(QListWidgetItem* item: ui->contracts->selectedItems()) + for(QListWidgetItem* item: m_ui->contracts->selectedItems()) { auto hba = item->data(Qt::UserRole).toByteArray(); auto address = Address((byte const*)hba.data(), Address::ConstructFromPointer); @@ -181,9 +190,9 @@ void ExportStateDialog::generateJSON() json << "\n}"; json.flush(); - ui->json->setEnabled(true); - ui->json->setText(QString::fromStdString(json.str())); - ui->saveButton->setEnabled(true); + m_ui->json->setEnabled(true); + m_ui->json->setText(QString::fromStdString(json.str())); + m_ui->saveButton->setEnabled(true); } void ExportStateDialog::on_saveButton_clicked() @@ -193,5 +202,7 @@ void ExportStateDialog::on_saveButton_clicked() fn = fn.append(".json"); ofstream file(fn.toStdString()); if (file.is_open()) - file << ui->json->toPlainText().toStdString(); + file << m_ui->json->toPlainText().toStdString(); } + +#endif //ETH_FATDB diff --git a/alethzero/ExportState.h b/alethzero/plugins/blockchain/ExportState.h similarity index 84% rename from alethzero/ExportState.h rename to alethzero/plugins/blockchain/ExportState.h index 2dbe507d1ab..b7c012356b0 100644 --- a/alethzero/ExportState.h +++ b/alethzero/plugins/blockchain/ExportState.h @@ -21,9 +21,12 @@ #pragma once +#if ETH_FATDB + #include #include #include +#include "MainFace.h" namespace Ui { class ExportState; } @@ -35,14 +38,13 @@ namespace eth { class Client; } namespace az { -class Main; -class ExportStateDialog: public QDialog +class ExportStateDialog: public QDialog, public Plugin { Q_OBJECT public: - explicit ExportStateDialog(Main* _parent = 0); + ExportStateDialog(MainFace* _m); virtual ~ExportStateDialog(); private slots: @@ -51,17 +53,18 @@ private slots: void on_saveButton_clicked(); private: - eth::Client* ethereum() const; + void showEvent(QShowEvent* _event) override; void fillBlocks(); void fillContracts(); void generateJSON(); private: - std::unique_ptr ui; - Main* m_main; + std::unique_ptr m_ui; int m_recentBlocks = 0; eth::BlockNumber m_block = eth::LatestBlock; }; } } + +#endif //ETH_FATDB diff --git a/alethzero/ExportState.ui b/alethzero/plugins/blockchain/ExportState.ui similarity index 100% rename from alethzero/ExportState.ui rename to alethzero/plugins/blockchain/ExportState.ui From e69a0c1819d85e3da2d837433b24da9bd0d25c0f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 14 Aug 2015 15:08:51 +0200 Subject: [PATCH 21/57] Forgot to record the timer id. --- alethzero/Transact.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index ba767a6e7ce..cb52eb3154d 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -451,10 +451,11 @@ GasRequirements Transact::determineGasRequirements() } else { + // Begin async binary chop for gas calculation.. m_lastGood = lastGood; m_lowerBound = m_startLowerBound; m_upperBound = m_startUpperBound; - startTimer(0); + m_gasCalcTimer = startTimer(0); return GasRequirements{m_upperBound, baseGas, m_upperBound - baseGas, (qint64)lastGood.gasRefunded, lastGood}; } } From 60b0dcbbe05cc0b66b99bdc734bc59610ece08ae Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 14 Aug 2015 15:20:21 +0200 Subject: [PATCH 22/57] Don't start timer, cleanup before next time. --- alethzero/Transact.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index cb52eb3154d..c9d687ef3db 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -64,8 +64,6 @@ Transact::Transact(MainFace* _c, QWidget* _parent): setValueUnits(ui->valueUnits, ui->value, 0); on_destination_currentTextChanged(QString()); - - startTimer(100); } Transact::~Transact() @@ -455,6 +453,7 @@ GasRequirements Transact::determineGasRequirements() m_lastGood = lastGood; m_lowerBound = m_startLowerBound; m_upperBound = m_startUpperBound; + killTimer(m_gasCalcTimer); m_gasCalcTimer = startTimer(0); return GasRequirements{m_upperBound, baseGas, m_upperBound - baseGas, (qint64)lastGood.gasRefunded, lastGood}; } From 854270026de64433b11f81593fb01171d3e54d48 Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 14 Aug 2015 15:21:46 +0200 Subject: [PATCH 23/57] additional ssh methods --- libjsqrc/ethereumjs/dist/web3-light.js | 24 +++++++++++++++++++++- libjsqrc/ethereumjs/dist/web3-light.min.js | 4 ++-- libjsqrc/ethereumjs/dist/web3.js | 24 +++++++++++++++++++++- libjsqrc/ethereumjs/dist/web3.js.map | 4 ++-- libjsqrc/ethereumjs/dist/web3.min.js | 4 ++-- libjsqrc/ethereumjs/lib/web3/shh.js | 24 +++++++++++++++++++++- 6 files changed, 75 insertions(+), 9 deletions(-) diff --git a/libjsqrc/ethereumjs/dist/web3-light.js b/libjsqrc/ethereumjs/dist/web3-light.js index b4f00e798ce..787e12c8744 100644 --- a/libjsqrc/ethereumjs/dist/web3-light.js +++ b/libjsqrc/ethereumjs/dist/web3-light.js @@ -4577,12 +4577,34 @@ var addToGroup = new Method({ params: 0 }); + +var newFilter = new Method({ + name: 'newFilter', + call: 'shh_newFilter', + params: 1 +}); + +var getFilterChanges = new Method({ + name: 'getFilterChanges', + call: 'shh_getFilterChanges', + params: 1 +}); + +var getMessages = new Method({ + name: 'getMessages', + call: 'shh_getMessages', + params: 1 +}) + var methods = [ post, newIdentity, hasIdentity, newGroup, - addToGroup + addToGroup, + newFilter, + getFilterChanges, + getMessages ]; module.exports = { diff --git a/libjsqrc/ethereumjs/dist/web3-light.min.js b/libjsqrc/ethereumjs/dist/web3-light.min.js index 65b2bf23f89..8da336c5492 100644 --- a/libjsqrc/ethereumjs/dist/web3-light.min.js +++ b/libjsqrc/ethereumjs/dist/web3-light.min.js @@ -1,3 +1,3 @@ -require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"string",match:"strict",mode:"bytes",inputFormatter:i.formatInputString,outputFormatter:i.formatOutputString}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.padRight(o.toHex(t).substr(2),64);return new a(e)},c=function(t){t=o.toHex(t).substr(2);var e=Math.floor((t.length+63)/64),n=o.padRight(t,64*e),r=Math.floor(t.length/2);return new a(s(r).value+n,32)},l=function(t){var e=o.fromAscii(t).substr(2),n=Math.floor((e.length+63)/64);return e=o.padRight(e,64*n),new a(s(t.length).value+e,32)},p=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},f=function(t){return s(new r(t).times(new r(2).pow(128)))},m=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},h=function(t){var e=t.staticPart()||"0";return m(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},d=function(t){var e=t.staticPart()||"0";return new r(e,16)},y=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return d(t).dividedBy(new r(2).pow(128))},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},b=function(t){return"0x"+t.staticPart()},w=function(t){var e=2*new r(t.dynamicPart().slice(0,64),16).toNumber();return"0x"+t.dynamicPart().substr(64,e)},_=function(t){var e=2*new r(t.dynamicPart().slice(0,64),16).toNumber();return o.toAscii(t.dynamicPart().substr(64,e))},x=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputString:l,formatInputBool:p,formatInputReal:f,formatOutputInt:h,formatOutputUInt:d,formatOutputReal:y,formatOutputUReal:g,formatOutputBool:v,formatOutputBytes:b,formatOutputDynamicBytes:w,formatOutputString:_,formatOutputAddress:x}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return r=Math.floor((r+31)/32),new o(t.substr(2*n,64*(1+r)),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":34}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t,e,n){return t+new Array(e-t.length+1).join(n?n:"0")},s=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);e+=String.fromCharCode(o)}return e},u=function(t){for(var e="",n=0;n50){if(a.stopWatching(),i=!0,!n)throw new Error("Contract transaction couldn't be found after 50 blocks");n(new Error("Contract transaction couldn't be found after 50 blocks"))}else r.eth.getTransactionReceipt(t.transactionHash,function(o,s){s&&!i&&r.eth.getCode(s.contractAddress,function(r,o){if(!i)if(a.stopWatching(),i=!0,o.length>2)t.address=s.contractAddress,l(t,e),p(t,e),n&&n(null,t);else{if(!n)throw new Error("The contract code couldn't be stored, please check your gas amount.");n(new Error("The contract code couldn't be stored, please check your gas amount."))}})})})},h=function(t){this.abi=t};h.prototype["new"]=function(){var t,e=this,n=new d(this.abi),i={},a=Array.prototype.slice.call(arguments);o.isFunction(a[a.length-1])&&(t=a.pop());var s=a[a.length-1];o.isObject(s)&&!o.isArray(s)&&(i=a.pop());var u=c(this.abi,a);if(i.data+=u,t)r.eth.sendTransaction(i,function(r,o){r?t(r):(n.transactionHash=o,t(null,n),m(n,e.abi,t))});else{var l=r.eth.sendTransaction(i);n.transactionHash=l,m(n,e.abi)}return n},h.prototype.at=function(t,e){var n=new d(this.abi,t);return l(n,this.abi),p(n,this.abi),e&&e(null,n),n};var d=function(t,e){this.address=e};e.exports=f},{"../solidity/coder":1,"../utils/utils":7,"../web3":9,"./allevents":10,"./event":16,"./function":19}],13:[function(t,e,n){var r=t("./method"),o=new r({name:"putString",call:"db_putString",params:3}),i=new r({name:"getString",call:"db_getString",params:2}),a=new r({name:"putHex",call:"db_putHex",params:3}),s=new r({name:"getHex",call:"db_getHex",params:2}),u=[o,i,a,s];e.exports={methods:u}},{"./method":24}],14:[function(t,e,n){e.exports={InvalidNumberOfParams:function(){return new Error("Invalid number of input parameters")},InvalidConnection:function(t){return new Error("CONNECTION ERROR: Couldn't connect to node "+t+", is it running?")},InvalidProvider:function(){return new Error("Providor not set or invalid")},InvalidResponse:function(t){var e=t&&t.error&&t.error.message?t.error.message:"Invalid JSON RPC response: "+t;return new Error(e)}}},{}],15:[function(t,e,n){"use strict";var r=t("./formatters"),o=t("../utils/utils"),i=t("./method"),a=t("./property"),s=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},u=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},c=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},l=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},p=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},f=new i({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[o.toAddress,r.inputDefaultBlockNumberFormatter],outputFormatter:r.outputBigNumberFormatter}),m=new i({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[null,o.toHex,r.inputDefaultBlockNumberFormatter]}),h=new i({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.toAddress,r.inputDefaultBlockNumberFormatter]}),d=new i({name:"getBlock",call:s,params:2,inputFormatter:[r.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:r.outputBlockFormatter}),y=new i({name:"getUncle",call:c,params:2,inputFormatter:[r.inputBlockNumberFormatter,o.toHex],outputFormatter:r.outputBlockFormatter}),g=new i({name:"getCompilers",call:"eth_getCompilers",params:0}),v=new i({name:"getBlockTransactionCount",call:l,params:1,inputFormatter:[r.inputBlockNumberFormatter],outputFormatter:o.toDecimal}),b=new i({name:"getBlockUncleCount",call:p,params:1,inputFormatter:[r.inputBlockNumberFormatter],outputFormatter:o.toDecimal}),w=new i({name:"getTransaction",call:"eth_getTransactionByHash",params:1,outputFormatter:r.outputTransactionFormatter}),_=new i({name:"getTransactionFromBlock",call:u,params:2,inputFormatter:[r.inputBlockNumberFormatter,o.toHex],outputFormatter:r.outputTransactionFormatter}),x=new i({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,outputFormatter:r.outputTransactionReceiptFormatter}),I=new i({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[null,r.inputDefaultBlockNumberFormatter],outputFormatter:o.toDecimal}),F=new i({name:"sendRawTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null]}),k=new i({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[r.inputTransactionFormatter]}),B=new i({name:"call",call:"eth_call",params:2,inputFormatter:[r.inputTransactionFormatter,r.inputDefaultBlockNumberFormatter]}),T=new i({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[r.inputTransactionFormatter],outputFormatter:o.toDecimal}),N=new i({name:"compile.solidity",call:"eth_compileSolidity",params:1}),P=new i({name:"compile.lll",call:"eth_compileLLL",params:1}),O=new i({name:"compile.serpent",call:"eth_compileSerpent",params:1}),A=new i({name:"submitWork",call:"eth_submitWork",params:3}),C=new i({name:"getWork",call:"eth_getWork",params:0}),D=[f,m,h,d,y,g,v,b,w,_,x,I,B,T,F,k,N,P,O,A,C],S=[new a({name:"coinbase",getter:"eth_coinbase"}),new a({name:"mining",getter:"eth_mining"}),new a({name:"hashrate",getter:"eth_hashrate",outputFormatter:o.toDecimal}),new a({name:"gasPrice",getter:"eth_gasPrice",outputFormatter:r.outputBigNumberFormatter}),new a({name:"accounts",getter:"eth_accounts"}),new a({name:"blockNumber",getter:"eth_blockNumber",outputFormatter:o.toDecimal})];e.exports={methods:D,properties:S}},{"../utils/utils":7,"./formatters":18,"./method":24,"./property":27}],16:[function(t,e,n){var r=t("../utils/utils"),o=t("../solidity/coder"),i=t("./formatters"),a=t("../utils/sha3"),s=t("./filter"),u=t("./watches"),c=function(t,e){this._params=t.inputs,this._name=r.transformToFullName(t),this._address=e,this._anonymous=t.anonymous};c.prototype.types=function(t){return this._params.filter(function(e){return e.indexed===t}).map(function(t){return t.type})},c.prototype.displayName=function(){return r.extractDisplayName(this._name)},c.prototype.typeName=function(){return r.extractTypeName(this._name)},c.prototype.signature=function(){return a(this._name)},c.prototype.encode=function(t,e){t=t||{},e=e||{};var n={};["fromBlock","toBlock"].filter(function(t){return void 0!==e[t]}).forEach(function(t){n[t]=i.inputBlockNumberFormatter(e[t])}),n.topics=[],n.address=this._address,this._anonymous||n.topics.push("0x"+this.signature());var a=this._params.filter(function(t){return t.indexed===!0}).map(function(e){var n=t[e.name];return void 0===n||null===n?null:r.isArray(n)?n.map(function(t){return"0x"+o.encodeParam(e.type,t)}):"0x"+o.encodeParam(e.type,n)});return n.topics=n.topics.concat(a),n},c.prototype.decode=function(t){t.data=t.data||"",t.topics=t.topics||[];var e=this._anonymous?t.topics:t.topics.slice(1),n=e.map(function(t){return t.slice(2)}).join(""),r=o.decodeParams(this.types(!0),n),a=t.data.slice(2),s=o.decodeParams(this.types(!1),a),u=i.outputLogFormatter(t);return u.event=this.displayName(),u.address=t.address,u.args=this._params.reduce(function(t,e){return t[e.name]=e.indexed?r.shift():s.shift(),t},{}),delete u.data,delete u.topics,u},c.prototype.execute=function(t,e,n){r.isFunction(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],2===arguments.length&&(e=null),1===arguments.length&&(e=null,t={}));var o=this.encode(t,e),i=this.decode.bind(this);return new s(o,u.eth(),i,n)},c.prototype.attachToContract=function(t){var e=this.execute.bind(this),n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=this.execute.bind(this,t)},e.exports=c},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"./filter":17,"./formatters":18,"./watches":31}],17:[function(t,e,n){var r=t("./requestmanager"),o=t("./formatters"),i=t("../utils/utils"),a=function(t){return null===t||"undefined"==typeof t?null:(t=String(t),0===t.indexOf("0x")?t:i.fromAscii(t))},s=function(t){return i.isString(t)?t:(t=t||{},t.topics=t.topics||[],t.topics=t.topics.map(function(t){return i.isArray(t)?t.map(a):a(t)}),{topics:t.topics,to:t.to,address:t.address,fromBlock:o.inputBlockNumberFormatter(t.fromBlock),toBlock:o.inputBlockNumberFormatter(t.toBlock)})},u=function(t,e){i.isString(t.options)||t.get(function(t,n){t&&e(t),i.isArray(n)&&n.forEach(function(t){e(null,t)})})},c=function(t){var e=function(e,n){return e?t.callbacks.forEach(function(t){t(e)}):void n.forEach(function(e){e=t.formatter?t.formatter(e):e,t.callbacks.forEach(function(t){t(null,e)})})};r.getInstance().startPolling({method:t.implementation.poll.call,params:[t.filterId]},t.filterId,e,t.stopWatching.bind(t))},l=function(t,e,n,r){var o=this,i={};e.forEach(function(t){t.attachToObject(i)}),this.options=s(t),this.implementation=i,this.filterId=null,this.callbacks=[],this.pollFilters=[],this.formatter=n,this.implementation.newFilter(this.options,function(t,e){if(t)o.callbacks.forEach(function(e){e(t)});else if(o.filterId=e,o.callbacks.forEach(function(t){u(o,t)}),o.callbacks.length>0&&c(o),r)return o.watch(r)})};l.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(u(this,t),c(this)),this},l.prototype.stopWatching=function(){r.getInstance().stopPolling(this.filterId),this.implementation.uninstallFilter(this.filterId,function(){}),this.callbacks=[]},l.prototype.get=function(t){var e=this;if(!i.isFunction(t)){var n=this.implementation.getLogs(this.filterId);return n.map(function(t){return e.formatter?e.formatter(t):t})}return this.implementation.getLogs(this.filterId,function(n,r){n?t(n):t(null,r.map(function(t){return e.formatter?e.formatter(t):t}))}),this},e.exports=l},{"../utils/utils":7,"./formatters":18,"./requestmanager":28}],18:[function(t,e,n){var r=t("../utils/utils"),o=t("../utils/config"),i=function(t){return r.toBigNumber(t)},a=function(t){return"latest"===t||"pending"===t||"earliest"===t},s=function(t){return void 0===t?o.defaultBlock:u(t)},u=function(t){return void 0===t?void 0:a(t)?t:r.toHex(t)},c=function(t){return t.from=t.from||o.defaultAccount,t.code&&(t.data=t.code,delete t.code),["gasPrice","gas","value","nonce"].filter(function(e){return void 0!==t[e]}).forEach(function(e){t[e]=r.fromDecimal(t[e])}),t},l=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.nonce=r.toDecimal(t.nonce),t.gas=r.toDecimal(t.gas),t.gasPrice=r.toBigNumber(t.gasPrice),t.value=r.toBigNumber(t.value),t},p=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.cumulativeGasUsed=r.toDecimal(t.cumulativeGasUsed),t.gasUsed=r.toDecimal(t.gasUsed),r.isArray(t.logs)&&(t.logs=t.logs.map(function(t){return m(t)})),t},f=function(t){return t.gasLimit=r.toDecimal(t.gasLimit),t.gasUsed=r.toDecimal(t.gasUsed),t.size=r.toDecimal(t.size),t.timestamp=r.toDecimal(t.timestamp),null!==t.number&&(t.number=r.toDecimal(t.number)),t.difficulty=r.toBigNumber(t.difficulty),t.totalDifficulty=r.toBigNumber(t.totalDifficulty),r.isArray(t.transactions)&&t.transactions.forEach(function(t){return r.isString(t)?void 0:l(t)}),t},m=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),null!==t.logIndex&&(t.logIndex=r.toDecimal(t.logIndex)),t},h=function(t){return t.payload=r.toHex(t.payload),t.ttl=r.fromDecimal(t.ttl),t.workToProve=r.fromDecimal(t.workToProve),t.priority=r.fromDecimal(t.priority),r.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map(function(t){return r.fromAscii(t)}),t},d=function(t){return t.expiry=r.toDecimal(t.expiry),t.sent=r.toDecimal(t.sent),t.ttl=r.toDecimal(t.ttl),t.workProved=r.toDecimal(t.workProved),t.payloadRaw=t.payload,t.payload=r.toAscii(t.payload),r.isJson(t.payload)&&(t.payload=JSON.parse(t.payload)),t.topics||(t.topics=[]),t.topics=t.topics.map(function(t){return r.toAscii(t)}),t};e.exports={inputDefaultBlockNumberFormatter:s,inputBlockNumberFormatter:u,inputTransactionFormatter:c,inputPostFormatter:h,outputBigNumberFormatter:i,outputTransactionFormatter:l,outputTransactionReceiptFormatter:p,outputBlockFormatter:f,outputLogFormatter:m,outputPostFormatter:d}},{"../utils/config":5,"../utils/utils":7}],19:[function(t,e,n){var r=t("../web3"),o=t("../solidity/coder"),i=t("../utils/utils"),a=t("./formatters"),s=t("../utils/sha3"),u=function(t,e){this._inputTypes=t.inputs.map(function(t){return t.type}),this._outputTypes=t.outputs.map(function(t){return t.type}),this._constant=t.constant,this._name=i.transformToFullName(t),this._address=e};u.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},u.prototype.extractDefaultBlock=function(t){return t.length>this._inputTypes.length&&!i.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),o=this.toPayload(t);if(!e){var i=r.eth.call(o,n);return this.unpackOutput(i)}var a=this;r.eth.call(o,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{method:this._constant?"eth_call":"eth_sendTransaction",callback:e,params:[n],format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":18}],20:[function(t,e,n){"use strict";var r="undefined"!=typeof window&&window.XMLHttpRequest?window.XMLHttpRequest:t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.isConnected=function(){var t=new r;t.open("POST",this.host,!1),t.setRequestHeader("Content-type","application/json");try{return t.send(JSON.stringify({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]})),!0}catch(e){return!1; +require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"string",match:"strict",mode:"bytes",inputFormatter:i.formatInputString,outputFormatter:i.formatOutputString}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.padRight(o.toHex(t).substr(2),64);return new a(e)},c=function(t){t=o.toHex(t).substr(2);var e=Math.floor((t.length+63)/64),n=o.padRight(t,64*e),r=Math.floor(t.length/2);return new a(s(r).value+n,32)},l=function(t){var e=o.fromAscii(t).substr(2),n=Math.floor((e.length+63)/64);return e=o.padRight(e,64*n),new a(s(t.length).value+e,32)},p=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},f=function(t){return s(new r(t).times(new r(2).pow(128)))},m=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},h=function(t){var e=t.staticPart()||"0";return m(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},d=function(t){var e=t.staticPart()||"0";return new r(e,16)},y=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return d(t).dividedBy(new r(2).pow(128))},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},b=function(t){return"0x"+t.staticPart()},w=function(t){var e=2*new r(t.dynamicPart().slice(0,64),16).toNumber();return"0x"+t.dynamicPart().substr(64,e)},_=function(t){var e=2*new r(t.dynamicPart().slice(0,64),16).toNumber();return o.toAscii(t.dynamicPart().substr(64,e))},x=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputString:l,formatInputBool:p,formatInputReal:f,formatOutputInt:h,formatOutputUInt:d,formatOutputReal:y,formatOutputUReal:g,formatOutputBool:v,formatOutputBytes:b,formatOutputDynamicBytes:w,formatOutputString:_,formatOutputAddress:x}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return r=Math.floor((r+31)/32),new o(t.substr(2*n,64*(1+r)),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":34}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t,e,n){return t+new Array(e-t.length+1).join(n?n:"0")},s=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);e+=String.fromCharCode(o)}return e},u=function(t){for(var e="",n=0;n50){if(a.stopWatching(),i=!0,!n)throw new Error("Contract transaction couldn't be found after 50 blocks");n(new Error("Contract transaction couldn't be found after 50 blocks"))}else r.eth.getTransactionReceipt(t.transactionHash,function(o,s){s&&!i&&r.eth.getCode(s.contractAddress,function(r,o){if(!i)if(a.stopWatching(),i=!0,o.length>2)t.address=s.contractAddress,l(t,e),p(t,e),n&&n(null,t);else{if(!n)throw new Error("The contract code couldn't be stored, please check your gas amount.");n(new Error("The contract code couldn't be stored, please check your gas amount."))}})})})},h=function(t){this.abi=t};h.prototype["new"]=function(){var t,e=this,n=new d(this.abi),i={},a=Array.prototype.slice.call(arguments);o.isFunction(a[a.length-1])&&(t=a.pop());var s=a[a.length-1];o.isObject(s)&&!o.isArray(s)&&(i=a.pop());var u=c(this.abi,a);if(i.data+=u,t)r.eth.sendTransaction(i,function(r,o){r?t(r):(n.transactionHash=o,t(null,n),m(n,e.abi,t))});else{var l=r.eth.sendTransaction(i);n.transactionHash=l,m(n,e.abi)}return n},h.prototype.at=function(t,e){var n=new d(this.abi,t);return l(n,this.abi),p(n,this.abi),e&&e(null,n),n};var d=function(t,e){this.address=e};e.exports=f},{"../solidity/coder":1,"../utils/utils":7,"../web3":9,"./allevents":10,"./event":16,"./function":19}],13:[function(t,e,n){var r=t("./method"),o=new r({name:"putString",call:"db_putString",params:3}),i=new r({name:"getString",call:"db_getString",params:2}),a=new r({name:"putHex",call:"db_putHex",params:3}),s=new r({name:"getHex",call:"db_getHex",params:2}),u=[o,i,a,s];e.exports={methods:u}},{"./method":24}],14:[function(t,e,n){e.exports={InvalidNumberOfParams:function(){return new Error("Invalid number of input parameters")},InvalidConnection:function(t){return new Error("CONNECTION ERROR: Couldn't connect to node "+t+", is it running?")},InvalidProvider:function(){return new Error("Providor not set or invalid")},InvalidResponse:function(t){var e=t&&t.error&&t.error.message?t.error.message:"Invalid JSON RPC response: "+t;return new Error(e)}}},{}],15:[function(t,e,n){"use strict";var r=t("./formatters"),o=t("../utils/utils"),i=t("./method"),a=t("./property"),s=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},u=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},c=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},l=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},p=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},f=new i({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[o.toAddress,r.inputDefaultBlockNumberFormatter],outputFormatter:r.outputBigNumberFormatter}),m=new i({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[null,o.toHex,r.inputDefaultBlockNumberFormatter]}),h=new i({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.toAddress,r.inputDefaultBlockNumberFormatter]}),d=new i({name:"getBlock",call:s,params:2,inputFormatter:[r.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:r.outputBlockFormatter}),y=new i({name:"getUncle",call:c,params:2,inputFormatter:[r.inputBlockNumberFormatter,o.toHex],outputFormatter:r.outputBlockFormatter}),g=new i({name:"getCompilers",call:"eth_getCompilers",params:0}),v=new i({name:"getBlockTransactionCount",call:l,params:1,inputFormatter:[r.inputBlockNumberFormatter],outputFormatter:o.toDecimal}),b=new i({name:"getBlockUncleCount",call:p,params:1,inputFormatter:[r.inputBlockNumberFormatter],outputFormatter:o.toDecimal}),w=new i({name:"getTransaction",call:"eth_getTransactionByHash",params:1,outputFormatter:r.outputTransactionFormatter}),_=new i({name:"getTransactionFromBlock",call:u,params:2,inputFormatter:[r.inputBlockNumberFormatter,o.toHex],outputFormatter:r.outputTransactionFormatter}),x=new i({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,outputFormatter:r.outputTransactionReceiptFormatter}),F=new i({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[null,r.inputDefaultBlockNumberFormatter],outputFormatter:o.toDecimal}),I=new i({name:"sendRawTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null]}),k=new i({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[r.inputTransactionFormatter]}),B=new i({name:"call",call:"eth_call",params:2,inputFormatter:[r.inputTransactionFormatter,r.inputDefaultBlockNumberFormatter]}),T=new i({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[r.inputTransactionFormatter],outputFormatter:o.toDecimal}),N=new i({name:"compile.solidity",call:"eth_compileSolidity",params:1}),P=new i({name:"compile.lll",call:"eth_compileLLL",params:1}),O=new i({name:"compile.serpent",call:"eth_compileSerpent",params:1}),A=new i({name:"submitWork",call:"eth_submitWork",params:3}),C=new i({name:"getWork",call:"eth_getWork",params:0}),D=[f,m,h,d,y,g,v,b,w,_,x,F,B,T,I,k,N,P,O,A,C],S=[new a({name:"coinbase",getter:"eth_coinbase"}),new a({name:"mining",getter:"eth_mining"}),new a({name:"hashrate",getter:"eth_hashrate",outputFormatter:o.toDecimal}),new a({name:"gasPrice",getter:"eth_gasPrice",outputFormatter:r.outputBigNumberFormatter}),new a({name:"accounts",getter:"eth_accounts"}),new a({name:"blockNumber",getter:"eth_blockNumber",outputFormatter:o.toDecimal})];e.exports={methods:D,properties:S}},{"../utils/utils":7,"./formatters":18,"./method":24,"./property":27}],16:[function(t,e,n){var r=t("../utils/utils"),o=t("../solidity/coder"),i=t("./formatters"),a=t("../utils/sha3"),s=t("./filter"),u=t("./watches"),c=function(t,e){this._params=t.inputs,this._name=r.transformToFullName(t),this._address=e,this._anonymous=t.anonymous};c.prototype.types=function(t){return this._params.filter(function(e){return e.indexed===t}).map(function(t){return t.type})},c.prototype.displayName=function(){return r.extractDisplayName(this._name)},c.prototype.typeName=function(){return r.extractTypeName(this._name)},c.prototype.signature=function(){return a(this._name)},c.prototype.encode=function(t,e){t=t||{},e=e||{};var n={};["fromBlock","toBlock"].filter(function(t){return void 0!==e[t]}).forEach(function(t){n[t]=i.inputBlockNumberFormatter(e[t])}),n.topics=[],n.address=this._address,this._anonymous||n.topics.push("0x"+this.signature());var a=this._params.filter(function(t){return t.indexed===!0}).map(function(e){var n=t[e.name];return void 0===n||null===n?null:r.isArray(n)?n.map(function(t){return"0x"+o.encodeParam(e.type,t)}):"0x"+o.encodeParam(e.type,n)});return n.topics=n.topics.concat(a),n},c.prototype.decode=function(t){t.data=t.data||"",t.topics=t.topics||[];var e=this._anonymous?t.topics:t.topics.slice(1),n=e.map(function(t){return t.slice(2)}).join(""),r=o.decodeParams(this.types(!0),n),a=t.data.slice(2),s=o.decodeParams(this.types(!1),a),u=i.outputLogFormatter(t);return u.event=this.displayName(),u.address=t.address,u.args=this._params.reduce(function(t,e){return t[e.name]=e.indexed?r.shift():s.shift(),t},{}),delete u.data,delete u.topics,u},c.prototype.execute=function(t,e,n){r.isFunction(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],2===arguments.length&&(e=null),1===arguments.length&&(e=null,t={}));var o=this.encode(t,e),i=this.decode.bind(this);return new s(o,u.eth(),i,n)},c.prototype.attachToContract=function(t){var e=this.execute.bind(this),n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=this.execute.bind(this,t)},e.exports=c},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"./filter":17,"./formatters":18,"./watches":31}],17:[function(t,e,n){var r=t("./requestmanager"),o=t("./formatters"),i=t("../utils/utils"),a=function(t){return null===t||"undefined"==typeof t?null:(t=String(t),0===t.indexOf("0x")?t:i.fromAscii(t))},s=function(t){return i.isString(t)?t:(t=t||{},t.topics=t.topics||[],t.topics=t.topics.map(function(t){return i.isArray(t)?t.map(a):a(t)}),{topics:t.topics,to:t.to,address:t.address,fromBlock:o.inputBlockNumberFormatter(t.fromBlock),toBlock:o.inputBlockNumberFormatter(t.toBlock)})},u=function(t,e){i.isString(t.options)||t.get(function(t,n){t&&e(t),i.isArray(n)&&n.forEach(function(t){e(null,t)})})},c=function(t){var e=function(e,n){return e?t.callbacks.forEach(function(t){t(e)}):void n.forEach(function(e){e=t.formatter?t.formatter(e):e,t.callbacks.forEach(function(t){t(null,e)})})};r.getInstance().startPolling({method:t.implementation.poll.call,params:[t.filterId]},t.filterId,e,t.stopWatching.bind(t))},l=function(t,e,n,r){var o=this,i={};e.forEach(function(t){t.attachToObject(i)}),this.options=s(t),this.implementation=i,this.filterId=null,this.callbacks=[],this.pollFilters=[],this.formatter=n,this.implementation.newFilter(this.options,function(t,e){if(t)o.callbacks.forEach(function(e){e(t)});else if(o.filterId=e,o.callbacks.forEach(function(t){u(o,t)}),o.callbacks.length>0&&c(o),r)return o.watch(r)})};l.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(u(this,t),c(this)),this},l.prototype.stopWatching=function(){r.getInstance().stopPolling(this.filterId),this.implementation.uninstallFilter(this.filterId,function(){}),this.callbacks=[]},l.prototype.get=function(t){var e=this;if(!i.isFunction(t)){var n=this.implementation.getLogs(this.filterId);return n.map(function(t){return e.formatter?e.formatter(t):t})}return this.implementation.getLogs(this.filterId,function(n,r){n?t(n):t(null,r.map(function(t){return e.formatter?e.formatter(t):t}))}),this},e.exports=l},{"../utils/utils":7,"./formatters":18,"./requestmanager":28}],18:[function(t,e,n){var r=t("../utils/utils"),o=t("../utils/config"),i=function(t){return r.toBigNumber(t)},a=function(t){return"latest"===t||"pending"===t||"earliest"===t},s=function(t){return void 0===t?o.defaultBlock:u(t)},u=function(t){return void 0===t?void 0:a(t)?t:r.toHex(t)},c=function(t){return t.from=t.from||o.defaultAccount,t.code&&(t.data=t.code,delete t.code),["gasPrice","gas","value","nonce"].filter(function(e){return void 0!==t[e]}).forEach(function(e){t[e]=r.fromDecimal(t[e])}),t},l=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.nonce=r.toDecimal(t.nonce),t.gas=r.toDecimal(t.gas),t.gasPrice=r.toBigNumber(t.gasPrice),t.value=r.toBigNumber(t.value),t},p=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.cumulativeGasUsed=r.toDecimal(t.cumulativeGasUsed),t.gasUsed=r.toDecimal(t.gasUsed),r.isArray(t.logs)&&(t.logs=t.logs.map(function(t){return m(t)})),t},f=function(t){return t.gasLimit=r.toDecimal(t.gasLimit),t.gasUsed=r.toDecimal(t.gasUsed),t.size=r.toDecimal(t.size),t.timestamp=r.toDecimal(t.timestamp),null!==t.number&&(t.number=r.toDecimal(t.number)),t.difficulty=r.toBigNumber(t.difficulty),t.totalDifficulty=r.toBigNumber(t.totalDifficulty),r.isArray(t.transactions)&&t.transactions.forEach(function(t){return r.isString(t)?void 0:l(t)}),t},m=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),null!==t.logIndex&&(t.logIndex=r.toDecimal(t.logIndex)),t},h=function(t){return t.payload=r.toHex(t.payload),t.ttl=r.fromDecimal(t.ttl),t.workToProve=r.fromDecimal(t.workToProve),t.priority=r.fromDecimal(t.priority),r.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map(function(t){return r.fromAscii(t)}),t},d=function(t){return t.expiry=r.toDecimal(t.expiry),t.sent=r.toDecimal(t.sent),t.ttl=r.toDecimal(t.ttl),t.workProved=r.toDecimal(t.workProved),t.payloadRaw=t.payload,t.payload=r.toAscii(t.payload),r.isJson(t.payload)&&(t.payload=JSON.parse(t.payload)),t.topics||(t.topics=[]),t.topics=t.topics.map(function(t){return r.toAscii(t)}),t};e.exports={inputDefaultBlockNumberFormatter:s,inputBlockNumberFormatter:u,inputTransactionFormatter:c,inputPostFormatter:h,outputBigNumberFormatter:i,outputTransactionFormatter:l,outputTransactionReceiptFormatter:p,outputBlockFormatter:f,outputLogFormatter:m,outputPostFormatter:d}},{"../utils/config":5,"../utils/utils":7}],19:[function(t,e,n){var r=t("../web3"),o=t("../solidity/coder"),i=t("../utils/utils"),a=t("./formatters"),s=t("../utils/sha3"),u=function(t,e){this._inputTypes=t.inputs.map(function(t){return t.type}),this._outputTypes=t.outputs.map(function(t){return t.type}),this._constant=t.constant,this._name=i.transformToFullName(t),this._address=e};u.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},u.prototype.extractDefaultBlock=function(t){return t.length>this._inputTypes.length&&!i.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),o=this.toPayload(t);if(!e){var i=r.eth.call(o,n);return this.unpackOutput(i)}var a=this;r.eth.call(o,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{method:this._constant?"eth_call":"eth_sendTransaction",callback:e,params:[n],format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":18}],20:[function(t,e,n){"use strict";var r="undefined"!=typeof window&&window.XMLHttpRequest?window.XMLHttpRequest:t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.isConnected=function(){var t=new r;t.open("POST",this.host,!1),t.setRequestHeader("Content-type","application/json");try{return t.send(JSON.stringify({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]})),!0}catch(e){return!1; -}},i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(e.responseText)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(n.responseText)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":14,xmlhttprequest:4}],21:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],22:[function(t,e,n){"use strict";var r=t("../utils/utils"),o=t("./errors"),i='{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}',a=function(e,n){var o=this;this.responseCallbacks={},this.path=e,n=n||t("net"),this.connection=n.connect({path:this.path}),this.connection.on("error",function(t){console.error("IPC Connection Error",t),o._timeout()}),this.connection.on("end",function(){o._timeout()}),this.connection.on("data",function(t){o._parseResponse(t.toString()).forEach(function(t){var e=null;r.isArray(t)?t.forEach(function(t){o.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,o.responseCallbacks[e]&&(o.responseCallbacks[e](null,t),delete o.responseCallbacks[e])})})};a.prototype._parseResponse=function(t){var e=this,n=[],r=t.replace(/\}\{/g,"}|--|{").replace(/\}\]\[\{/g,"}]|--|[{").replace(/\}\[\{/g,"}|--|[{").replace(/\}\]\{/g,"}]|--|{").split("|--|");return r.forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var r=null;try{r=JSON.parse(t)}catch(i){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e.timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,r&&n.push(r)}),n},a.prototype._addResponseCallback=function(t,e){var n=t.id||t[0].id,r=t.method||t[0].method;this.responseCallbacks[n]=e,this.responseCallbacks[n].method=r},a.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.replace("__id__",t).replace("__method__",this.responseCallbacks[t].method)),delete this.responseCallbacks[t])},a.prototype.isConnected=function(){var t=this;return t.connection.writable||t.connection.connect({path:t.path}),!!this.connection.writable},a.prototype.send=function(t){if(this.connection.writeSync){var e;this.connection.writable||this.connection.connect({path:this.path});var n=this.connection.writeSync(JSON.stringify(t));try{e=JSON.parse(n)}catch(r){throw o.InvalidResponse(n)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},a.prototype.sendAsync=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},e.exports=a},{"../utils/utils":7,"./errors":14,net:32}],23:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],24:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":14,"./requestmanager":28}],25:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":12}],26:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":27}],27:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},i=this.getAsync.bind(this);i.request=this.request.bind(this),t[o("get",r)]=i},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},i.prototype.request=function(){var t={method:this.getter,params:[],callback:this.extractCallback(Array.prototype.slice.call(arguments))};return t.format=this.formatOutput.bind(this),t},e.exports=i},{"../utils/utils":7,"./requestmanager":28}],28:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":14,"./jsonrpc":23}],29:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[i,a,s,u,c];e.exports={methods:l}},{"./formatters":18,"./method":24}],30:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":12,"./icap":21,"./namereg":25}],31:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":24}],32:[function(t,e,n){},{}],33:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var p=0;c>p;p+=a)this._doProcessBlock(r,p);var f=r.splice(0,c);n.sigBytes-=l}return new i.init(f,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],34:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],p=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,f=0,m=0;7>m;m++){if(1&i){var h=(1<h?f^=1<t;t++)f[t]=s.create()}();var m=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var m=0;5>m;m++){for(var h=0,d=0,y=0;5>y;y++){var s=n[m+5*y];h^=s.high,d^=s.low}var g=f[m];g.high=h,g.low=d}for(var m=0;5>m;m++)for(var v=f[(m+4)%5],b=f[(m+1)%5],w=b.high,_=b.low,h=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),y=0;5>y;y++){var s=n[m+5*y];s.high^=h,s.low^=d}for(var x=1;25>x;x++){var s=n[x],I=s.high,F=s.low,k=c[x];if(32>k)var h=I<>>32-k,d=F<>>32-k;else var h=F<>>64-k,d=I<>>64-k;var B=f[l[x]];B.high=h,B.low=d}var T=f[0],N=n[0];T.high=N.high,T.low=N.low;for(var m=0;5>m;m++)for(var y=0;5>y;y++){var x=m+5*y,s=n[x],P=f[x],O=f[(m+1)%5+5*y],A=f[(m+2)%5+5*y];s.high=P.high^~O.high&A.high,s.low=P.low^~O.low&A.low}var s=n[0],C=p[u];s.high^=C.high,s.low^=C.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var p=a[l],f=p.high,m=p.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),c.push(m),c.push(f)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(m),n.HmacSHA3=i._createHmacHelper(m)}(Math),t.SHA3})},{"./core":33,"./x64-core":35}],35:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":33}],"bignumber.js":[function(t,e,n){"use strict";e.exports=BigNumber},{}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.IpcProvider=t("./lib/web3/ipcprovider"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":12,"./lib/web3/httpprovider":20,"./lib/web3/ipcprovider":22,"./lib/web3/namereg":25,"./lib/web3/transfer":30}]},{},["web3"]); \ No newline at end of file +}},i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(e.responseText)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(n.responseText)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":14,xmlhttprequest:4}],21:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],22:[function(t,e,n){"use strict";var r=t("../utils/utils"),o=t("./errors"),i='{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}',a=function(e,n){var o=this;this.responseCallbacks={},this.path=e,n=n||t("net"),this.connection=n.connect({path:this.path}),this.connection.on("error",function(t){console.error("IPC Connection Error",t),o._timeout()}),this.connection.on("end",function(){o._timeout()}),this.connection.on("data",function(t){o._parseResponse(t.toString()).forEach(function(t){var e=null;r.isArray(t)?t.forEach(function(t){o.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,o.responseCallbacks[e]&&(o.responseCallbacks[e](null,t),delete o.responseCallbacks[e])})})};a.prototype._parseResponse=function(t){var e=this,n=[],r=t.replace(/\}\{/g,"}|--|{").replace(/\}\]\[\{/g,"}]|--|[{").replace(/\}\[\{/g,"}|--|[{").replace(/\}\]\{/g,"}]|--|{").split("|--|");return r.forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var r=null;try{r=JSON.parse(t)}catch(i){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e.timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,r&&n.push(r)}),n},a.prototype._addResponseCallback=function(t,e){var n=t.id||t[0].id,r=t.method||t[0].method;this.responseCallbacks[n]=e,this.responseCallbacks[n].method=r},a.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.replace("__id__",t).replace("__method__",this.responseCallbacks[t].method)),delete this.responseCallbacks[t])},a.prototype.isConnected=function(){var t=this;return t.connection.writable||t.connection.connect({path:t.path}),!!this.connection.writable},a.prototype.send=function(t){if(this.connection.writeSync){var e;this.connection.writable||this.connection.connect({path:this.path});var n=this.connection.writeSync(JSON.stringify(t));try{e=JSON.parse(n)}catch(r){throw o.InvalidResponse(n)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},a.prototype.sendAsync=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},e.exports=a},{"../utils/utils":7,"./errors":14,net:32}],23:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],24:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":14,"./requestmanager":28}],25:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":12}],26:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":27}],27:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},i=this.getAsync.bind(this);i.request=this.request.bind(this),t[o("get",r)]=i},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},i.prototype.request=function(){var t={method:this.getter,params:[],callback:this.extractCallback(Array.prototype.slice.call(arguments))};return t.format=this.formatOutput.bind(this),t},e.exports=i},{"../utils/utils":7,"./requestmanager":28}],28:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":14,"./jsonrpc":23}],29:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=new r({name:"newFilter",call:"shh_newFilter",params:1}),p=new r({name:"getFilterChanges",call:"shh_getFilterChanges",params:1}),f=new r({name:"getMessages",call:"shh_getMessages",params:1}),m=[i,a,s,u,c,l,p,f];e.exports={methods:m}},{"./formatters":18,"./method":24}],30:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":12,"./icap":21,"./namereg":25}],31:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":24}],32:[function(t,e,n){},{}],33:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var p=0;c>p;p+=a)this._doProcessBlock(r,p);var f=r.splice(0,c);n.sigBytes-=l}return new i.init(f,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],34:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],p=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,f=0,m=0;7>m;m++){if(1&i){var h=(1<h?f^=1<t;t++)f[t]=s.create()}();var m=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var m=0;5>m;m++){for(var h=0,d=0,y=0;5>y;y++){var s=n[m+5*y];h^=s.high,d^=s.low}var g=f[m];g.high=h,g.low=d}for(var m=0;5>m;m++)for(var v=f[(m+4)%5],b=f[(m+1)%5],w=b.high,_=b.low,h=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),y=0;5>y;y++){var s=n[m+5*y];s.high^=h,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,k=c[x];if(32>k)var h=F<>>32-k,d=I<>>32-k;else var h=I<>>64-k,d=F<>>64-k;var B=f[l[x]];B.high=h,B.low=d}var T=f[0],N=n[0];T.high=N.high,T.low=N.low;for(var m=0;5>m;m++)for(var y=0;5>y;y++){var x=m+5*y,s=n[x],P=f[x],O=f[(m+1)%5+5*y],A=f[(m+2)%5+5*y];s.high=P.high^~O.high&A.high,s.low=P.low^~O.low&A.low}var s=n[0],C=p[u];s.high^=C.high,s.low^=C.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var p=a[l],f=p.high,m=p.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),c.push(m),c.push(f)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(m),n.HmacSHA3=i._createHmacHelper(m)}(Math),t.SHA3})},{"./core":33,"./x64-core":35}],35:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":33}],"bignumber.js":[function(t,e,n){"use strict";e.exports=BigNumber},{}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.IpcProvider=t("./lib/web3/ipcprovider"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":12,"./lib/web3/httpprovider":20,"./lib/web3/ipcprovider":22,"./lib/web3/namereg":25,"./lib/web3/transfer":30}]},{},["web3"]); \ No newline at end of file diff --git a/libjsqrc/ethereumjs/dist/web3.js b/libjsqrc/ethereumjs/dist/web3.js index 7882ccd81c3..2cfe25751db 100644 --- a/libjsqrc/ethereumjs/dist/web3.js +++ b/libjsqrc/ethereumjs/dist/web3.js @@ -4577,12 +4577,34 @@ var addToGroup = new Method({ params: 0 }); + +var newFilter = new Method({ + name: 'newFilter', + call: 'shh_newFilter', + params: 1 +}); + +var getFilterChanges = new Method({ + name: 'getFilterChanges', + call: 'shh_getFilterChanges', + params: 1 +}); + +var getMessages = new Method({ + name: 'getMessages', + call: 'shh_getMessages', + params: 1 +}) + var methods = [ post, newIdentity, hasIdentity, newGroup, - addToGroup + addToGroup, + newFilter, + getFilterChanges, + getMessages ]; module.exports = { diff --git a/libjsqrc/ethereumjs/dist/web3.js.map b/libjsqrc/ethereumjs/dist/web3.js.map index 1343e68d6e6..ceaaeda9626 100644 --- a/libjsqrc/ethereumjs/dist/web3.js.map +++ b/libjsqrc/ethereumjs/dist/web3.js.map @@ -41,7 +41,7 @@ "index.js" ], "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9fA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACruBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3nFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9fA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACruBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3nFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ @@ -74,7 +74,7 @@ "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file eth.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar utils = require('../utils/utils');\nvar Property = require('./property');\n\n/// @returns an array of objects describing web3.eth api methods\nvar methods = [\n];\n\n/// @returns an array of objects describing web3.eth api properties\nvar properties = [\n new Property({\n name: 'listening',\n getter: 'net_listening'\n }),\n new Property({\n name: 'peerCount',\n getter: 'net_peerCount',\n outputFormatter: utils.toDecimal\n })\n];\n\n\nmodule.exports = {\n methods: methods,\n properties: properties\n};\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file property.js\n * @author Fabian Vogelsteller \n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar RequestManager = require('./requestmanager');\nvar utils = require('../utils/utils');\n\nvar Property = function (options) {\n this.name = options.name;\n this.getter = options.getter;\n this.setter = options.setter;\n this.outputFormatter = options.outputFormatter;\n this.inputFormatter = options.inputFormatter;\n};\n\n/**\n * Should be called to format input args of method\n * \n * @method formatInput\n * @param {Array}\n * @return {Array}\n */\nProperty.prototype.formatInput = function (arg) {\n return this.inputFormatter ? this.inputFormatter(arg) : arg;\n};\n\n/**\n * Should be called to format output(result) of method\n *\n * @method formatOutput\n * @param {Object}\n * @return {Object}\n */\nProperty.prototype.formatOutput = function (result) {\n return this.outputFormatter && result !== null ? this.outputFormatter(result) : result;\n};\n\n/**\n * Should be used to extract callback from array of arguments. Modifies input param\n *\n * @method extractCallback\n * @param {Array} arguments\n * @return {Function|Null} callback, if exists\n */\nProperty.prototype.extractCallback = function (args) {\n if (utils.isFunction(args[args.length - 1])) {\n return args.pop(); // modify the args array!\n }\n};\n\n/**\n * Should attach function to method\n * \n * @method attachToObject\n * @param {Object}\n * @param {Function}\n */\nProperty.prototype.attachToObject = function (obj) {\n var proto = {\n get: this.get.bind(this),\n };\n\n var names = this.name.split('.');\n var name = names[0];\n if (names.length > 1) {\n obj[names[0]] = obj[names[0]] || {};\n obj = obj[names[0]];\n name = names[1];\n }\n \n Object.defineProperty(obj, name, proto);\n\n var toAsyncName = function (prefix, name) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n };\n\n var func = this.getAsync.bind(this);\n func.request = this.request.bind(this);\n\n obj[toAsyncName('get', name)] = func;\n};\n\n/**\n * Should be used to get value of the property\n *\n * @method get\n * @return {Object} value of the property\n */\nProperty.prototype.get = function () {\n return this.formatOutput(RequestManager.getInstance().send({\n method: this.getter\n }));\n};\n\n/**\n * Should be used to asynchrounously get value of property\n *\n * @method getAsync\n * @param {Function}\n */\nProperty.prototype.getAsync = function (callback) {\n var self = this;\n RequestManager.getInstance().sendAsync({\n method: this.getter\n }, function (err, result) {\n if (err) {\n return callback(err);\n }\n callback(err, self.formatOutput(result));\n });\n};\n\n/**\n * Should be called to create pure JSONRPC request which can be used in batch request\n *\n * @method request\n * @param {...} params\n * @return {Object} jsonrpc request\n */\nProperty.prototype.request = function () {\n var payload = {\n method: this.getter,\n params: [],\n callback: this.extractCallback(Array.prototype.slice.call(arguments))\n };\n payload.format = this.formatOutput.bind(this);\n return payload;\n};\n\nmodule.exports = Property;\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file requestmanager.js\n * @author Jeffrey Wilcke \n * @author Marek Kotewicz \n * @author Marian Oancea \n * @author Fabian Vogelsteller \n * @author Gav Wood \n * @date 2014\n */\n\nvar Jsonrpc = require('./jsonrpc');\nvar utils = require('../utils/utils');\nvar c = require('../utils/config');\nvar errors = require('./errors');\n\n/**\n * It's responsible for passing messages to providers\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 1 second\n * Singleton\n */\nvar RequestManager = function (provider) {\n // singleton pattern\n if (arguments.callee._singletonInstance) {\n return arguments.callee._singletonInstance;\n }\n arguments.callee._singletonInstance = this;\n\n this.provider = provider;\n this.polls = {};\n this.timeout = null;\n this.isPolling = false;\n};\n\n/**\n * @return {RequestManager} singleton\n */\nRequestManager.getInstance = function () {\n var instance = new RequestManager();\n return instance;\n};\n\n/**\n * Should be used to synchronously send request\n *\n * @method send\n * @param {Object} data\n * @return {Object}\n */\nRequestManager.prototype.send = function (data) {\n if (!this.provider) {\n console.error(errors.InvalidProvider());\n return null;\n }\n\n var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);\n var result = this.provider.send(payload);\n\n if (!Jsonrpc.getInstance().isValidResponse(result)) {\n throw errors.InvalidResponse(result);\n }\n\n return result.result;\n};\n\n/**\n * Should be used to asynchronously send request\n *\n * @method sendAsync\n * @param {Object} data\n * @param {Function} callback\n */\nRequestManager.prototype.sendAsync = function (data, callback) {\n if (!this.provider) {\n return callback(errors.InvalidProvider());\n }\n\n var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);\n this.provider.sendAsync(payload, function (err, result) {\n if (err) {\n return callback(err);\n }\n \n if (!Jsonrpc.getInstance().isValidResponse(result)) {\n return callback(errors.InvalidResponse(result));\n }\n\n callback(null, result.result);\n });\n};\n\n/**\n * Should be called to asynchronously send batch request\n *\n * @method sendBatch\n * @param {Array} batch data\n * @param {Function} callback\n */\nRequestManager.prototype.sendBatch = function (data, callback) {\n if (!this.provider) {\n return callback(errors.InvalidProvider());\n }\n\n var payload = Jsonrpc.getInstance().toBatchPayload(data);\n\n this.provider.sendAsync(payload, function (err, results) {\n if (err) {\n return callback(err);\n }\n\n if (!utils.isArray(results)) {\n return callback(errors.InvalidResponse(results));\n }\n\n callback(err, results);\n }); \n};\n\n/**\n * Should be used to set provider of request manager\n *\n * @method setProvider\n * @param {Object}\n */\nRequestManager.prototype.setProvider = function (p) {\n this.provider = p;\n\n if (this.provider && !this.isPolling) {\n this.poll();\n this.isPolling = true;\n }\n};\n\n/*jshint maxparams:4 */\n\n/**\n * Should be used to start polling\n *\n * @method startPolling\n * @param {Object} data\n * @param {Number} pollId\n * @param {Function} callback\n * @param {Function} uninstall\n *\n * @todo cleanup number of params\n */\nRequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) {\n this.polls['poll_'+ pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall};\n};\n/*jshint maxparams:3 */\n\n/**\n * Should be used to stop polling for filter with given id\n *\n * @method stopPolling\n * @param {Number} pollId\n */\nRequestManager.prototype.stopPolling = function (pollId) {\n delete this.polls['poll_'+ pollId];\n};\n\n/**\n * Should be called to reset the polling mechanism of the request manager\n *\n * @method reset\n */\nRequestManager.prototype.reset = function () {\n for (var key in this.polls) {\n this.polls[key].uninstall();\n }\n this.polls = {};\n\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n this.poll();\n};\n\n/**\n * Should be called to poll for changes on filter with given id\n *\n * @method poll\n */\nRequestManager.prototype.poll = function () {\n /*jshint maxcomplexity: 6 */\n this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);\n\n if (Object.keys(this.polls).length === 0) {\n return;\n }\n\n if (!this.provider) {\n console.error(errors.InvalidProvider());\n return;\n }\n\n var pollsData = [];\n var pollsKeys = [];\n for (var key in this.polls) {\n pollsData.push(this.polls[key].data);\n pollsKeys.push(key);\n }\n\n if (pollsData.length === 0) {\n return;\n }\n\n var payload = Jsonrpc.getInstance().toBatchPayload(pollsData);\n\n var self = this;\n this.provider.sendAsync(payload, function (error, results) {\n // TODO: console log?\n if (error) {\n return;\n }\n\n if (!utils.isArray(results)) {\n throw errors.InvalidResponse(results);\n }\n\n results.map(function (result, index) {\n var key = pollsKeys[index];\n // make sure the filter is still installed after arrival of the request\n if (self.polls[key]) {\n result.callback = self.polls[key].callback;\n return result;\n } else\n return false;\n }).filter(function (result) {\n return !!result; \n }).filter(function (result) {\n var valid = Jsonrpc.getInstance().isValidResponse(result);\n if (!valid) {\n result.callback(errors.InvalidResponse(result));\n }\n return valid;\n }).filter(function (result) {\n return utils.isArray(result.result) && result.result.length > 0;\n }).forEach(function (result) {\n result.callback(null, result.result);\n });\n });\n};\n\nmodule.exports = RequestManager;\n\n", - "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file shh.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\nvar formatters = require('./formatters');\n\nvar post = new Method({\n name: 'post', \n call: 'shh_post', \n params: 1,\n inputFormatter: [formatters.inputPostFormatter]\n});\n\nvar newIdentity = new Method({\n name: 'newIdentity',\n call: 'shh_newIdentity',\n params: 0\n});\n\nvar hasIdentity = new Method({\n name: 'hasIdentity',\n call: 'shh_hasIdentity',\n params: 1\n});\n\nvar newGroup = new Method({\n name: 'newGroup',\n call: 'shh_newGroup',\n params: 0\n});\n\nvar addToGroup = new Method({\n name: 'addToGroup',\n call: 'shh_addToGroup',\n params: 0\n});\n\nvar methods = [\n post,\n newIdentity,\n hasIdentity,\n newGroup,\n addToGroup\n];\n\nmodule.exports = {\n methods: methods\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file shh.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\nvar formatters = require('./formatters');\n\nvar post = new Method({\n name: 'post', \n call: 'shh_post', \n params: 1,\n inputFormatter: [formatters.inputPostFormatter]\n});\n\nvar newIdentity = new Method({\n name: 'newIdentity',\n call: 'shh_newIdentity',\n params: 0\n});\n\nvar hasIdentity = new Method({\n name: 'hasIdentity',\n call: 'shh_hasIdentity',\n params: 1\n});\n\nvar newGroup = new Method({\n name: 'newGroup',\n call: 'shh_newGroup',\n params: 0\n});\n\nvar addToGroup = new Method({\n name: 'addToGroup',\n call: 'shh_addToGroup',\n params: 0\n});\n\n\nvar newFilter = new Method({\n name: 'newFilter',\n call: 'shh_newFilter',\n params: 1\n});\n\nvar getFilterChanges = new Method({\n name: 'getFilterChanges',\n call: 'shh_getFilterChanges',\n params: 1\n});\n\nvar getMessages = new Method({\n name: 'getMessages',\n call: 'shh_getMessages',\n params: 1\n})\n\nvar methods = [\n post,\n newIdentity,\n hasIdentity,\n newGroup,\n addToGroup,\n newFilter,\n getFilterChanges,\n getMessages\n];\n\nmodule.exports = {\n methods: methods\n};\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file transfer.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar web3 = require('../web3');\nvar ICAP = require('./icap');\nvar namereg = require('./namereg');\nvar contract = require('./contract');\n\n/**\n * Should be used to make ICAP transfer\n *\n * @method transfer\n * @param {String} iban number\n * @param {String} from (address)\n * @param {Value} value to be tranfered\n * @param {Function} callback, callback\n */\nvar transfer = function (from, iban, value, callback) {\n var icap = new ICAP(iban); \n if (!icap.isValid()) {\n throw new Error('invalid iban address');\n }\n\n if (icap.isDirect()) {\n return transferToAddress(from, icap.address(), value, callback);\n }\n \n if (!callback) {\n var address = namereg.addr(icap.institution());\n return deposit(from, address, value, icap.client());\n }\n\n namereg.addr(icap.insitution(), function (err, address) {\n return deposit(from, address, value, icap.client(), callback);\n });\n \n};\n\n/**\n * Should be used to transfer funds to certain address\n *\n * @method transferToAddress\n * @param {String} address\n * @param {String} from (address)\n * @param {Value} value to be tranfered\n * @param {Function} callback, callback\n */\nvar transferToAddress = function (from, address, value, callback) {\n return web3.eth.sendTransaction({\n address: address,\n from: from,\n value: value\n }, callback);\n};\n\n/**\n * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!)\n *\n * @method deposit\n * @param {String} address\n * @param {String} from (address)\n * @param {Value} value to be tranfered\n * @param {String} client unique identifier\n * @param {Function} callback, callback\n */\nvar deposit = function (from, address, value, client, callback) {\n var abi = [{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"deposit\",\"outputs\":[],\"type\":\"function\"}];\n return contract(abi).at(address).deposit(client, {\n from: from,\n value: value\n }, callback);\n};\n\nmodule.exports = transfer;\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file watches.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\n\n/// @returns an array of objects describing web3.eth.filter api methods\nvar eth = function () {\n var newFilterCall = function (args) {\n var type = args[0];\n\n switch(type) {\n case 'latest':\n args.shift();\n this.params = 0;\n return 'eth_newBlockFilter';\n case 'pending':\n args.shift();\n this.params = 0;\n return 'eth_newPendingTransactionFilter';\n default:\n return 'eth_newFilter';\n }\n };\n\n var newFilter = new Method({\n name: 'newFilter',\n call: newFilterCall,\n params: 1\n });\n\n var uninstallFilter = new Method({\n name: 'uninstallFilter',\n call: 'eth_uninstallFilter',\n params: 1\n });\n\n var getLogs = new Method({\n name: 'getLogs',\n call: 'eth_getFilterLogs',\n params: 1\n });\n\n var poll = new Method({\n name: 'poll',\n call: 'eth_getFilterChanges',\n params: 1\n });\n\n return [\n newFilter,\n uninstallFilter,\n getLogs,\n poll\n ];\n};\n\n/// @returns an array of objects describing web3.shh.watch api methods\nvar shh = function () {\n var newFilter = new Method({\n name: 'newFilter',\n call: 'shh_newFilter',\n params: 1\n });\n\n var uninstallFilter = new Method({\n name: 'uninstallFilter',\n call: 'shh_uninstallFilter',\n params: 1\n });\n\n var getLogs = new Method({\n name: 'getLogs',\n call: 'shh_getMessages',\n params: 1\n });\n\n var poll = new Method({\n name: 'poll',\n call: 'shh_getFilterChanges',\n params: 1\n });\n\n return [\n newFilter,\n uninstallFilter,\n getLogs,\n poll\n ];\n};\n\nmodule.exports = {\n eth: eth,\n shh: shh\n};\n\n", null, diff --git a/libjsqrc/ethereumjs/dist/web3.min.js b/libjsqrc/ethereumjs/dist/web3.min.js index 14a3dc353fc..39ca2d47a1b 100644 --- a/libjsqrc/ethereumjs/dist/web3.min.js +++ b/libjsqrc/ethereumjs/dist/web3.min.js @@ -1,4 +1,4 @@ require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"string",match:"strict",mode:"bytes",inputFormatter:i.formatInputString,outputFormatter:i.formatOutputString}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.padRight(o.toHex(t).substr(2),64);return new a(e)},c=function(t){t=o.toHex(t).substr(2);var e=Math.floor((t.length+63)/64),n=o.padRight(t,64*e),r=Math.floor(t.length/2);return new a(s(r).value+n,32)},l=function(t){var e=o.fromAscii(t).substr(2),n=Math.floor((e.length+63)/64);return e=o.padRight(e,64*n),new a(s(t.length).value+e,32)},f=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},p=function(t){return s(new r(t).times(new r(2).pow(128)))},h=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},m=function(t){var e=t.staticPart()||"0";return h(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},d=function(t){var e=t.staticPart()||"0";return new r(e,16)},g=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return d(t).dividedBy(new r(2).pow(128))},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},b=function(t){return"0x"+t.staticPart()},w=function(t){var e=2*new r(t.dynamicPart().slice(0,64),16).toNumber();return"0x"+t.dynamicPart().substr(64,e)},_=function(t){var e=2*new r(t.dynamicPart().slice(0,64),16).toNumber();return o.toAscii(t.dynamicPart().substr(64,e))},x=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputString:l,formatInputBool:f,formatInputReal:p,formatOutputInt:m,formatOutputUInt:d,formatOutputReal:g,formatOutputUReal:y,formatOutputBool:v,formatOutputBytes:b,formatOutputDynamicBytes:w,formatOutputString:_,formatOutputAddress:x}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return r=Math.floor((r+31)/32),new o(t.substr(2*n,64*(1+r)),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":34}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t,e,n){return t+new Array(e-t.length+1).join(n?n:"0")},s=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);e+=String.fromCharCode(o)}return e},u=function(t){for(var e="",n=0;n50){if(a.stopWatching(),i=!0,!n)throw new Error("Contract transaction couldn't be found after 50 blocks");n(new Error("Contract transaction couldn't be found after 50 blocks"))}else r.eth.getTransactionReceipt(t.transactionHash,function(o,s){s&&!i&&r.eth.getCode(s.contractAddress,function(r,o){if(!i)if(a.stopWatching(),i=!0,o.length>2)t.address=s.contractAddress,l(t,e),f(t,e),n&&n(null,t);else{if(!n)throw new Error("The contract code couldn't be stored, please check your gas amount.");n(new Error("The contract code couldn't be stored, please check your gas amount."))}})})})},m=function(t){this.abi=t};m.prototype["new"]=function(){var t,e=this,n=new d(this.abi),i={},a=Array.prototype.slice.call(arguments);o.isFunction(a[a.length-1])&&(t=a.pop());var s=a[a.length-1];o.isObject(s)&&!o.isArray(s)&&(i=a.pop());var u=c(this.abi,a);if(i.data+=u,t)r.eth.sendTransaction(i,function(r,o){r?t(r):(n.transactionHash=o,t(null,n),h(n,e.abi,t))});else{var l=r.eth.sendTransaction(i);n.transactionHash=l,h(n,e.abi)}return n},m.prototype.at=function(t,e){var n=new d(this.abi,t);return l(n,this.abi),f(n,this.abi),e&&e(null,n),n};var d=function(t,e){this.address=e};e.exports=p},{"../solidity/coder":1,"../utils/utils":7,"../web3":9,"./allevents":10,"./event":16,"./function":19}],13:[function(t,e,n){var r=t("./method"),o=new r({name:"putString",call:"db_putString",params:3}),i=new r({name:"getString",call:"db_getString",params:2}),a=new r({name:"putHex",call:"db_putHex",params:3}),s=new r({name:"getHex",call:"db_getHex",params:2}),u=[o,i,a,s];e.exports={methods:u}},{"./method":24}],14:[function(t,e,n){e.exports={InvalidNumberOfParams:function(){return new Error("Invalid number of input parameters")},InvalidConnection:function(t){return new Error("CONNECTION ERROR: Couldn't connect to node "+t+", is it running?")},InvalidProvider:function(){return new Error("Providor not set or invalid")},InvalidResponse:function(t){var e=t&&t.error&&t.error.message?t.error.message:"Invalid JSON RPC response: "+t;return new Error(e)}}},{}],15:[function(t,e,n){"use strict";var r=t("./formatters"),o=t("../utils/utils"),i=t("./method"),a=t("./property"),s=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},u=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},c=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},l=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},f=function(t){return o.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},p=new i({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[o.toAddress,r.inputDefaultBlockNumberFormatter],outputFormatter:r.outputBigNumberFormatter}),h=new i({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[null,o.toHex,r.inputDefaultBlockNumberFormatter]}),m=new i({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.toAddress,r.inputDefaultBlockNumberFormatter]}),d=new i({name:"getBlock",call:s,params:2,inputFormatter:[r.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:r.outputBlockFormatter}),g=new i({name:"getUncle",call:c,params:2,inputFormatter:[r.inputBlockNumberFormatter,o.toHex],outputFormatter:r.outputBlockFormatter}),y=new i({name:"getCompilers",call:"eth_getCompilers",params:0}),v=new i({name:"getBlockTransactionCount",call:l,params:1,inputFormatter:[r.inputBlockNumberFormatter],outputFormatter:o.toDecimal}),b=new i({name:"getBlockUncleCount",call:f,params:1,inputFormatter:[r.inputBlockNumberFormatter],outputFormatter:o.toDecimal}),w=new i({name:"getTransaction",call:"eth_getTransactionByHash",params:1,outputFormatter:r.outputTransactionFormatter}),_=new i({name:"getTransactionFromBlock",call:u,params:2,inputFormatter:[r.inputBlockNumberFormatter,o.toHex],outputFormatter:r.outputTransactionFormatter}),x=new i({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,outputFormatter:r.outputTransactionReceiptFormatter}),F=new i({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[null,r.inputDefaultBlockNumberFormatter],outputFormatter:o.toDecimal}),I=new i({name:"sendRawTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null]}),k=new i({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[r.inputTransactionFormatter]}),B=new i({name:"call",call:"eth_call",params:2,inputFormatter:[r.inputTransactionFormatter,r.inputDefaultBlockNumberFormatter]}),N=new i({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[r.inputTransactionFormatter],outputFormatter:o.toDecimal}),O=new i({name:"compile.solidity",call:"eth_compileSolidity",params:1}),T=new i({name:"compile.lll",call:"eth_compileLLL",params:1}),A=new i({name:"compile.serpent",call:"eth_compileSerpent",params:1}),P=new i({name:"submitWork",call:"eth_submitWork",params:3}),C=new i({name:"getWork",call:"eth_getWork",params:0}),S=[p,h,m,d,g,y,v,b,w,_,x,F,B,N,I,k,O,T,A,P,C],D=[new a({name:"coinbase",getter:"eth_coinbase"}),new a({name:"mining",getter:"eth_mining"}),new a({name:"hashrate",getter:"eth_hashrate",outputFormatter:o.toDecimal}),new a({name:"gasPrice",getter:"eth_gasPrice",outputFormatter:r.outputBigNumberFormatter}),new a({name:"accounts",getter:"eth_accounts"}),new a({name:"blockNumber",getter:"eth_blockNumber",outputFormatter:o.toDecimal})];e.exports={methods:S,properties:D}},{"../utils/utils":7,"./formatters":18,"./method":24,"./property":27}],16:[function(t,e,n){var r=t("../utils/utils"),o=t("../solidity/coder"),i=t("./formatters"),a=t("../utils/sha3"),s=t("./filter"),u=t("./watches"),c=function(t,e){this._params=t.inputs,this._name=r.transformToFullName(t),this._address=e,this._anonymous=t.anonymous};c.prototype.types=function(t){return this._params.filter(function(e){return e.indexed===t}).map(function(t){return t.type})},c.prototype.displayName=function(){return r.extractDisplayName(this._name)},c.prototype.typeName=function(){return r.extractTypeName(this._name)},c.prototype.signature=function(){return a(this._name)},c.prototype.encode=function(t,e){t=t||{},e=e||{};var n={};["fromBlock","toBlock"].filter(function(t){return void 0!==e[t]}).forEach(function(t){n[t]=i.inputBlockNumberFormatter(e[t])}),n.topics=[],n.address=this._address,this._anonymous||n.topics.push("0x"+this.signature());var a=this._params.filter(function(t){return t.indexed===!0}).map(function(e){var n=t[e.name];return void 0===n||null===n?null:r.isArray(n)?n.map(function(t){return"0x"+o.encodeParam(e.type,t)}):"0x"+o.encodeParam(e.type,n)});return n.topics=n.topics.concat(a),n},c.prototype.decode=function(t){t.data=t.data||"",t.topics=t.topics||[];var e=this._anonymous?t.topics:t.topics.slice(1),n=e.map(function(t){return t.slice(2)}).join(""),r=o.decodeParams(this.types(!0),n),a=t.data.slice(2),s=o.decodeParams(this.types(!1),a),u=i.outputLogFormatter(t);return u.event=this.displayName(),u.address=t.address,u.args=this._params.reduce(function(t,e){return t[e.name]=e.indexed?r.shift():s.shift(),t},{}),delete u.data,delete u.topics,u},c.prototype.execute=function(t,e,n){r.isFunction(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],2===arguments.length&&(e=null),1===arguments.length&&(e=null,t={}));var o=this.encode(t,e),i=this.decode.bind(this);return new s(o,u.eth(),i,n)},c.prototype.attachToContract=function(t){var e=this.execute.bind(this),n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=this.execute.bind(this,t)},e.exports=c},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"./filter":17,"./formatters":18,"./watches":31}],17:[function(t,e,n){var r=t("./requestmanager"),o=t("./formatters"),i=t("../utils/utils"),a=function(t){return null===t||"undefined"==typeof t?null:(t=String(t),0===t.indexOf("0x")?t:i.fromAscii(t))},s=function(t){return i.isString(t)?t:(t=t||{},t.topics=t.topics||[],t.topics=t.topics.map(function(t){return i.isArray(t)?t.map(a):a(t)}),{topics:t.topics,to:t.to,address:t.address,fromBlock:o.inputBlockNumberFormatter(t.fromBlock),toBlock:o.inputBlockNumberFormatter(t.toBlock)})},u=function(t,e){i.isString(t.options)||t.get(function(t,n){t&&e(t),i.isArray(n)&&n.forEach(function(t){e(null,t)})})},c=function(t){var e=function(e,n){return e?t.callbacks.forEach(function(t){t(e)}):void n.forEach(function(e){e=t.formatter?t.formatter(e):e,t.callbacks.forEach(function(t){t(null,e)})})};r.getInstance().startPolling({method:t.implementation.poll.call,params:[t.filterId]},t.filterId,e,t.stopWatching.bind(t))},l=function(t,e,n,r){var o=this,i={};e.forEach(function(t){t.attachToObject(i)}),this.options=s(t),this.implementation=i,this.filterId=null,this.callbacks=[],this.pollFilters=[],this.formatter=n,this.implementation.newFilter(this.options,function(t,e){if(t)o.callbacks.forEach(function(e){e(t)});else if(o.filterId=e,o.callbacks.forEach(function(t){u(o,t)}),o.callbacks.length>0&&c(o),r)return o.watch(r)})};l.prototype.watch=function(t){return this.callbacks.push(t),this.filterId&&(u(this,t),c(this)),this},l.prototype.stopWatching=function(){r.getInstance().stopPolling(this.filterId),this.implementation.uninstallFilter(this.filterId,function(){}),this.callbacks=[]},l.prototype.get=function(t){var e=this;if(!i.isFunction(t)){var n=this.implementation.getLogs(this.filterId);return n.map(function(t){return e.formatter?e.formatter(t):t})}return this.implementation.getLogs(this.filterId,function(n,r){n?t(n):t(null,r.map(function(t){return e.formatter?e.formatter(t):t}))}),this},e.exports=l},{"../utils/utils":7,"./formatters":18,"./requestmanager":28}],18:[function(t,e,n){var r=t("../utils/utils"),o=t("../utils/config"),i=function(t){return r.toBigNumber(t)},a=function(t){return"latest"===t||"pending"===t||"earliest"===t},s=function(t){return void 0===t?o.defaultBlock:u(t)},u=function(t){return void 0===t?void 0:a(t)?t:r.toHex(t)},c=function(t){return t.from=t.from||o.defaultAccount,t.code&&(t.data=t.code,delete t.code),["gasPrice","gas","value","nonce"].filter(function(e){return void 0!==t[e]}).forEach(function(e){t[e]=r.fromDecimal(t[e])}),t},l=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.nonce=r.toDecimal(t.nonce),t.gas=r.toDecimal(t.gas),t.gasPrice=r.toBigNumber(t.gasPrice),t.value=r.toBigNumber(t.value),t},f=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),t.cumulativeGasUsed=r.toDecimal(t.cumulativeGasUsed),t.gasUsed=r.toDecimal(t.gasUsed),r.isArray(t.logs)&&(t.logs=t.logs.map(function(t){return h(t)})),t},p=function(t){return t.gasLimit=r.toDecimal(t.gasLimit),t.gasUsed=r.toDecimal(t.gasUsed),t.size=r.toDecimal(t.size),t.timestamp=r.toDecimal(t.timestamp),null!==t.number&&(t.number=r.toDecimal(t.number)),t.difficulty=r.toBigNumber(t.difficulty),t.totalDifficulty=r.toBigNumber(t.totalDifficulty),r.isArray(t.transactions)&&t.transactions.forEach(function(t){return r.isString(t)?void 0:l(t)}),t},h=function(t){return null!==t.blockNumber&&(t.blockNumber=r.toDecimal(t.blockNumber)),null!==t.transactionIndex&&(t.transactionIndex=r.toDecimal(t.transactionIndex)),null!==t.logIndex&&(t.logIndex=r.toDecimal(t.logIndex)),t},m=function(t){return t.payload=r.toHex(t.payload),t.ttl=r.fromDecimal(t.ttl),t.workToProve=r.fromDecimal(t.workToProve),t.priority=r.fromDecimal(t.priority),r.isArray(t.topics)||(t.topics=t.topics?[t.topics]:[]),t.topics=t.topics.map(function(t){return r.fromAscii(t)}),t},d=function(t){return t.expiry=r.toDecimal(t.expiry),t.sent=r.toDecimal(t.sent),t.ttl=r.toDecimal(t.ttl),t.workProved=r.toDecimal(t.workProved),t.payloadRaw=t.payload,t.payload=r.toAscii(t.payload),r.isJson(t.payload)&&(t.payload=JSON.parse(t.payload)),t.topics||(t.topics=[]),t.topics=t.topics.map(function(t){return r.toAscii(t)}),t};e.exports={inputDefaultBlockNumberFormatter:s,inputBlockNumberFormatter:u,inputTransactionFormatter:c,inputPostFormatter:m,outputBigNumberFormatter:i,outputTransactionFormatter:l,outputTransactionReceiptFormatter:f,outputBlockFormatter:p,outputLogFormatter:h,outputPostFormatter:d}},{"../utils/config":5,"../utils/utils":7}],19:[function(t,e,n){var r=t("../web3"),o=t("../solidity/coder"),i=t("../utils/utils"),a=t("./formatters"),s=t("../utils/sha3"),u=function(t,e){this._inputTypes=t.inputs.map(function(t){return t.type}),this._outputTypes=t.outputs.map(function(t){return t.type}),this._constant=t.constant,this._name=i.transformToFullName(t),this._address=e};u.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},u.prototype.extractDefaultBlock=function(t){return t.length>this._inputTypes.length&&!i.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),o=this.toPayload(t);if(!e){var i=r.eth.call(o,n);return this.unpackOutput(i)}var a=this;r.eth.call(o,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{method:this._constant?"eth_call":"eth_sendTransaction",callback:e,params:[n],format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":18}],20:[function(t,e,n){"use strict";var r="undefined"!=typeof window&&window.XMLHttpRequest?window.XMLHttpRequest:t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.isConnected=function(){var t=new r;t.open("POST",this.host,!1),t.setRequestHeader("Content-type","application/json");try{return t.send(JSON.stringify({id:9999999999,jsonrpc:"2.0",method:"net_listening",params:[]})),!0}catch(e){return!1; -}},i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(e.responseText)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(n.responseText)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":14,xmlhttprequest:4}],21:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],22:[function(t,e,n){"use strict";var r=t("../utils/utils"),o=t("./errors"),i='{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}',a=function(e,n){var o=this;this.responseCallbacks={},this.path=e,n=n||t("net"),this.connection=n.connect({path:this.path}),this.connection.on("error",function(t){console.error("IPC Connection Error",t),o._timeout()}),this.connection.on("end",function(){o._timeout()}),this.connection.on("data",function(t){o._parseResponse(t.toString()).forEach(function(t){var e=null;r.isArray(t)?t.forEach(function(t){o.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,o.responseCallbacks[e]&&(o.responseCallbacks[e](null,t),delete o.responseCallbacks[e])})})};a.prototype._parseResponse=function(t){var e=this,n=[],r=t.replace(/\}\{/g,"}|--|{").replace(/\}\]\[\{/g,"}]|--|[{").replace(/\}\[\{/g,"}|--|[{").replace(/\}\]\{/g,"}]|--|{").split("|--|");return r.forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var r=null;try{r=JSON.parse(t)}catch(i){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e.timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,r&&n.push(r)}),n},a.prototype._addResponseCallback=function(t,e){var n=t.id||t[0].id,r=t.method||t[0].method;this.responseCallbacks[n]=e,this.responseCallbacks[n].method=r},a.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.replace("__id__",t).replace("__method__",this.responseCallbacks[t].method)),delete this.responseCallbacks[t])},a.prototype.isConnected=function(){var t=this;return t.connection.writable||t.connection.connect({path:t.path}),!!this.connection.writable},a.prototype.send=function(t){if(this.connection.writeSync){var e;this.connection.writable||this.connection.connect({path:this.path});var n=this.connection.writeSync(JSON.stringify(t));try{e=JSON.parse(n)}catch(r){throw o.InvalidResponse(n)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},a.prototype.sendAsync=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},e.exports=a},{"../utils/utils":7,"./errors":14,net:32}],23:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],24:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":14,"./requestmanager":28}],25:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":12}],26:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":27}],27:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},i=this.getAsync.bind(this);i.request=this.request.bind(this),t[o("get",r)]=i},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},i.prototype.request=function(){var t={method:this.getter,params:[],callback:this.extractCallback(Array.prototype.slice.call(arguments))};return t.format=this.formatOutput.bind(this),t},e.exports=i},{"../utils/utils":7,"./requestmanager":28}],28:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":14,"./jsonrpc":23}],29:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[i,a,s,u,c];e.exports={methods:l}},{"./formatters":18,"./method":24}],30:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":12,"./icap":21,"./namereg":25}],31:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":24}],32:[function(t,e,n){},{}],33:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var f=0;c>f;f+=a)this._doProcessBlock(r,f);var p=r.splice(0,c);n.sigBytes-=l}return new i.init(p,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],34:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],f=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,p=0,h=0;7>h;h++){if(1&i){var m=(1<m?p^=1<t;t++)p[t]=s.create()}();var h=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var h=0;5>h;h++){for(var m=0,d=0,g=0;5>g;g++){var s=n[h+5*g];m^=s.high,d^=s.low}var y=p[h];y.high=m,y.low=d}for(var h=0;5>h;h++)for(var v=p[(h+4)%5],b=p[(h+1)%5],w=b.high,_=b.low,m=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),g=0;5>g;g++){var s=n[h+5*g];s.high^=m,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,k=c[x];if(32>k)var m=F<>>32-k,d=I<>>32-k;else var m=I<>>64-k,d=F<>>64-k;var B=p[l[x]];B.high=m,B.low=d}var N=p[0],O=n[0];N.high=O.high,N.low=O.low;for(var h=0;5>h;h++)for(var g=0;5>g;g++){var x=h+5*g,s=n[x],T=p[x],A=p[(h+1)%5+5*g],P=p[(h+2)%5+5*g];s.high=T.high^~A.high&P.high,s.low=T.low^~A.low&P.low}var s=n[0],C=f[u];s.high^=C.high,s.low^=C.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var f=a[l],p=f.high,h=f.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(h),n.HmacSHA3=i._createHmacHelper(h)}(Math),t.SHA3})},{"./core":33,"./x64-core":35}],35:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":33}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var o,i,a,s,u,c,l=this;if(!(l instanceof e))return W&&C(26,"constructor call without new",t),new e(t,r);if(null!=r&&z(r,2,64,R,"base")){if(r=0|r,c=t+"",10==r)return l=new e(t instanceof e?t:c),S(l,j+l.e+1,q);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(o="["+x.slice(0,r)+"]+")+"(?:\\."+o+")?$",37>r?"i":"").test(c))return d(l,c,s,r);s?(l.s=0>1/t?(c=c.slice(1),-1):1,W&&c.replace(/^0\.0*|\./,"").length>15&&C(R,_,t),s=!1):l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,l.s)}else{if(t instanceof e)return l.s=t.s,l.e=t.e,l.c=(t=t.c)?t.slice():t,void(R=0);if((s="number"==typeof t)&&0*t==0){if(l.s=0>1/t?(t=-t,-1):1,t===~~t){for(i=0,a=t;a>=10;a/=10,i++);return l.e=i,l.c=[t],void(R=0)}c=t+""}else{if(!g.test(c=t+""))return d(l,c,s);l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((i=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>i&&(i=a),i+=+c.slice(a+1),c=c.substring(0,a)):0>i&&(i=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&W&&u>15&&C(R,_,l.s*t),i=i-a-1,i>G)l.c=l.e=null;else if(M>i)l.c=[l.e=0];else{if(l.e=i,l.c=[],a=(i+1)%I,0>i&&(a+=I),u>a){for(a&&l.c.push(+c.slice(0,a)),u-=I;u>a;)l.c.push(+c.slice(a,a+=I));c=c.slice(a),a=I-c.length}else a-=u;for(;a--;c+="0");l.c.push(+c)}else l.c=[l.e=0];R=0}function n(t,n,r,o){var a,s,u,l,p,h,m,d=t.indexOf("."),g=j,y=q;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=$,$=0,t=t.replace(".",""),m=new e(r),p=m.pow(t.length-d),$=u,m.c=c(f(i(p.c),p.e),10,n),m.e=m.c.length),h=c(t,r,n),s=u=h.length;0==h[--u];h.pop());if(!h[0])return"0";if(0>d?--s:(p.c=h,p.e=s,p.s=o,p=D(p,m,g,y,n),h=p.c,l=p.r,s=p.e),a=s+g+1,d=h[a],u=n/2,l=l||0>a||null!=h[a+1],l=4>y?(null!=d||l)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||l||6==y&&1&h[a-1]||y==(p.s<0?8:7)),1>a||!h[0])t=l?f("1",-g):"0";else{if(h.length=a,l)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(d=0,t="";u>=d;t+=x.charAt(h[d++]));t=f(t,s)}return t}function h(t,n,r,o){var a,s,u,c,p;if(r=null!=r&&z(r,0,8,o,w)?0|r:q,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=i(t.c),p=19==o||24==o&&L>=u?l(p,u):f(p,u);else if(t=S(new e(t),n,r),s=t.e,p=i(t.c),c=p.length,19==o||24==o&&(s>=n||L>=s)){for(;n>c;p+="0",c++);p=l(p,s)}else if(n-=u,p=f(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function T(t,n){var r,o,i=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++it||t>n||t!=p(t))&&C(r,(o||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function P(t,e,n){for(var r=1,o=e.length;!e[--o];e.pop());for(o=e[0];o>=10;o/=10,r++);return(n=r+n*I-1)>G?t.c=t.e=null:M>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function C(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",R=0,r}function S(t,e,n,r){var o,i,a,s,u,c,l,f=t.c,p=B;if(f){t:{for(o=1,s=f[0];s>=10;s/=10,o++);if(i=e-o,0>i)i+=I,a=e,u=f[c=0],l=u/p[o-a-1]%10|0;else if(c=y((i+1)/I),c>=f.length){if(!r)break t;for(;f.length<=c;f.push(0));u=l=0,o=1,i%=I,a=i-I+1}else{for(u=s=f[c],o=1;s>=10;s/=10,o++);i%=I,a=i-I+o,l=0>a?0:u/p[o-a-1]%10|0}if(r=r||0>e||null!=f[c+1]||(0>a?u:u%p[o-a-1]),r=4>n?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(i>0?a>0?u/p[o-a]:0:f[c-1])%10&1||n==(t.s<0?8:7)),1>e||!f[0])return f.length=0,r?(e-=t.e+1,f[0]=p[e%I],t.e=-e||0):f[0]=t.e=0,t;if(0==i?(f.length=c,s=1,c--):(f.length=c+1,s=p[I-i],f[c]=a>0?v(u/p[o-a]%p[a])*s:0),r)for(;;){if(0==c){for(i=1,a=f[0];a>=10;a/=10,i++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(t.e++,f[0]==F&&(f[0]=1));break}if(f[c]+=s,f[c]!=F)break;f[c--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}t.e>G?t.c=t.e=null:t.en?null!=(t=o[n++]):void 0};return a(e="DECIMAL_PLACES")&&z(t,0,O,2,e)&&(j=0|t),r[e]=j,a(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(q=0|t),r[e]=q,a(e="EXPONENTIAL_AT")&&(u(t)?z(t[0],-O,0,2,e)&&z(t[1],0,O,2,e)&&(L=0|t[0],U=0|t[1]):z(t,-O,O,2,e)&&(L=-(U=0|(0>t?-t:t)))),r[e]=[L,U],a(e="RANGE")&&(u(t)?z(t[0],-O,-1,2,e)&&z(t[1],1,O,2,e)&&(M=0|t[0],G=0|t[1]):z(t,-O,O,2,e)&&(0|t?M=-(G=0|(0>t?-t:t)):W&&C(2,e+" cannot be zero",t))),r[e]=[M,G],a(e="ERRORS")&&(t===!!t||1===t||0===t?(R=0,z=(W=!!t)?A:s):W&&C(2,e+b,t)),r[e]=W,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(J=!(!t||!m||"object"!=typeof m),t&&!J&&W&&C(2,"crypto unavailable",m)):W&&C(2,e+b,t)),r[e]=J,a(e="MODULO_MODE")&&z(t,0,9,2,e)&&(V=0|t),r[e]=V,a(e="POW_PRECISION")&&z(t,0,O,2,e)&&($=0|t),r[e]=$,a(e="FORMAT")&&("object"==typeof t?X=t:W&&C(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return T(arguments,E.lt)},e.min=function(){return T(arguments,E.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return v(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,o,i,a,s,u=0,c=[],l=new e(H);if(t=null!=t&&z(t,0,O,14)?0|t:j,a=y(t/I),J)if(m&&m.getRandomValues){for(r=m.getRandomValues(new Uint32Array(a*=2));a>u;)s=131072*r[u]+(r[u+1]>>>11),s>=9e15?(o=m.getRandomValues(new Uint32Array(2)),r[u]=o[0],r[u+1]=o[1]):(c.push(s%1e14),u+=2);u=a/2}else if(m&&m.randomBytes){for(r=m.randomBytes(a*=7);a>u;)s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6],s>=9e15?m.randomBytes(7).copy(r,u):(c.push(s%1e14),u+=7);u=a/7}else W&&C(14,"crypto unavailable",m);if(!u)for(;a>u;)s=n(),9e15>s&&(c[u++]=s%1e14);for(a=c[--u],t%=I,a&&t&&(s=B[I-t],c[u]=v(a/s)*s);0===c[u];c.pop(),u--);if(0>u)c=[i=0];else{for(i=-1;0===c[0];c.shift(),i-=I);for(u=1,s=c[0];s>=10;s/=10,u++);I>u&&(i-=I-u)}return l.e=i,l.c=c,l}}(),D=function(){function t(t,e,n){var r,o,i,a,s=0,u=t.length,c=e%N,l=e/N|0;for(t=t.slice();u--;)i=t[u]%N,a=t[u]/N|0,r=l*i+a*c,o=c*i+r%N*N+s,s=(o/n|0)+(r/N|0)+l*a,t[u]=o%n;return s&&t.unshift(s),t}function n(t,e,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;n>o;o++)if(t[o]!=e[o]){i=t[o]>e[o]?1:-1;break}return i}function r(t,e,n,r){for(var o=0;n--;)t[n]-=o,o=t[n]1;t.shift());}return function(i,a,s,u,c){var l,f,p,h,m,d,g,y,b,w,_,x,k,B,N,O,T,A=i.s==a.s?1:-1,P=i.c,C=a.c;if(!(P&&P[0]&&C&&C[0]))return new e(i.s&&a.s&&(P?!C||P[0]!=C[0]:C)?P&&0==P[0]||!C?0*A:A/0:0/0);for(y=new e(A),b=y.c=[],f=i.e-a.e,A=s+f+1,c||(c=F,f=o(i.e/I)-o(a.e/I),A=A/I|0),p=0;C[p]==(P[p]||0);p++);if(C[p]>(P[p]||0)&&f--,0>A)b.push(1),h=!0;else{for(B=P.length,O=C.length,p=0,A+=2,m=v(c/(C[0]+1)),m>1&&(C=t(C,m,c),P=t(P,m,c),O=C.length,B=P.length),k=O,w=P.slice(0,O),_=w.length;O>_;w[_++]=0);T=C.slice(),T.unshift(0),N=C[0],C[1]>=c/2&&N++;do{if(m=0,l=n(C,w,O,_),0>l){if(x=w[0],O!=_&&(x=x*c+(w[1]||0)),m=v(x/N),m>1)for(m>=c&&(m=c-1),d=t(C,m,c),g=d.length,_=w.length;1==n(d,w,g,_);)m--,r(d,g>O?T:C,g,c),g=d.length,l=1;else 0==m&&(l=m=1),d=C.slice(),g=d.length;if(_>g&&d.unshift(0),r(w,d,_,c),_=w.length,-1==l)for(;n(C,w,O,_)<1;)m++,r(w,_>O?T:C,_,c),_=w.length}else 0===l&&(m++,w=[0]);b[p++]=m,w[0]?w[_++]=P[k]||0:(w=[P[k]],_=1)}while((k++=10;A/=10,p++);S(y,s+(y.e=p+f*I-1)+1,u,h)}else y.e=f,y.r=+h;return y}}(),d=function(){var t=/^(-?)0([xbo])/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,o=/^-?(Infinity|NaN)$/,i=/^\s*\+|^\s+|\s+$/g;return function(a,s,u,c){var l,f=u?s:s.replace(i,"");if(o.test(f))a.s=isNaN(f)?null:0>f?-1:1;else{if(!u&&(f=f.replace(t,function(t,e,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?t:e}),c&&(l=c,f=f.replace(n,"$1").replace(r,"0.$1")),s!=f))return new e(f,l);W&&C(R,"not a"+(c?" base "+c:"")+" number",s),a.s=null}a.c=a.e=null,R=0}}(),E.absoluteValue=E.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},E.ceil=function(){return S(new e(this),this.e+1,2)},E.comparedTo=E.cmp=function(t,n){return R=1,a(this,new e(t,n))},E.decimalPlaces=E.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-o(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},E.dividedBy=E.div=function(t,n){return R=3,D(this,new e(t,n),j,q)},E.dividedToIntegerBy=E.divToInt=function(t,n){return R=4,D(this,new e(t,n),0,1)},E.equals=E.eq=function(t,n){return R=5,0===a(this,new e(t,n))},E.floor=function(){return S(new e(this),this.e+1,3)},E.greaterThan=E.gt=function(t,n){return R=6,a(this,new e(t,n))>0},E.greaterThanOrEqualTo=E.gte=function(t,n){return R=7,1===(n=a(this,new e(t,n)))||0===n},E.isFinite=function(){return!!this.c},E.isInteger=E.isInt=function(){return!!this.c&&o(this.e/I)>this.c.length-2},E.isNaN=function(){return!this.s},E.isNegative=E.isNeg=function(){return this.s<0},E.isZero=function(){return!!this.c&&0==this.c[0]},E.lessThan=E.lt=function(t,n){return R=8,a(this,new e(t,n))<0},E.lessThanOrEqualTo=E.lte=function(t,n){return R=9,-1===(n=a(this,new e(t,n)))||0===n},E.minus=E.sub=function(t,n){var r,i,a,s,u=this,c=u.s;if(R=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,u.plus(t);var l=u.e/I,f=t.e/I,p=u.c,h=t.c;if(!l||!f){if(!p||!h)return p?(t.s=-n,t):new e(h?u:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?u:3==q?-0:0)}if(l=o(l),f=o(f),p=p.slice(),c=l-f){for((s=0>c)?(c=-c,a=p):(f=l,a=h),a.reverse(),n=c;n--;a.push(0));a.reverse()}else for(i=(s=(c=p.length)<(n=h.length))?c:n,c=n=0;i>n;n++)if(p[n]!=h[n]){s=p[n]0)for(;n--;p[r++]=0);for(n=F-1;i>c;){if(p[--i]0?(u=s,r=l):(a=-a,r=c),r.reverse();a--;r.push(0));r.reverse()}for(a=c.length,n=l.length,0>a-n&&(r=l,l=c,c=r,n=a),a=0;n;)a=(c[--n]=c[n]+l[n]+a)/F|0,c[n]%=F;return a&&(c.unshift(a),++u),P(t,c,u)},E.precision=E.sd=function(t){var e,n,r=this,o=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(W&&C(13,"argument"+b,t),t!=!!t&&(t=null)),!o)return null;if(n=o.length-1,e=n*I+1,n=o[n]){for(;n%10==0;n/=10,e--);for(n=o[0];n>=10;n/=10, -e++);}return t&&r.e+1>e&&(e=r.e+1),e},E.round=function(t,n){var r=new e(this);return(null==t||z(t,0,O,15))&&S(r,~~t+this.e+1,null!=n&&z(n,0,8,15,w)?0|n:q),r},E.shift=function(t){var n=this;return z(t,-k,k,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-k>t||t>k)?n.s*(0>t?0:1/0):n)},E.squareRoot=E.sqrt=function(){var t,n,r,a,s,u=this,c=u.c,l=u.s,f=u.e,p=j+4,h=new e("0.5");if(1!==l||!c||!c[0])return new e(!l||0>l&&(!c||c[0])?0/0:c?u:1/0);if(l=Math.sqrt(+u),0==l||l==1/0?(n=i(c),(n.length+f)%2==0&&(n+="0"),l=Math.sqrt(n),f=o((f+1)/2)-(0>f||f%2),l==1/0?n="1e"+f:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+f),r=new e(n)):r=new e(l+""),r.c[0])for(f=r.e,l=f+p,3>l&&(l=0);;)if(s=r,r=h.times(s.plus(D(u,s,p,1))),i(s.c).slice(0,l)===(n=i(r.c)).slice(0,l)){if(r.el&&(g=w,w=_,_=g,a=l,l=h,h=a),a=l+h,g=[];a--;g.push(0));for(y=F,v=N,a=h;--a>=0;){for(r=0,m=_[a]%v,d=_[a]/v|0,u=l,s=a+u;s>a;)f=w[--u]%v,p=w[u]/v|0,c=d*f+p*m,f=m*f+c%v*v+g[s]+r,r=(f/y|0)+(c/v|0)+d*p,g[s--]=f%y;g[s]=r}return r?++i:g.shift(),P(t,g,i)},E.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,O,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,w)?0|n:q,t?S(r,t,n):r},E.toExponential=function(t,e){return h(this,null!=t&&z(t,0,O,19)?~~t+1:null,e,19)},E.toFixed=function(t,e){return h(this,null!=t&&z(t,0,O,20)?~~t+this.e+1:null,e,20)},E.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,O,21)?~~t+this.e+1:null,e,21);if(this.c){var r,o=n.split("."),i=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,u=o[0],c=o[1],l=this.s<0,f=l?u.slice(1):u,p=f.length;if(a&&(r=i,i=a,a=r,p-=r),i>0&&p>0){for(r=p%i||i,u=f.substr(0,r);p>r;r+=i)u+=s+f.substr(r,i);a>0&&(u+=s+f.slice(r)),l&&(u="-"+u)}n=c?u+X.decimalSeparator+((a=+X.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):c):u}return n},E.toFraction=function(t){var n,r,o,a,s,u,c,l,f,p=W,h=this,m=h.c,d=new e(H),g=r=new e(H),y=c=new e(H);if(null!=t&&(W=!1,u=new e(t),W=p,(!(p=u.isInt())||u.lt(H))&&(W&&C(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&u.c&&S(u,u.e+1,1).gte(H)?u:null)),!m)return h.toString();for(f=i(m),a=d.e=f.length-h.e-1,d.c[0]=B[(s=a%I)<0?I+s:s],t=!t||u.cmp(d)>0?a>0?d:g:u,s=G,G=1/0,u=new e(f),c.c[0]=0;l=D(u,d,0,1),o=r.plus(l.times(y)),1!=o.cmp(t);)r=y,y=o,g=c.plus(l.times(o=g)),c=o,d=u.minus(l.times(o=d)),u=o;return o=D(t.minus(r),y,0,1),c=c.plus(o.times(g)),r=r.plus(o.times(y)),c.s=g.s=h.s,a*=2,n=D(g,y,a,q).minus(h).abs().cmp(D(c,r,a,q).minus(h).abs())<1?[g.toString(),y.toString()]:[c.toString(),r.toString()],G=s,n},E.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},E.toPower=E.pow=function(t){var n,r,o=v(0>t?-t:+t),i=this;if(!z(t,-k,k,23,"exponent")&&(!isFinite(t)||o>k&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+i,t));for(n=$?y($/I+2):0,r=new e(H);;){if(o%2){if(r=r.times(i),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(o=v(o/2),!o)break;i=i.times(i),n&&i.c&&i.c.length>n&&(i.c.length=n)}return 0>t&&(r=H.div(r)),n?S(r,$,q):r},E.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,O,24,"precision")?0|t:null,e,24)},E.toString=function(t){var e,r=this,o=r.s,a=r.e;return null===a?o?(e="Infinity",0>o&&(e="-"+e)):e="NaN":(e=i(r.c),e=null!=t&&z(t,2,64,25,"base")?n(f(e,a),0|t,10,o):L>=a||a>=U?l(e,a):f(e,a),0>o&&r.c[0]&&(e="-"+e)),e},E.truncated=E.trunc=function(){return S(new e(this),this.e+1,1)},E.valueOf=E.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function o(t){var e=0|t;return t>0||t===e?e:e-1}function i(t){for(var e,n,r=1,o=t.length,i=t[0]+"";o>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);i+=e}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function a(t,e){var n,r,o=t.c,i=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=0>a,r=u==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return u>c^n?1:-1;for(s=(u=o.length)<(c=i.length)?u:c,a=0;s>a;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return u==c?0:u>c^n?1:-1}function s(t,e,n){return(t=p(t))>=e&&n>=t}function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,o,i=[0],a=0,s=t.length;s>a;){for(o=i.length;o--;i[o]*=e);for(i[r=0]+=x.indexOf(t.charAt(a++));rn-1&&(null==i[r+1]&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function l(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function f(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?y(t):v(t)}var h,m,d,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=Math.ceil,v=Math.floor,b=" not a boolean or binary digit",w="rounding mode",_="number type has more than 15 significant digits",x="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",F=1e14,I=14,k=9007199254740991,B=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],N=1e7,O=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!m)try{m=t("crypto")}catch(T){}}else n.BigNumber=h}(this)},{crypto:32}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.IpcProvider=t("./lib/web3/ipcprovider"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":12,"./lib/web3/httpprovider":20,"./lib/web3/ipcprovider":22,"./lib/web3/namereg":25,"./lib/web3/transfer":30}]},{},["web3"]); \ No newline at end of file +}},i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(e.responseText)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(n.responseText)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":14,xmlhttprequest:4}],21:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],22:[function(t,e,n){"use strict";var r=t("../utils/utils"),o=t("./errors"),i='{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}',a=function(e,n){var o=this;this.responseCallbacks={},this.path=e,n=n||t("net"),this.connection=n.connect({path:this.path}),this.connection.on("error",function(t){console.error("IPC Connection Error",t),o._timeout()}),this.connection.on("end",function(){o._timeout()}),this.connection.on("data",function(t){o._parseResponse(t.toString()).forEach(function(t){var e=null;r.isArray(t)?t.forEach(function(t){o.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,o.responseCallbacks[e]&&(o.responseCallbacks[e](null,t),delete o.responseCallbacks[e])})})};a.prototype._parseResponse=function(t){var e=this,n=[],r=t.replace(/\}\{/g,"}|--|{").replace(/\}\]\[\{/g,"}]|--|[{").replace(/\}\[\{/g,"}|--|[{").replace(/\}\]\{/g,"}]|--|{").split("|--|");return r.forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var r=null;try{r=JSON.parse(t)}catch(i){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e.timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,r&&n.push(r)}),n},a.prototype._addResponseCallback=function(t,e){var n=t.id||t[0].id,r=t.method||t[0].method;this.responseCallbacks[n]=e,this.responseCallbacks[n].method=r},a.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.replace("__id__",t).replace("__method__",this.responseCallbacks[t].method)),delete this.responseCallbacks[t])},a.prototype.isConnected=function(){var t=this;return t.connection.writable||t.connection.connect({path:t.path}),!!this.connection.writable},a.prototype.send=function(t){if(this.connection.writeSync){var e;this.connection.writable||this.connection.connect({path:this.path});var n=this.connection.writeSync(JSON.stringify(t));try{e=JSON.parse(n)}catch(r){throw o.InvalidResponse(n)}return e}throw new Error('You tried to send "'+t.method+'" synchronously. Synchronous requests are not supported by the IPC provider.')},a.prototype.sendAsync=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},e.exports=a},{"../utils/utils":7,"./errors":14,net:32}],23:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],24:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":14,"./requestmanager":28}],25:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":12}],26:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":27}],27:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},i=this.getAsync.bind(this);i.request=this.request.bind(this),t[o("get",r)]=i},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},i.prototype.request=function(){var t={method:this.getter,params:[],callback:this.extractCallback(Array.prototype.slice.call(arguments))};return t.format=this.formatOutput.bind(this),t},e.exports=i},{"../utils/utils":7,"./requestmanager":28}],28:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":14,"./jsonrpc":23}],29:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=new r({name:"newFilter",call:"shh_newFilter",params:1}),f=new r({name:"getFilterChanges",call:"shh_getFilterChanges",params:1}),p=new r({name:"getMessages",call:"shh_getMessages",params:1}),h=[i,a,s,u,c,l,f,p];e.exports={methods:h}},{"./formatters":18,"./method":24}],30:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":12,"./icap":21,"./namereg":25}],31:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":24}],32:[function(t,e,n){},{}],33:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var f=0;c>f;f+=a)this._doProcessBlock(r,f);var p=r.splice(0,c);n.sigBytes-=l}return new i.init(p,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],34:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],f=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,p=0,h=0;7>h;h++){if(1&i){var m=(1<m?p^=1<t;t++)p[t]=s.create()}();var h=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var h=0;5>h;h++){for(var m=0,d=0,g=0;5>g;g++){var s=n[h+5*g];m^=s.high,d^=s.low}var y=p[h];y.high=m,y.low=d}for(var h=0;5>h;h++)for(var v=p[(h+4)%5],b=p[(h+1)%5],w=b.high,_=b.low,m=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),g=0;5>g;g++){var s=n[h+5*g];s.high^=m,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,k=c[x];if(32>k)var m=F<>>32-k,d=I<>>32-k;else var m=I<>>64-k,d=F<>>64-k;var B=p[l[x]];B.high=m,B.low=d}var N=p[0],O=n[0];N.high=O.high,N.low=O.low;for(var h=0;5>h;h++)for(var g=0;5>g;g++){var x=h+5*g,s=n[x],T=p[x],A=p[(h+1)%5+5*g],P=p[(h+2)%5+5*g];s.high=T.high^~A.high&P.high,s.low=T.low^~A.low&P.low}var s=n[0],C=f[u];s.high^=C.high,s.low^=C.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var f=a[l],p=f.high,h=f.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(h),n.HmacSHA3=i._createHmacHelper(h)}(Math),t.SHA3})},{"./core":33,"./x64-core":35}],35:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":33}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var o,i,a,s,u,c,l=this;if(!(l instanceof e))return W&&C(26,"constructor call without new",t),new e(t,r);if(null!=r&&z(r,2,64,R,"base")){if(r=0|r,c=t+"",10==r)return l=new e(t instanceof e?t:c),S(l,j+l.e+1,q);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(o="["+x.slice(0,r)+"]+")+"(?:\\."+o+")?$",37>r?"i":"").test(c))return d(l,c,s,r);s?(l.s=0>1/t?(c=c.slice(1),-1):1,W&&c.replace(/^0\.0*|\./,"").length>15&&C(R,_,t),s=!1):l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,l.s)}else{if(t instanceof e)return l.s=t.s,l.e=t.e,l.c=(t=t.c)?t.slice():t,void(R=0);if((s="number"==typeof t)&&0*t==0){if(l.s=0>1/t?(t=-t,-1):1,t===~~t){for(i=0,a=t;a>=10;a/=10,i++);return l.e=i,l.c=[t],void(R=0)}c=t+""}else{if(!g.test(c=t+""))return d(l,c,s);l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((i=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>i&&(i=a),i+=+c.slice(a+1),c=c.substring(0,a)):0>i&&(i=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&W&&u>15&&C(R,_,l.s*t),i=i-a-1,i>G)l.c=l.e=null;else if(M>i)l.c=[l.e=0];else{if(l.e=i,l.c=[],a=(i+1)%I,0>i&&(a+=I),u>a){for(a&&l.c.push(+c.slice(0,a)),u-=I;u>a;)l.c.push(+c.slice(a,a+=I));c=c.slice(a),a=I-c.length}else a-=u;for(;a--;c+="0");l.c.push(+c)}else l.c=[l.e=0];R=0}function n(t,n,r,o){var a,s,u,l,p,h,m,d=t.indexOf("."),g=j,y=q;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=$,$=0,t=t.replace(".",""),m=new e(r),p=m.pow(t.length-d),$=u,m.c=c(f(i(p.c),p.e),10,n),m.e=m.c.length),h=c(t,r,n),s=u=h.length;0==h[--u];h.pop());if(!h[0])return"0";if(0>d?--s:(p.c=h,p.e=s,p.s=o,p=D(p,m,g,y,n),h=p.c,l=p.r,s=p.e),a=s+g+1,d=h[a],u=n/2,l=l||0>a||null!=h[a+1],l=4>y?(null!=d||l)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||l||6==y&&1&h[a-1]||y==(p.s<0?8:7)),1>a||!h[0])t=l?f("1",-g):"0";else{if(h.length=a,l)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(d=0,t="";u>=d;t+=x.charAt(h[d++]));t=f(t,s)}return t}function h(t,n,r,o){var a,s,u,c,p;if(r=null!=r&&z(r,0,8,o,w)?0|r:q,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=i(t.c),p=19==o||24==o&&L>=u?l(p,u):f(p,u);else if(t=S(new e(t),n,r),s=t.e,p=i(t.c),c=p.length,19==o||24==o&&(s>=n||L>=s)){for(;n>c;p+="0",c++);p=l(p,s)}else if(n-=u,p=f(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function T(t,n){var r,o,i=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++it||t>n||t!=p(t))&&C(r,(o||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function P(t,e,n){for(var r=1,o=e.length;!e[--o];e.pop());for(o=e[0];o>=10;o/=10,r++);return(n=r+n*I-1)>G?t.c=t.e=null:M>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function C(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",R=0,r}function S(t,e,n,r){var o,i,a,s,u,c,l,f=t.c,p=B;if(f){t:{for(o=1,s=f[0];s>=10;s/=10,o++);if(i=e-o,0>i)i+=I,a=e,u=f[c=0],l=u/p[o-a-1]%10|0;else if(c=y((i+1)/I),c>=f.length){if(!r)break t;for(;f.length<=c;f.push(0));u=l=0,o=1,i%=I,a=i-I+1}else{for(u=s=f[c],o=1;s>=10;s/=10,o++);i%=I,a=i-I+o,l=0>a?0:u/p[o-a-1]%10|0}if(r=r||0>e||null!=f[c+1]||(0>a?u:u%p[o-a-1]),r=4>n?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(i>0?a>0?u/p[o-a]:0:f[c-1])%10&1||n==(t.s<0?8:7)),1>e||!f[0])return f.length=0,r?(e-=t.e+1,f[0]=p[e%I],t.e=-e||0):f[0]=t.e=0,t;if(0==i?(f.length=c,s=1,c--):(f.length=c+1,s=p[I-i],f[c]=a>0?v(u/p[o-a]%p[a])*s:0),r)for(;;){if(0==c){for(i=1,a=f[0];a>=10;a/=10,i++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);i!=s&&(t.e++,f[0]==F&&(f[0]=1));break}if(f[c]+=s,f[c]!=F)break;f[c--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}t.e>G?t.c=t.e=null:t.en?null!=(t=o[n++]):void 0};return a(e="DECIMAL_PLACES")&&z(t,0,O,2,e)&&(j=0|t),r[e]=j,a(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(q=0|t),r[e]=q,a(e="EXPONENTIAL_AT")&&(u(t)?z(t[0],-O,0,2,e)&&z(t[1],0,O,2,e)&&(L=0|t[0],U=0|t[1]):z(t,-O,O,2,e)&&(L=-(U=0|(0>t?-t:t)))),r[e]=[L,U],a(e="RANGE")&&(u(t)?z(t[0],-O,-1,2,e)&&z(t[1],1,O,2,e)&&(M=0|t[0],G=0|t[1]):z(t,-O,O,2,e)&&(0|t?M=-(G=0|(0>t?-t:t)):W&&C(2,e+" cannot be zero",t))),r[e]=[M,G],a(e="ERRORS")&&(t===!!t||1===t||0===t?(R=0,z=(W=!!t)?A:s):W&&C(2,e+b,t)),r[e]=W,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(J=!(!t||!m||"object"!=typeof m),t&&!J&&W&&C(2,"crypto unavailable",m)):W&&C(2,e+b,t)),r[e]=J,a(e="MODULO_MODE")&&z(t,0,9,2,e)&&(V=0|t),r[e]=V,a(e="POW_PRECISION")&&z(t,0,O,2,e)&&($=0|t),r[e]=$,a(e="FORMAT")&&("object"==typeof t?X=t:W&&C(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return T(arguments,E.lt)},e.min=function(){return T(arguments,E.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return v(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,o,i,a,s,u=0,c=[],l=new e(H);if(t=null!=t&&z(t,0,O,14)?0|t:j,a=y(t/I),J)if(m&&m.getRandomValues){for(r=m.getRandomValues(new Uint32Array(a*=2));a>u;)s=131072*r[u]+(r[u+1]>>>11),s>=9e15?(o=m.getRandomValues(new Uint32Array(2)),r[u]=o[0],r[u+1]=o[1]):(c.push(s%1e14),u+=2);u=a/2}else if(m&&m.randomBytes){for(r=m.randomBytes(a*=7);a>u;)s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6],s>=9e15?m.randomBytes(7).copy(r,u):(c.push(s%1e14),u+=7);u=a/7}else W&&C(14,"crypto unavailable",m);if(!u)for(;a>u;)s=n(),9e15>s&&(c[u++]=s%1e14);for(a=c[--u],t%=I,a&&t&&(s=B[I-t],c[u]=v(a/s)*s);0===c[u];c.pop(),u--);if(0>u)c=[i=0];else{for(i=-1;0===c[0];c.shift(),i-=I);for(u=1,s=c[0];s>=10;s/=10,u++);I>u&&(i-=I-u)}return l.e=i,l.c=c,l}}(),D=function(){function t(t,e,n){var r,o,i,a,s=0,u=t.length,c=e%N,l=e/N|0;for(t=t.slice();u--;)i=t[u]%N,a=t[u]/N|0,r=l*i+a*c,o=c*i+r%N*N+s,s=(o/n|0)+(r/N|0)+l*a,t[u]=o%n;return s&&t.unshift(s),t}function n(t,e,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;n>o;o++)if(t[o]!=e[o]){i=t[o]>e[o]?1:-1;break}return i}function r(t,e,n,r){for(var o=0;n--;)t[n]-=o,o=t[n]1;t.shift());}return function(i,a,s,u,c){var l,f,p,h,m,d,g,y,b,w,_,x,k,B,N,O,T,A=i.s==a.s?1:-1,P=i.c,C=a.c;if(!(P&&P[0]&&C&&C[0]))return new e(i.s&&a.s&&(P?!C||P[0]!=C[0]:C)?P&&0==P[0]||!C?0*A:A/0:0/0);for(y=new e(A),b=y.c=[],f=i.e-a.e,A=s+f+1,c||(c=F,f=o(i.e/I)-o(a.e/I),A=A/I|0),p=0;C[p]==(P[p]||0);p++);if(C[p]>(P[p]||0)&&f--,0>A)b.push(1),h=!0;else{for(B=P.length,O=C.length,p=0,A+=2,m=v(c/(C[0]+1)),m>1&&(C=t(C,m,c),P=t(P,m,c),O=C.length,B=P.length),k=O,w=P.slice(0,O),_=w.length;O>_;w[_++]=0);T=C.slice(),T.unshift(0),N=C[0],C[1]>=c/2&&N++;do{if(m=0,l=n(C,w,O,_),0>l){if(x=w[0],O!=_&&(x=x*c+(w[1]||0)),m=v(x/N),m>1)for(m>=c&&(m=c-1),d=t(C,m,c),g=d.length,_=w.length;1==n(d,w,g,_);)m--,r(d,g>O?T:C,g,c),g=d.length,l=1;else 0==m&&(l=m=1),d=C.slice(),g=d.length;if(_>g&&d.unshift(0),r(w,d,_,c),_=w.length,-1==l)for(;n(C,w,O,_)<1;)m++,r(w,_>O?T:C,_,c),_=w.length}else 0===l&&(m++,w=[0]);b[p++]=m,w[0]?w[_++]=P[k]||0:(w=[P[k]],_=1)}while((k++=10;A/=10,p++);S(y,s+(y.e=p+f*I-1)+1,u,h)}else y.e=f,y.r=+h;return y}}(),d=function(){var t=/^(-?)0([xbo])/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,o=/^-?(Infinity|NaN)$/,i=/^\s*\+|^\s+|\s+$/g;return function(a,s,u,c){var l,f=u?s:s.replace(i,"");if(o.test(f))a.s=isNaN(f)?null:0>f?-1:1;else{if(!u&&(f=f.replace(t,function(t,e,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?t:e}),c&&(l=c,f=f.replace(n,"$1").replace(r,"0.$1")),s!=f))return new e(f,l);W&&C(R,"not a"+(c?" base "+c:"")+" number",s),a.s=null}a.c=a.e=null,R=0}}(),E.absoluteValue=E.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},E.ceil=function(){return S(new e(this),this.e+1,2)},E.comparedTo=E.cmp=function(t,n){return R=1,a(this,new e(t,n))},E.decimalPlaces=E.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-o(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},E.dividedBy=E.div=function(t,n){return R=3,D(this,new e(t,n),j,q)},E.dividedToIntegerBy=E.divToInt=function(t,n){return R=4,D(this,new e(t,n),0,1)},E.equals=E.eq=function(t,n){return R=5,0===a(this,new e(t,n))},E.floor=function(){return S(new e(this),this.e+1,3)},E.greaterThan=E.gt=function(t,n){return R=6,a(this,new e(t,n))>0},E.greaterThanOrEqualTo=E.gte=function(t,n){return R=7,1===(n=a(this,new e(t,n)))||0===n},E.isFinite=function(){return!!this.c},E.isInteger=E.isInt=function(){return!!this.c&&o(this.e/I)>this.c.length-2},E.isNaN=function(){return!this.s},E.isNegative=E.isNeg=function(){return this.s<0},E.isZero=function(){return!!this.c&&0==this.c[0]},E.lessThan=E.lt=function(t,n){return R=8,a(this,new e(t,n))<0},E.lessThanOrEqualTo=E.lte=function(t,n){return R=9,-1===(n=a(this,new e(t,n)))||0===n},E.minus=E.sub=function(t,n){var r,i,a,s,u=this,c=u.s;if(R=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,u.plus(t);var l=u.e/I,f=t.e/I,p=u.c,h=t.c;if(!l||!f){if(!p||!h)return p?(t.s=-n,t):new e(h?u:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?u:3==q?-0:0)}if(l=o(l),f=o(f),p=p.slice(),c=l-f){for((s=0>c)?(c=-c,a=p):(f=l,a=h),a.reverse(),n=c;n--;a.push(0));a.reverse()}else for(i=(s=(c=p.length)<(n=h.length))?c:n,c=n=0;i>n;n++)if(p[n]!=h[n]){s=p[n]0)for(;n--;p[r++]=0);for(n=F-1;i>c;){if(p[--i]0?(u=s,r=l):(a=-a,r=c),r.reverse();a--;r.push(0));r.reverse()}for(a=c.length,n=l.length,0>a-n&&(r=l,l=c,c=r,n=a),a=0;n;)a=(c[--n]=c[n]+l[n]+a)/F|0,c[n]%=F;return a&&(c.unshift(a),++u),P(t,c,u)},E.precision=E.sd=function(t){ +var e,n,r=this,o=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(W&&C(13,"argument"+b,t),t!=!!t&&(t=null)),!o)return null;if(n=o.length-1,e=n*I+1,n=o[n]){for(;n%10==0;n/=10,e--);for(n=o[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},E.round=function(t,n){var r=new e(this);return(null==t||z(t,0,O,15))&&S(r,~~t+this.e+1,null!=n&&z(n,0,8,15,w)?0|n:q),r},E.shift=function(t){var n=this;return z(t,-k,k,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-k>t||t>k)?n.s*(0>t?0:1/0):n)},E.squareRoot=E.sqrt=function(){var t,n,r,a,s,u=this,c=u.c,l=u.s,f=u.e,p=j+4,h=new e("0.5");if(1!==l||!c||!c[0])return new e(!l||0>l&&(!c||c[0])?0/0:c?u:1/0);if(l=Math.sqrt(+u),0==l||l==1/0?(n=i(c),(n.length+f)%2==0&&(n+="0"),l=Math.sqrt(n),f=o((f+1)/2)-(0>f||f%2),l==1/0?n="1e"+f:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+f),r=new e(n)):r=new e(l+""),r.c[0])for(f=r.e,l=f+p,3>l&&(l=0);;)if(s=r,r=h.times(s.plus(D(u,s,p,1))),i(s.c).slice(0,l)===(n=i(r.c)).slice(0,l)){if(r.el&&(g=w,w=_,_=g,a=l,l=h,h=a),a=l+h,g=[];a--;g.push(0));for(y=F,v=N,a=h;--a>=0;){for(r=0,m=_[a]%v,d=_[a]/v|0,u=l,s=a+u;s>a;)f=w[--u]%v,p=w[u]/v|0,c=d*f+p*m,f=m*f+c%v*v+g[s]+r,r=(f/y|0)+(c/v|0)+d*p,g[s--]=f%y;g[s]=r}return r?++i:g.shift(),P(t,g,i)},E.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,O,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,w)?0|n:q,t?S(r,t,n):r},E.toExponential=function(t,e){return h(this,null!=t&&z(t,0,O,19)?~~t+1:null,e,19)},E.toFixed=function(t,e){return h(this,null!=t&&z(t,0,O,20)?~~t+this.e+1:null,e,20)},E.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,O,21)?~~t+this.e+1:null,e,21);if(this.c){var r,o=n.split("."),i=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,u=o[0],c=o[1],l=this.s<0,f=l?u.slice(1):u,p=f.length;if(a&&(r=i,i=a,a=r,p-=r),i>0&&p>0){for(r=p%i||i,u=f.substr(0,r);p>r;r+=i)u+=s+f.substr(r,i);a>0&&(u+=s+f.slice(r)),l&&(u="-"+u)}n=c?u+X.decimalSeparator+((a=+X.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):c):u}return n},E.toFraction=function(t){var n,r,o,a,s,u,c,l,f,p=W,h=this,m=h.c,d=new e(H),g=r=new e(H),y=c=new e(H);if(null!=t&&(W=!1,u=new e(t),W=p,(!(p=u.isInt())||u.lt(H))&&(W&&C(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&u.c&&S(u,u.e+1,1).gte(H)?u:null)),!m)return h.toString();for(f=i(m),a=d.e=f.length-h.e-1,d.c[0]=B[(s=a%I)<0?I+s:s],t=!t||u.cmp(d)>0?a>0?d:g:u,s=G,G=1/0,u=new e(f),c.c[0]=0;l=D(u,d,0,1),o=r.plus(l.times(y)),1!=o.cmp(t);)r=y,y=o,g=c.plus(l.times(o=g)),c=o,d=u.minus(l.times(o=d)),u=o;return o=D(t.minus(r),y,0,1),c=c.plus(o.times(g)),r=r.plus(o.times(y)),c.s=g.s=h.s,a*=2,n=D(g,y,a,q).minus(h).abs().cmp(D(c,r,a,q).minus(h).abs())<1?[g.toString(),y.toString()]:[c.toString(),r.toString()],G=s,n},E.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},E.toPower=E.pow=function(t){var n,r,o=v(0>t?-t:+t),i=this;if(!z(t,-k,k,23,"exponent")&&(!isFinite(t)||o>k&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+i,t));for(n=$?y($/I+2):0,r=new e(H);;){if(o%2){if(r=r.times(i),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(o=v(o/2),!o)break;i=i.times(i),n&&i.c&&i.c.length>n&&(i.c.length=n)}return 0>t&&(r=H.div(r)),n?S(r,$,q):r},E.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,O,24,"precision")?0|t:null,e,24)},E.toString=function(t){var e,r=this,o=r.s,a=r.e;return null===a?o?(e="Infinity",0>o&&(e="-"+e)):e="NaN":(e=i(r.c),e=null!=t&&z(t,2,64,25,"base")?n(f(e,a),0|t,10,o):L>=a||a>=U?l(e,a):f(e,a),0>o&&r.c[0]&&(e="-"+e)),e},E.truncated=E.trunc=function(){return S(new e(this),this.e+1,1)},E.valueOf=E.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function o(t){var e=0|t;return t>0||t===e?e:e-1}function i(t){for(var e,n,r=1,o=t.length,i=t[0]+"";o>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);i+=e}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function a(t,e){var n,r,o=t.c,i=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=0>a,r=u==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return u>c^n?1:-1;for(s=(u=o.length)<(c=i.length)?u:c,a=0;s>a;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return u==c?0:u>c^n?1:-1}function s(t,e,n){return(t=p(t))>=e&&n>=t}function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,o,i=[0],a=0,s=t.length;s>a;){for(o=i.length;o--;i[o]*=e);for(i[r=0]+=x.indexOf(t.charAt(a++));rn-1&&(null==i[r+1]&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function l(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function f(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?y(t):v(t)}var h,m,d,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=Math.ceil,v=Math.floor,b=" not a boolean or binary digit",w="rounding mode",_="number type has more than 15 significant digits",x="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",F=1e14,I=14,k=9007199254740991,B=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],N=1e7,O=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!m)try{m=t("crypto")}catch(T){}}else n.BigNumber=h}(this)},{crypto:32}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.IpcProvider=t("./lib/web3/ipcprovider"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":12,"./lib/web3/httpprovider":20,"./lib/web3/ipcprovider":22,"./lib/web3/namereg":25,"./lib/web3/transfer":30}]},{},["web3"]); \ No newline at end of file diff --git a/libjsqrc/ethereumjs/lib/web3/shh.js b/libjsqrc/ethereumjs/lib/web3/shh.js index 0ee4cf4a621..75c90319459 100644 --- a/libjsqrc/ethereumjs/lib/web3/shh.js +++ b/libjsqrc/ethereumjs/lib/web3/shh.js @@ -54,12 +54,34 @@ var addToGroup = new Method({ params: 0 }); + +var newFilter = new Method({ + name: 'newFilter', + call: 'shh_newFilter', + params: 1 +}); + +var getFilterChanges = new Method({ + name: 'getFilterChanges', + call: 'shh_getFilterChanges', + params: 1 +}); + +var getMessages = new Method({ + name: 'getMessages', + call: 'shh_getMessages', + params: 1 +}) + var methods = [ post, newIdentity, hasIdentity, newGroup, - addToGroup + addToGroup, + newFilter, + getFilterChanges, + getMessages ]; module.exports = { From 291fbcbd3b4adb6f9f68dbba495b32620b976faf Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 16:38:38 +0300 Subject: [PATCH 24/57] BlockChainTests mining --- libethereum/Block.cpp | 2 +- libethereum/Block.h | 5 +++-- test/libethereum/blockchain.cpp | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libethereum/Block.cpp b/libethereum/Block.cpp index 1c8dc1b211a..fd2a5152772 100644 --- a/libethereum/Block.cpp +++ b/libethereum/Block.cpp @@ -709,7 +709,7 @@ bool Block::sealBlock(bytesConstRef _header) ret.appendRaw(m_currentTxs); ret.appendRaw(m_currentUncles); ret.swapOut(m_currentBytes); - m_currentBlock = BlockInfo(_header, CheckNothing, h256(), HeaderData); + m_currentBlock = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData); cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash() << ")"; // TODO: move into Sealer StructuredLogger::minedNewBlock( diff --git a/libethereum/Block.h b/libethereum/Block.h index feadbba7344..f030661f118 100644 --- a/libethereum/Block.h +++ b/libethereum/Block.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "Account.h" @@ -252,7 +253,7 @@ class Block bytes const& blockData() const { return m_currentBytes; } /// Get the header information on the present block. - BlockInfo const& info() const { return m_currentBlock; } + Ethash::BlockHeader const& info() const { return m_currentBlock; } private: @@ -288,7 +289,7 @@ class Block State m_precommit; ///< State at the point immediately prior to rewards. BlockInfo m_previousBlock; ///< The previous block's information. - BlockInfo m_currentBlock; ///< The current block's information. + Ethash::BlockHeader m_currentBlock; ///< The current block's information. bytes m_currentBytes; ///< The current block. bool m_committedToMine = false; ///< Have we committed to mine on the present m_currentBlock? diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 83a50a1f79b..6cc4e8d05ec 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -143,7 +143,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiBlocks.clear(); vBiBlocks.push_back(biGenesisBlock); - TransientDirectory td_stateDB, td_bc; + TransientDirectory td_bc; + TransientDirectory td_stateDB; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); @@ -206,7 +207,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //block.commitToSeal(bc); //Block block(State::openDB(bc.genesisHash()), BaseState::Empty, biGenesisBlock.beneficiary()); - Block block = bc.genesisBlock(State::openDB(bc.genesisHash())); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK + + //trueState TempDir default constructor for bc's state same as for trueState ? + Block block = bc.genesisBlock(trueState.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK //Block block (State::openDB(biGenesisBlock.hash())); //Block block(state.db(), BaseState::Empty); //mine a new block on top of previously imported From 4ca36087252e0af9d6fb0c278f9bcb33ac078af2 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 17:21:34 +0300 Subject: [PATCH 25/57] Mining --- test/libethereum/blockchain.cpp | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 6cc4e8d05ec..9ed4d21b50c 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -78,20 +78,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); - - /// Trick - //merge into init state string our test predefined state and change difficulty for testing - //string genesisState = *(const_cast(&c_genesisInfoFrontier/*c_genesisInfoOlympic*/)); - /*size_t pos = genesisState.find("alloc"); - string sss = json_spirit::write_string(o["pre"], true); - sss.replace(0, 1, ""); - sss.replace(sss.length() - 2, 2, ","); - genesisState.insert(pos + 9, sss); - genesisState.replace(genesisState.find("0x400000000"), 7, "0x20000"); - note << genesisState; - */ - /// - //Imported blocks from the start std::vector blockSets; //Block(bytes) => UncleList(Blocks(bytes)) @@ -148,7 +134,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state = importer.m_statePre; + State state(OverlayDB(State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; + ImportTest::importState(o["pre"].get_obj(), state); state.commit(); //import previous blocks @@ -164,7 +151,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) bc.sync(uncleQueue, state.db(), 4); bc.attemptImport(blockFromSet, state.db()); vBiBlocks.push_back(BlockHeader(blockFromSet)); - //state.sync(bc); } // get txs @@ -204,15 +190,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } bc.sync(uncleBlockQueue, state.db(), 4); - //block.commitToSeal(bc); - //Block block(State::openDB(bc.genesisHash()), BaseState::Empty, biGenesisBlock.beneficiary()); - - //trueState TempDir default constructor for bc's state same as for trueState ? - Block block = bc.genesisBlock(trueState.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK - //Block block (State::openDB(biGenesisBlock.hash())); - //Block block(state.db(), BaseState::Empty); - //mine a new block on top of previously imported + Block block = bc.genesisBlock(state.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK try { block.sync(bc); @@ -230,7 +209,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) return; } - blObj["rlp"] = toHex(block.blockData(), 2, HexPrefix::Add); //get valid transactions From a72ba9ec45eafbe9270eb916aba4b42123b817ab Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 14 Aug 2015 20:52:35 +0200 Subject: [PATCH 26/57] Brain wallet in ethkey CLI. --- ethkey/KeyAux.h | 460 +++++++++++++++++++++++++++--------------------- 1 file changed, 262 insertions(+), 198 deletions(-) diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index 74f89ad4a65..d69b801bbf1 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -33,6 +33,7 @@ #include #include #include +#include #include "BuildInfo.h" using namespace std; using namespace dev; @@ -108,6 +109,9 @@ class KeyCLI Export, Recode, Kill, + NewBrain, + ImportBrain, + InspectBrain, SignTx, DecodeTx, }; @@ -175,6 +179,18 @@ class KeyCLI m_inputs = strings(1, argv[++i]); m_name = argv[++i]; } + else if (arg == "--new-brain" && i + 1 < argc) + { + m_mode = OperationMode::NewBrain; + m_name = argv[++i]; + } + else if (arg == "--import-brain" && i + 1 < argc) + { + m_mode = OperationMode::ImportBrain; + m_name = argv[++i]; + } + else if (arg == "--inspect-brain") + m_mode = OperationMode::InspectBrain; else if (arg == "--import-with-address" && i + 3 < argc) { m_mode = OperationMode::ImportWithAddress; @@ -203,9 +219,34 @@ class KeyCLI return k; } + Secret getSecret(std::string const& _signKey) + { + string json = contentsString(_signKey); + if (!json.empty()) + return Secret(secretStore().secret(secretStore().readKeyContent(json), [&](){ return getPassword("Enter password for key: "); })); + else + { + if (h128 u = fromUUID(_signKey)) + return Secret(secretStore().secret(u, [&](){ return getPassword("Enter password for key: "); })); + else if (Address a = Address(_signKey)) + return keyManager().secret(a, [&](){ return getPassword("Enter password for key (hint:" + keyManager().passwordHint(a) + "): "); }); + else if (_signKey.substr(0, 6) == "brain:") + return KeyManager::brain(_signKey.substr(6)); + else if (_signKey == "brain") + return KeyManager::brain(getPassword("Enter brain wallet phrase: ")); + else + { + cerr << "Bad file, UUID and address: " << _signKey << endl; + exit(-1); + } + } + } + void execute() { - if (m_mode == OperationMode::CreateWallet) + switch (m_mode) + { + case OperationMode::CreateWallet: { KeyManager wallet(m_walletPath, m_secretsPath); if (m_masterPassword.empty()) @@ -223,8 +264,9 @@ class KeyCLI cerr << "unable to create wallet" << endl << boost::diagnostic_information(_e); } } + break; } - else if (m_mode == OperationMode::DecodeTx) + case OperationMode::DecodeTx: { bytes b = inputData(m_inputs[0]); if (b.empty()) @@ -269,50 +311,11 @@ class KeyCLI { cerr << "Invalid transaction: " << ex.what() << endl; } + break; } - else if (m_mode == OperationMode::SignTx) + case OperationMode::SignTx: { - Secret s; - - string json = contentsString(m_signKey); - if (!json.empty()) - { - SecretStore store(m_secretsPath); - s = Secret(store.secret(store.readKeyContent(json), [&](){ return getPassword("Enter password for key: "); })); - } - else - { - if (h128 u = fromUUID(m_signKey)) - { - SecretStore store(m_secretsPath); - s = Secret(store.secret(u, [&](){ return getPassword("Enter password for key: "); })); - } - else if (Address a = Address(m_signKey)) - { - KeyManager wallet(m_walletPath, m_secretsPath); - if (wallet.exists()) - { - openWallet(wallet); - s = wallet.secret(a, [&](){ return getPassword("Enter password for key: "); }); - } - else - { - cerr << "Wallet doesn't exist." << endl; - exit(-1); - } - } - else - { - cerr << "Bad file, UUID and address: " << m_signKey << endl; - exit(-1); - } - } - if (!s) - { - cerr << "UUID/address not found: " << m_signKey << endl; - exit(-1); - } - + Secret s = getSecret(m_signKey); for (string const& i: m_inputs) { bool isFile; @@ -338,182 +341,208 @@ class KeyCLI cerr << "Invalid transaction: " << ex.what() << endl; } } + break; } - else if (m_mode < OperationMode::CreateWallet) + case OperationMode::NewBrain: { - SecretStore store(m_secretsPath); - switch (m_mode) - { - case OperationMode::ListBare: - for (h128 const& u: std::set() + store.keys()) - cout << toUUID(u) << endl; - break; - case OperationMode::NewBare: + if (m_name != "--") + keyManager(); + boost::random_device d; + boost::random::uniform_int_distribution pickWord(0, WordList.size() - 1); + string seed; + for (int i = 0; i < 13; ++i) + seed += (seed.size() ? " " : "") + WordList[pickWord(d)]; + cout << "Your brain key phrase: <<" << seed << ">>" << endl; + if (m_name != "--") { - if (m_lock.empty()) - m_lock = createPassword("Enter a password with which to secure this account: "); - auto k = makeKey(); - h128 u = store.importSecret(k.secret().ref(), m_lock); - cout << "Created key " << toUUID(u) << endl; - cout << " Address: " << k.address().hex() << endl; - cout << " ICAP: " << ICAP(k.address()).encoded() << endl; - break; - } - case OperationMode::ImportBare: - for (string const& input: m_inputs) - { - h128 u; - bytesSec b; - b.writable() = fromHex(input); - if (b.size() != 32) - { - std::string s = contentsString(input); - b.writable() = fromHex(s); - if (b.size() != 32) - u = store.importKey(input); - } - if (!u && b.size() == 32) - u = store.importSecret(b, lockPassword(toAddress(Secret(b)).abridged())); - if (!u) - { - cerr << "Cannot import " << input << " not a file or secret." << endl; - continue; - } - cout << "Successfully imported " << input << " as " << toUUID(u); - } - break; - case OperationMode::InspectBare: - for (auto const& i: m_inputs) - if (!contents(i).empty()) - { - h128 u = store.readKey(i, false); - bytesSec s = store.secret(u, [&](){ return getPassword("Enter password for key " + i + ": "); }); - cout << "Key " << i << ":" << endl; - cout << " UUID: " << toUUID(u) << ":" << endl; - cout << " Address: " << toAddress(Secret(s)).hex() << endl; - cout << " Secret: " << toHex(s.ref().cropped(0, 8)) << "..." << endl; - } - else if (h128 u = fromUUID(i)) - { - bytesSec s = store.secret(u, [&](){ return getPassword("Enter password for key " + toUUID(u) + ": "); }); - cout << "Key " << i << ":" << endl; - cout << " Address: " << toAddress(Secret(s)).hex() << endl; - cout << " Secret: " << toHex(s.ref().cropped(0, 8)) << "..." << endl; - } - else - cerr << "Couldn't inspect " << i << "; not found." << endl; - break; - case OperationMode::ExportBare: break; - case OperationMode::RecodeBare: - for (auto const& i: m_inputs) - if (h128 u = fromUUID(i)) - if (store.recode(u, lockPassword(toUUID(u)), [&](){ return getPassword("Enter password for key " + toUUID(u) + ": "); }, kdf())) - cerr << "Re-encoded " << toUUID(u) << endl; - else - cerr << "Couldn't re-encode " << toUUID(u) << "; key corrupt or incorrect password supplied." << endl; - else - cerr << "Couldn't re-encode " << i << "; not found." << endl; - break; - case OperationMode::KillBare: - for (auto const& i: m_inputs) - if (h128 u = fromUUID(i)) - store.kill(u); - else - cerr << "Couldn't kill " << i << "; not found." << endl; - break; - default: break; + std::string hint; + cout << "Enter a hint for the phrase if you want: " << flush; + getline(cin, hint); + Address a = keyManager().importBrain(seed, m_name, hint); + cout << a.abridged() << endl; + cout << " ICAP: " << ICAP(a).encoded() << endl; + cout << " Address: " << a.hex() << endl; } + break; } - else + case OperationMode::InspectBrain: { - KeyManager wallet(m_walletPath, m_secretsPath); - if (wallet.exists()) - openWallet(wallet); - else - { - cerr << "Couldn't open wallet. Does it exist?" << endl; - exit(-1); - } - switch (m_mode) - { - case OperationMode::New: - { - tie(m_lock, m_lockHint) = createPassword(wallet, "Enter a password with which to secure this account (or nothing to use the master password): ", m_lock, m_lockHint); - auto k = makeKey(); - bool usesMaster = m_lock.empty(); - h128 u = usesMaster ? wallet.import(k.secret(), m_name) : wallet.import(k.secret(), m_name, m_lock, m_lockHint); - cout << "Created key " << toUUID(u) << endl; - cout << " Name: " << m_name << endl; - if (usesMaster) - cout << " Uses master password." << endl; - else - cout << " Password hint: " << m_lockHint << endl; - cout << " Address: " << k.address().hex() << endl; - cout << " ICAP: " << ICAP(k.address()).encoded() << endl; - break; - } - case OperationMode::ImportWithAddress: + Address a = toAddress(KeyManager::brain(getPassword("Enter brain wallet key phrase: "))); + cout << a.abridged() << endl; + cout << " ICAP: " << ICAP(a).encoded() << endl; + cout << " Address: " << a.hex() << endl; + break; + } + case OperationMode::ListBare: + for (h128 const& u: std::set() + secretStore().keys()) + cout << toUUID(u) << endl; + break; + case OperationMode::NewBare: + { + if (m_lock.empty()) + m_lock = createPassword("Enter a password with which to secure this account: "); + auto k = makeKey(); + h128 u = secretStore().importSecret(k.secret().ref(), m_lock); + cout << "Created key " << toUUID(u) << endl; + cout << " Address: " << k.address().hex() << endl; + cout << " ICAP: " << ICAP(k.address()).encoded() << endl; + break; + } + case OperationMode::ImportBare: + for (string const& input: m_inputs) { - string const& i = m_inputs[0]; h128 u; bytesSec b; - b.writable() = fromHex(i); + b.writable() = fromHex(input); if (b.size() != 32) { - std::string s = contentsString(i); + std::string s = contentsString(input); b.writable() = fromHex(s); if (b.size() != 32) - u = wallet.store().importKey(i); + u = secretStore().importKey(input); } if (!u && b.size() == 32) - u = wallet.store().importSecret(b, lockPassword(toAddress(Secret(b)).abridged())); + u = secretStore().importSecret(b, lockPassword(toAddress(Secret(b)).abridged())); if (!u) { - cerr << "Cannot import " << i << " not a file or secret." << endl; - break; + cerr << "Cannot import " << input << " not a file or secret." << endl; + continue; } - wallet.importExisting(u, m_name, m_address); - cout << "Successfully imported " << i << ":" << endl; - cout << " Name: " << m_name << endl; - cout << " Address: " << m_address << endl; - cout << " UUID: " << toUUID(u) << endl; - break; + cout << "Successfully imported " << input << " as " << toUUID(u); } - case OperationMode::ImportPresale: + break; + case OperationMode::InspectBare: + for (auto const& i: m_inputs) + if (!contents(i).empty()) + { + h128 u = secretStore().readKey(i, false); + bytesSec s = secretStore().secret(u, [&](){ return getPassword("Enter password for key " + i + ": "); }); + cout << "Key " << i << ":" << endl; + cout << " UUID: " << toUUID(u) << ":" << endl; + cout << " Address: " << toAddress(Secret(s)).hex() << endl; + cout << " Secret: " << toHex(s.ref().cropped(0, 8)) << "..." << endl; + } + else if (h128 u = fromUUID(i)) + { + bytesSec s = secretStore().secret(u, [&](){ return getPassword("Enter password for key " + toUUID(u) + ": "); }); + cout << "Key " << i << ":" << endl; + cout << " Address: " << toAddress(Secret(s)).hex() << endl; + cout << " Secret: " << toHex(s.ref().cropped(0, 8)) << "..." << endl; + } + else + cerr << "Couldn't inspect " << i << "; not found." << endl; + break; + case OperationMode::ExportBare: break; + case OperationMode::RecodeBare: + for (auto const& i: m_inputs) + if (h128 u = fromUUID(i)) + if (secretStore().recode(u, lockPassword(toUUID(u)), [&](){ return getPassword("Enter password for key " + toUUID(u) + ": "); }, kdf())) + cerr << "Re-encoded " << toUUID(u) << endl; + else + cerr << "Couldn't re-encode " << toUUID(u) << "; key corrupt or incorrect password supplied." << endl; + else + cerr << "Couldn't re-encode " << i << "; not found." << endl; + break; + case OperationMode::KillBare: + for (auto const& i: m_inputs) + if (h128 u = fromUUID(i)) + secretStore().kill(u); + else + cerr << "Couldn't kill " << i << "; not found." << endl; + break; + case OperationMode::New: + { + keyManager(); + tie(m_lock, m_lockHint) = createPassword(keyManager(), "Enter a password with which to secure this account (or nothing to use the master password): ", m_lock, m_lockHint); + auto k = makeKey(); + bool usesMaster = m_lock.empty(); + h128 u = usesMaster ? keyManager().import(k.secret(), m_name) : keyManager().import(k.secret(), m_name, m_lock, m_lockHint); + cout << "Created key " << toUUID(u) << endl; + cout << " Name: " << m_name << endl; + if (usesMaster) + cout << " Uses master password." << endl; + else + cout << " Password hint: " << m_lockHint << endl; + cout << " Address: " << k.address().hex() << endl; + cout << " ICAP: " << ICAP(k.address()).encoded() << endl; + break; + } + case OperationMode::ImportWithAddress: + { + keyManager(); + string const& i = m_inputs[0]; + h128 u; + bytesSec b; + b.writable() = fromHex(i); + if (b.size() != 32) { - std::string pw; - KeyPair k = wallet.presaleSecret(contentsString(m_inputs[0]), [&](bool){ return (pw = getPassword("Enter the password for the presale key: ")); }); - wallet.import(k.secret(), m_name, pw, "Same password as used for presale key"); - break; + std::string s = contentsString(i); + b.writable() = fromHex(s); + if (b.size() != 32) + u = keyManager().store().importKey(i); } - case OperationMode::List: + if (!u && b.size() == 32) + u = keyManager().store().importSecret(b, lockPassword(toAddress(Secret(b)).abridged())); + if (!u) { - vector bare; - vector nonIcap; - for (auto const& u: wallet.store().keys()) - if (Address a = wallet.address(u)) - if (a[0]) - nonIcap.push_back(u); - else - { - cout << toUUID(u) << " " << a.abridged(); - cout << " " << ICAP(a).encoded(); - cout << " " << wallet.accountName(a) << endl; - } - else - bare.push_back(u); - for (auto const& u: nonIcap) - if (Address a = wallet.address(u)) - { - cout << toUUID(u) << " " << a.abridged(); - cout << " " << ICAP(a).encoded(); - cout << " " << wallet.accountName(a) << endl; - } - for (auto const& u: bare) - cout << toUUID(u) << " (Bare)" << endl; - } - default: break; + cerr << "Cannot import " << i << " not a file or secret." << endl; + break; } + keyManager().importExisting(u, m_name, m_address); + cout << "Successfully imported " << i << ":" << endl; + cout << " Name: " << m_name << endl; + cout << " Address: " << m_address << endl; + cout << " UUID: " << toUUID(u) << endl; + break; + } + case OperationMode::ImportBrain: + { + keyManager(); + std::string seed = getPassword("Enter brain wallet key phrase: "); + std::string hint; + cout << "Enter a hint for the phrase if you want: " << flush; + getline(cin, hint); + Address a = keyManager().importBrain(seed, m_name, hint); + cout << a << endl; + cout << " ICAP: " << ICAP(a).encoded() << endl; + cout << " Address: " << a.hex() << endl; + break; + } + case OperationMode::ImportPresale: + { + keyManager(); + std::string pw; + KeyPair k = keyManager().presaleSecret(contentsString(m_inputs[0]), [&](bool){ return (pw = getPassword("Enter the password for the presale key: ")); }); + keyManager().import(k.secret(), m_name, pw, "Same password as used for presale key"); + break; + } + case OperationMode::List: + { + vector bare; + AddressHash got; + + for (auto const& u: keyManager().store().keys()) + if (Address a = keyManager().address(u)) + { + got.insert(a); + cout << toUUID(u) << " " << a.abridged(); + string s = ICAP(a).encoded(); + cout << " " << s << string(35 - s.size(), ' '); + cout << " " << keyManager().accountName(a) << endl; + } + else + bare.push_back(u); + for (auto const& a: keyManager().accounts()) + if (!got.count(a)) + { + cout << " (Brain) " << a.abridged(); + cout << " " << ICAP(a).encoded() << " "; + cout << " " << keyManager().accountName(a) << endl; + } + for (auto const& u: bare) + cout << toUUID(u) << " (Bare)" << endl; + } + default: break; } } @@ -544,6 +573,12 @@ class KeyCLI << " --import-with-address [||]
Import keys from given source with given address and place in wallet." << endl << " -e,--export [
| , ... ] Export given keys." << endl << " -r,--recode [
|| , ... ] Decrypt and re-encrypt given keys." << endl + << "Brain wallet operating modes:" << endl + << "WARNING: Brain wallets with human-generated passphrasses are highly susceptible to attack. Don't use such a thing for" << endl + << "anything important." << endl + << " --new-brain [ |-- ] Create a new 13-word brain wallet; argument is the name or if --, do not add to wallet."<< endl + << " --import-brain Import your own brain wallet." << endl + << " --inspect-brain Check the address of a particular brain wallet." << endl << "Wallet configuration:" << endl << " --create-wallet Create an Ethereum master wallet." << endl << " --wallet-path Specify Ethereum wallet path (default: " << KeyManager::defaultPath() << ")" << endl @@ -551,7 +586,7 @@ class KeyCLI << endl << "Transaction operating modes:" << endl << " -d,--decode-tx [|] Decode given transaction." << endl - << " -s,--sign-tx [
|| ] [ | , ... ] (Re-)Sign given transaction." << endl + << " -s,--sign-tx [
|||brain(:) ] [ | , ... ] (Re-)Sign given transaction." << endl << endl << "Encryption configuration:" << endl << " --kdf Specify KDF to use when encrypting (default: sc rypt)" << endl @@ -613,6 +648,35 @@ class KeyCLI KDF kdf() const { return m_kdf == "pbkdf2" ? KDF::PBKDF2_SHA256 : KDF::Scrypt; } + KeyManager& keyManager() + { + if (!m_keyManager) + { + m_keyManager.reset(new KeyManager(m_walletPath, m_secretsPath)); + if (m_keyManager->exists()) + openWallet(*m_keyManager); + else + { + cerr << "Couldn't open wallet. Does it exist?" << endl; + exit(-1); + } + } + return *m_keyManager; + } + + SecretStore& secretStore() + { + if (m_keyManager) + return m_keyManager->store(); + if (!m_secretStore) + m_secretStore.reset(new SecretStore(m_secretsPath)); + return *m_secretStore; + } + + /// Where the keys are. + unique_ptr m_secretStore; + unique_ptr m_keyManager; + /// Operating mode. OperationMode m_mode; From 77da5246e6e92f524ec6ab2143f24ad4f48d5028 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 14 Aug 2015 23:22:57 +0200 Subject: [PATCH 27/57] clean up --- test/libethereum/blockchain.cpp | 52 +++++++++++++++------------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 9ed4d21b50c..1626a9e2b44 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -47,7 +47,7 @@ BlockHeader constructBlock(mObject& _o, h256 const& _stateRoot = h256{}); bytes createBlockRLPFromFields(mObject& _tObj, h256 const& _stateRoot = h256{}); RLPStream createFullBlockFromHeader(BlockHeader const& _bi, bytes const& _txs = RLPEmptyList, bytes const& _uncles = RLPEmptyList); -mArray writeTransactionsToJson(Transactions const& txs); +mArray writeTransactionsToJson(Transactions const& _txs); mObject writeBlockHeaderToJson(mObject& _o, BlockHeader const& _bi); void overwriteBlockHeader(BlockHeader& _current_BlockHeader, mObject& _blObj, const BlockHeader& _parent); void updatePoW(BlockHeader& _bi); @@ -55,8 +55,6 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vect void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { - _fillin = true; - for (auto& i: _v.get_obj()) { mObject& o = i.second.get_obj(); @@ -66,20 +64,20 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) continue; } - cerr << i.first << endl; + cout << i.first << endl; TBOOST_REQUIRE(o.count("genesisBlockHeader")); TBOOST_REQUIRE(o.count("pre")); ImportTest importer(o, _fillin, testType::BlockChainTests); - TransientDirectory td_stateDB_tmp; + TransientDirectory tdStateDB; BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); - State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); + State trueState(OverlayDB(State::openDB(tdStateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); //Imported blocks from the start - std::vector blockSets; //Block(bytes) => UncleList(Blocks(bytes)) + vector blockSets; //Block(bytes) => UncleList(Blocks(bytes)) if (_fillin) biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), trueState.rootHash()); @@ -121,7 +119,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { mObject blObj = bl.get_obj(); if (blObj.count("blocknumber") > 0) - importBlockNumber = std::max((int)toInt(blObj["blocknumber"]), 1); + importBlockNumber = max((int)toInt(blObj["blocknumber"]), 1); else importBlockNumber++; @@ -129,12 +127,12 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiBlocks.clear(); vBiBlocks.push_back(biGenesisBlock); - TransientDirectory td_bc; - TransientDirectory td_stateDB; - FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); + TransientDirectory tdBc; + TransientDirectory tdStateDB; + FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), tdBc.path(), WithExisting::Kill); //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state(OverlayDB(State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; + State state(OverlayDB(State::openDB(tdStateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; ImportTest::importState(o["pre"].get_obj(), state); state.commit(); @@ -191,7 +189,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) bc.sync(uncleBlockQueue, state.db(), 4); - Block block = bc.genesisBlock(state.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK + Block block = bc.genesisBlock(state.db()); try { block.sync(bc); @@ -257,38 +255,35 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) txStream.appendRaw(txrlp.out()); } - RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); + RLPStream blockRLP = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); - blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); + blObj["rlp"] = toHex(blockRLP.out(), 2, HexPrefix::Add); - if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) + if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(blockRLP.out())[0].data())) { cnote << "block header mismatch block.blockData() vs updated block.info()\n"; - cerr << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(block2.out())[0].data()); + cnote << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(blockRLP.out())[0].data()); } - if (sha3(RLP(block.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) + if (sha3(RLP(block.blockData())[1].data()) != sha3(RLP(blockRLP.out())[1].data())) cnote << "txs mismatch\n"; - if (sha3(RLP(block.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) - cnote << "uncle list mismatch\n" << RLP(block.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); + if (sha3(RLP(block.blockData())[2].data()) != sha3(RLP(blockRLP.out())[2].data())) + cnote << "uncle list mismatch\n" << RLP(block.blockData())[2].data() << "\n" << RLP(blockRLP.out())[2].data(); try { block.sync(bc); - bc.import(block2.out(), block.db()); + bc.import(blockRLP.out(), block.db()); block.sync(bc); - //block.commit(); - //there we get new blockchain status in state which could have more difficulty than we have in trueState //attempt to import new block to the true blockchain trueBc.sync(uncleBlockQueue, trueState.db(), 4); - trueBc.attemptImport(block2.out(), trueState.db()); - //trueState.sync(trueBc); + trueBc.attemptImport(blockRLP.out(), trueState.db()); blockSet newBlock; - newBlock.first = block2.out(); + newBlock.first = blockRLP.out(); newBlock.second = uncleBlockQueueList; if (importBlockNumber < blockSets.size()) { @@ -561,7 +556,6 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vect // make uncle header valid uncleBlockFromFields.setTimestamp((u256)time(0)); - cnote << "uncle block n = " << toString(uncleBlockFromFields.number()); if (_vBiBlocks.size() > 2) { if (uncleBlockFromFields.number() - 1 < _vBiBlocks.size()) @@ -747,10 +741,10 @@ void updatePoW(BlockHeader& _bi) _bi.noteDirty(); } -mArray writeTransactionsToJson(Transactions const& txs) +mArray writeTransactionsToJson(Transactions const& _txs) { mArray txArray; - for (auto const& txi: txs) + for (auto const& txi: _txs) { mObject txObject = fillJsonWithTransaction(txi); txArray.push_back(txObject); From e087e69213bb4c677ce548e4c176f53e0d09a003 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Tue, 11 Aug 2015 17:26:21 +0300 Subject: [PATCH 28/57] BLock2: state test filling issue --- test/libethereum/state.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 30c0ccff0dc..c37169949d9 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -62,7 +62,6 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) const State importedStatePost = importer.m_statePost; bytes output; - // execute transaction Listener::ExecTimeGuard guard{i.first}; output = importer.executeTest(); From feea9ae73bd2045c2b38bbd9aa65ca8421ce4ac9 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 12 Aug 2015 17:16:40 +0300 Subject: [PATCH 29/57] restore lost changes blockmining --- test/libethereum/blockchain.cpp | 237 ++++++++++++++++---------------- 1 file changed, 118 insertions(+), 119 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 3ec62368517..df50e33181f 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -73,7 +73,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); - importer.importState(o["pre"].get_obj(), trueState); + ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); @@ -189,7 +189,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } } bc.sync(uncleBlockQueue, state.db(), 4); - block.commitToSeal(bc); //mine a new block on top of previously imported try @@ -210,125 +209,125 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } -// blObj["rlp"] = toHex(state.blockData(), 2, HexPrefix::Add); - -// //get valid transactions -// Transactions txList; -// for (auto const& txi: txs.topTransactions(std::numeric_limits::max())) -// txList.push_back(txi); -// blObj["transactions"] = writeTransactionsToJson(txList); - -// BlockHeader current_BlockHeader = state.info(); - -// RLPStream uncleStream; -// uncleStream.appendList(vBiUncles.size()); -// for (unsigned i = 0; i < vBiUncles.size(); ++i) -// { -// RLPStream uncleRlp; -// vBiUncles[i].streamRLP(uncleRlp); -// uncleStream.appendRaw(uncleRlp.out()); -// } - -// if (blObj.count("blockHeader")) -// overwriteBlockHeader(current_BlockHeader, blObj); - -// if (blObj.count("blockHeader") && blObj["blockHeader"].get_obj().count("bruncle")) -// current_BlockHeader.populateFromParent(vBiBlocks[vBiBlocks.size() -1]); - -// if (vBiUncles.size()) -// { -// // update unclehash in case of invalid uncles -// current_BlockHeader.setSha3Uncles(sha3(uncleStream.out())); -// updatePoW(current_BlockHeader); -// } - -// // write block header -// mObject oBlockHeader; -// writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); -// blObj["blockHeader"] = oBlockHeader; -// vBiBlocks.push_back(current_BlockHeader); - -// // compare blocks from state and from rlp -// RLPStream txStream; -// txStream.appendList(txList.size()); -// for (unsigned i = 0; i < txList.size(); ++i) -// { -// RLPStream txrlp; -// txList[i].streamRLP(txrlp); -// txStream.appendRaw(txrlp.out()); -// } - -// RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); - -// blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); - -// if (sha3(RLP(state.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) -// { -// cnote << "block header mismatch state.blockData() vs updated state.info()\n"; -// cerr << toHex(state.blockData()) << "vs" << toHex(block2.out()); -// } - -// if (sha3(RLP(state.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) -// cnote << "txs mismatch\n"; - -// if (sha3(RLP(state.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) -// cnote << "uncle list mismatch\n" << RLP(state.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); - -// try -// { -// state.sync(bc); -// bc.import(block2.out(), state.db()); -// state.sync(bc); -// state.commit(); - -// //there we get new blockchain status in state which could have more difficulty than we have in trueState -// //attempt to import new block to the true blockchain -// trueBc.sync(uncleBlockQueue, trueState.db(), 4); -// trueBc.attemptImport(block2.out(), trueState.db()); -// trueState.sync(trueBc); - -// blockSet newBlock; -// newBlock.first = block2.out(); -// newBlock.second = uncleBlockQueueList; -// if (importBlockNumber < blockSets.size()) -// { -// //make new correct history of imported blocks -// blockSets[importBlockNumber] = newBlock; -// for (size_t i = importBlockNumber + 1; i < blockSets.size(); i++) -// blockSets.pop_back(); -// } -// else -// blockSets.push_back(newBlock); -// } -// // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given -// catch (...) -// { -// cnote << "block is invalid!\n"; -// blObj.erase(blObj.find("blockHeader")); -// blObj.erase(blObj.find("uncleHeaders")); -// blObj.erase(blObj.find("transactions")); -// } -// blArray.push_back(blObj); -// this_thread::sleep_for(chrono::seconds(1)); + blObj["rlp"] = toHex(block.blockData(), 2, HexPrefix::Add); + + //get valid transactions + Transactions txList; + for (auto const& txi: txs.topTransactions(std::numeric_limits::max())) + txList.push_back(txi); + blObj["transactions"] = writeTransactionsToJson(txList); + + BlockHeader current_BlockHeader = block.info(); + + RLPStream uncleStream; + uncleStream.appendList(vBiUncles.size()); + for (unsigned i = 0; i < vBiUncles.size(); ++i) + { + RLPStream uncleRlp; + vBiUncles[i].streamRLP(uncleRlp); + uncleStream.appendRaw(uncleRlp.out()); + } + + if (blObj.count("blockHeader")) + overwriteBlockHeader(current_BlockHeader, blObj, bc.info()); + + if (blObj.count("blockHeader") && blObj["blockHeader"].get_obj().count("bruncle")) + current_BlockHeader.populateFromParent(vBiBlocks[vBiBlocks.size() -1]); + + if (vBiUncles.size()) + { + // update unclehash in case of invalid uncles + current_BlockHeader.setSha3Uncles(sha3(uncleStream.out())); + updatePoW(current_BlockHeader); + } + + // write block header + mObject oBlockHeader; + writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); + blObj["blockHeader"] = oBlockHeader; + vBiBlocks.push_back(current_BlockHeader); + + // compare blocks from state and from rlp + RLPStream txStream; + txStream.appendList(txList.size()); + for (unsigned i = 0; i < txList.size(); ++i) + { + RLPStream txrlp; + txList[i].streamRLP(txrlp); + txStream.appendRaw(txrlp.out()); + } + + RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); + + blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); + + if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) + { + cnote << "block header mismatch block.blockData() vs updated block.info()\n"; + cerr << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(block2.out())[0].data()); + } + + if (sha3(RLP(block.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) + cnote << "txs mismatch\n"; + + if (sha3(RLP(block.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) + cnote << "uncle list mismatch\n" << RLP(block.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); + + try + { + block.sync(bc); + bc.import(block2.out(), block.db()); + block.sync(bc); + //block.commit(); + + //there we get new blockchain status in state which could have more difficulty than we have in trueState + //attempt to import new block to the true blockchain + trueBc.sync(uncleBlockQueue, trueState.db(), 4); + trueBc.attemptImport(block2.out(), trueState.db()); + //trueState.sync(trueBc); + + blockSet newBlock; + newBlock.first = block2.out(); + newBlock.second = uncleBlockQueueList; + if (importBlockNumber < blockSets.size()) + { + //make new correct history of imported blocks + blockSets[importBlockNumber] = newBlock; + for (size_t i = importBlockNumber + 1; i < blockSets.size(); i++) + blockSets.pop_back(); + } + else + blockSets.push_back(newBlock); + } + // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given + catch (...) + { + cnote << "block is invalid!\n"; + blObj.erase(blObj.find("blockHeader")); + blObj.erase(blObj.find("uncleHeaders")); + blObj.erase(blObj.find("transactions")); + } + blArray.push_back(blObj); + this_thread::sleep_for(chrono::seconds(1)); } //for blocks -// if (o.count("expect") > 0) -// { -// AccountMaskMap expectStateMap; -// State stateExpect(OverlayDB(), BaseState::Empty, biGenesisBlock.beneficiary()); -// ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); -// ImportTest::checkExpectedState(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); -// o.erase(o.find("expect")); -// } - -// o["blocks"] = blArray; -// o["postState"] = fillJsonWithState(trueState); -// o["lastblockhash"] = toString(trueBc.info().hash()); - -// //make all values hex in pre section -// State prestate(OverlayDB(), BaseState::Empty); -// ImportTest::importState(o["pre"].get_obj(), prestate); -// o["pre"] = fillJsonWithState(prestate); + if (o.count("expect") > 0) + { + AccountMaskMap expectStateMap; + State stateExpect(OverlayDB(), BaseState::Empty); + ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); + ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + o.erase(o.find("expect")); + } + + o["blocks"] = blArray; + o["postState"] = fillJsonWithState(trueState); + o["lastblockhash"] = toString(trueBc.info().hash()); + + //make all values hex in pre section + State prestate(OverlayDB(), BaseState::Empty); + ImportTest::importState(o["pre"].get_obj(), prestate); + o["pre"] = fillJsonWithState(prestate); }//_fillin else { From 238f17e79bed267af1b2a67e3b95d51a6e1a621d Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 16:38:38 +0300 Subject: [PATCH 30/57] BlockChainTests mining --- libethereum/Block.cpp | 2 +- libethereum/Block.h | 5 +++-- test/libethereum/blockchain.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libethereum/Block.cpp b/libethereum/Block.cpp index 1c8dc1b211a..fd2a5152772 100644 --- a/libethereum/Block.cpp +++ b/libethereum/Block.cpp @@ -709,7 +709,7 @@ bool Block::sealBlock(bytesConstRef _header) ret.appendRaw(m_currentTxs); ret.appendRaw(m_currentUncles); ret.swapOut(m_currentBytes); - m_currentBlock = BlockInfo(_header, CheckNothing, h256(), HeaderData); + m_currentBlock = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData); cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash() << ")"; // TODO: move into Sealer StructuredLogger::minedNewBlock( diff --git a/libethereum/Block.h b/libethereum/Block.h index feadbba7344..f030661f118 100644 --- a/libethereum/Block.h +++ b/libethereum/Block.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "Account.h" @@ -252,7 +253,7 @@ class Block bytes const& blockData() const { return m_currentBytes; } /// Get the header information on the present block. - BlockInfo const& info() const { return m_currentBlock; } + Ethash::BlockHeader const& info() const { return m_currentBlock; } private: @@ -288,7 +289,7 @@ class Block State m_precommit; ///< State at the point immediately prior to rewards. BlockInfo m_previousBlock; ///< The previous block's information. - BlockInfo m_currentBlock; ///< The current block's information. + Ethash::BlockHeader m_currentBlock; ///< The current block's information. bytes m_currentBytes; ///< The current block. bool m_committedToMine = false; ///< Have we committed to mine on the present m_currentBlock? diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index df50e33181f..aed4ddf82a0 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -128,12 +128,12 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiBlocks.clear(); vBiBlocks.push_back(biGenesisBlock); - TransientDirectory td_stateDB, td_bc; + TransientDirectory td_bc; + TransientDirectory td_stateDB; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); State state(database, BaseState::Empty); - Block block(database, BaseState::Empty, biGenesisBlock.beneficiary()); state = importer.m_statePre; state.commit(); @@ -188,7 +188,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) cnote << "error in importing uncle! This produces an invalid block (May be by purpose for testing)."; } } + bc.sync(uncleBlockQueue, state.db(), 4); + Block block = bc.genesisBlock(state.db()); //mine a new block on top of previously imported try From 9c19f5d61f7a1f018f62dcac269d82dd9e032c1d Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 17:21:34 +0300 Subject: [PATCH 31/57] Mining --- test/libethereum/blockchain.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index aed4ddf82a0..0188951b208 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -132,9 +132,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) TransientDirectory td_stateDB; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); - OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state(database, BaseState::Empty); - state = importer.m_statePre; + //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); + State state = importer.m_statePre; state.commit(); //import previous blocks @@ -210,7 +209,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) return; } - blObj["rlp"] = toHex(block.blockData(), 2, HexPrefix::Add); //get valid transactions From bcd6602bafad055f525a41526cc5d9b315f5f4db Mon Sep 17 00:00:00 2001 From: Dimitry Date: Sat, 15 Aug 2015 12:11:41 +0300 Subject: [PATCH 32/57] Fill tests --- .../bcValidBlockTestFiller.json | 2 +- test/libethereum/blockchain.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json index a1995ddbd2b..c983ca107bb 100644 --- a/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json +++ b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json @@ -167,7 +167,7 @@ }, "expect" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100" + "balance" : "5100" } }, "pre" : { diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 0188951b208..475904b2782 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -73,6 +73,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); + Block trueBlock; //lastBlock of trueBlockchain ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); @@ -133,7 +134,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state = importer.m_statePre; + State state(OverlayDB(State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; + ImportTest::importState(o["pre"].get_obj(), state); state.commit(); //import previous blocks @@ -149,7 +151,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) bc.sync(uncleQueue, state.db(), 4); bc.attemptImport(blockFromSet, state.db()); vBiBlocks.push_back(BlockHeader(blockFromSet)); - //state.sync(bc); } // get txs @@ -189,9 +190,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } bc.sync(uncleBlockQueue, state.db(), 4); - Block block = bc.genesisBlock(state.db()); - //mine a new block on top of previously imported + Block block = bc.genesisBlock(state.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK + block.setBeneficiary(biGenesisBlock.beneficiary()); try { block.sync(bc); @@ -284,7 +285,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //attempt to import new block to the true blockchain trueBc.sync(uncleBlockQueue, trueState.db(), 4); trueBc.attemptImport(block2.out(), trueState.db()); - //trueState.sync(trueBc); + trueBlock = block; //seems to be the last imported block blockSet newBlock; newBlock.first = block2.out(); @@ -316,7 +317,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) AccountMaskMap expectStateMap; State stateExpect(OverlayDB(), BaseState::Empty); ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); - ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + ImportTest::compareStates(stateExpect, trueBlock.state(), expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); o.erase(o.find("expect")); } From 9cd46433bd147030b3a5da7eebb46bdd48f09981 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 12:32:37 +0200 Subject: [PATCH 33/57] Bulk transaction injection. Better error handling. Modularisation of single transaction injection. --- alethzero/Main.ui | 8 +- alethzero/MainWin.cpp | 26 +---- alethzero/MainWin.h | 1 - alethzero/plugins/namers/OtherAccounts.cpp | 19 +++- .../plugins/special/InjectTransactions.cpp | 87 +++++++++++++++++ .../plugins/special/InjectTransactions.h | 48 ++++++++++ .../plugins/special/InjectTransactions.ui | 95 +++++++++++++++++++ 7 files changed, 255 insertions(+), 29 deletions(-) create mode 100644 alethzero/plugins/special/InjectTransactions.cpp create mode 100644 alethzero/plugins/special/InjectTransactions.h create mode 100644 alethzero/plugins/special/InjectTransactions.ui diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 52e973fe89b..d5653f8ca1a 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -132,7 +132,7 @@ 0 0 1617 - 22 + 24 @@ -188,7 +188,6 @@ - @@ -1387,6 +1386,11 @@ font-size: 14pt Dump &Block State as JSON... + + + &Bulk Inject Transactions... + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 1fb84dddc0b..f4aebe28f14 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -668,9 +668,10 @@ std::string Main::render(dev::Address const& _a) const if (p.size() == 9 && p.find_first_not_of("QWERYUOPASDFGHJKLZXCVBNM1234567890") == string::npos) p = ICAP(p, "XREG").encoded(); else - DEV_IGNORE_EXCEPTIONS(n = ICAP(_a).encoded()); - if (n.empty()) - n = _a.abridged(); + DEV_IGNORE_EXCEPTIONS(n = ICAP(_a).encoded().substr(0, 8)); + if (!n.empty()) + n += " "; + n += _a.abridged(); return p.empty() ? n : (p + " " + n); } @@ -1593,25 +1594,6 @@ void Main::on_transactionQueue_currentItemChanged() ui->pendingInfo->moveCursor(QTextCursor::Start); } -void Main::on_inject_triggered() -{ - QString s = QInputDialog::getText(this, "Inject Transaction", "Enter transaction dump in hex"); - try - { - bytes b = fromHex(s.toStdString(), WhenError::Throw); - ethereum()->injectTransaction(b); - } - catch (BadHexCharacter& _e) - { - cwarn << "invalid hex character, transaction rejected"; - cwarn << boost::diagnostic_information(_e); - } - catch (...) - { - cwarn << "transaction rejected"; - } -} - void Main::on_injectBlock_triggered() { QString s = QInputDialog::getText(this, "Inject Block", "Enter block dump in hex"); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index db929870417..74ca7b5b09a 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -180,7 +180,6 @@ private slots: void on_paranoia_triggered(); void on_killBlockchain_triggered(); void on_clearPending_triggered(); - void on_inject_triggered(); void on_injectBlock_triggered(); void on_forceMining_triggered(); void on_usePrivate_triggered(); diff --git a/alethzero/plugins/namers/OtherAccounts.cpp b/alethzero/plugins/namers/OtherAccounts.cpp index fc2d518bca3..19b602b919f 100644 --- a/alethzero/plugins/namers/OtherAccounts.cpp +++ b/alethzero/plugins/namers/OtherAccounts.cpp @@ -21,6 +21,7 @@ #include "OtherAccounts.h" #include +#include #include #include #include @@ -46,12 +47,22 @@ void OtherAccounts::import() if (d.exec() == QDialog::Accepted) { QStringList sl = u.accounts->toPlainText().split("\n"); + unsigned line = 1; for (QString const& s: sl) { - Address addr = dev::eth::toAddress(s.section(QRegExp("[ \\0\\t]+"), 0, 0).toStdString()); - string name = s.section(QRegExp("[ \\0\\t]+"), 1).toStdString(); - m_toName[addr] = name; - m_toAddress[name] = addr; + try + { + Address addr = dev::eth::toAddress(s.section(QRegExp("[ \\0\\t]+"), 0, 0).trimmed().toStdString()); + string name = s.section(QRegExp("[ \\0\\t]+"), 1).trimmed().toStdString(); + m_toName[addr] = name; + m_toAddress[name] = addr; + } + catch (...) + { + if (QMessageBox::warning(&d, "Invalid Line Format", "Line format or address given on line " + QString::number(line) + " is invalid:\n" + s, QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) + break; + } + line++; } main()->noteSettingsChanged(); noteKnownChanged(); diff --git a/alethzero/plugins/special/InjectTransactions.cpp b/alethzero/plugins/special/InjectTransactions.cpp new file mode 100644 index 00000000000..f1535f56e83 --- /dev/null +++ b/alethzero/plugins/special/InjectTransactions.cpp @@ -0,0 +1,87 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file InjectTransactions.h + * @author Gav Wood + * @date 2015 + */ + +#include "InjectTransactions.h" +#include +#include +#include +#include +#include "ui_InjectTransactions.h" +using namespace std; +using namespace dev; +using namespace az; +using namespace eth; + +DEV_AZ_NOTE_PLUGIN(InjectTransactions); + +InjectTransactions::InjectTransactions(MainFace* _m): + Plugin(_m, "InjectTransactions") +{ + connect(addMenuItem("Inject Transaction...", "menuSpecial", true), SIGNAL(triggered()), SLOT(injectOne())); + connect(addMenuItem("Bulk Inject Transactions...", "menuSpecial", false), SIGNAL(triggered()), SLOT(injectBulk())); +} + +InjectTransactions::~InjectTransactions() +{ +} + +void InjectTransactions::injectOne() +{ + bool ok; + QString s = QInputDialog::getText(main(), "Inject Transaction", "Enter transaction dump in hex", QLineEdit::Normal, QString(), &ok); + if (ok) + doInject(s); +} + +void InjectTransactions::injectBulk() +{ + QDialog d; + Ui_InjectTransactions u; + u.setupUi(&d); + d.setWindowTitle("Bulk Inject Transactions"); + if (d.exec() == QDialog::Accepted) + for (QString const& s: u.transactions->toPlainText().split("\n")) + doInject(s); +} + +void InjectTransactions::doInject(QString _txHex) +{ + try + { + bytes b = fromHex(_txHex.toStdString(), WhenError::Throw); + main()->ethereum()->injectTransaction(b); + } + catch (BadHexCharacter& _e) + { + if (QMessageBox::warning(main(), "Invalid Transaction Hex", "Invalid hex character in:\n" + _txHex + "\nTransaction rejected.", QMessageBox::Ignore, QMessageBox::Abort) == QMessageBox::Abort) + return; + } + catch (Exception& _e) + { + if (QMessageBox::warning(main(), "Transaction Rejected", "Invalid transaction; due to" + QString::fromStdString(_e.what()) + "\n" + _txHex + "\nTransaction rejected.", QMessageBox::Ignore, QMessageBox::Abort) == QMessageBox::Abort) + return; + } + catch (...) + { + // Should not happen under normal circumstances. + return; + } +} diff --git a/alethzero/plugins/special/InjectTransactions.h b/alethzero/plugins/special/InjectTransactions.h new file mode 100644 index 00000000000..76941027d90 --- /dev/null +++ b/alethzero/plugins/special/InjectTransactions.h @@ -0,0 +1,48 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file InjectTransactions.h + * @author Gav Wood + * @date 2015 + */ + +#pragma once + +#include "MainFace.h" + +namespace dev +{ +namespace az +{ + +class InjectTransactions: public QObject, public Plugin +{ + Q_OBJECT + +public: + InjectTransactions(MainFace* _m); + ~InjectTransactions(); + +private slots: + void injectOne(); + void injectBulk(); + +private: + void doInject(QString _txHex); +}; + +} +} diff --git a/alethzero/plugins/special/InjectTransactions.ui b/alethzero/plugins/special/InjectTransactions.ui new file mode 100644 index 00000000000..e135130ebc9 --- /dev/null +++ b/alethzero/plugins/special/InjectTransactions.ui @@ -0,0 +1,95 @@ + + + InjectTransactions + + + + 0 + 0 + 511 + 508 + + + + Dialog + + + + + + Write the transactions you wish to inject here, in hex, one per line. + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + &Import + + + true + + + + + + + + + + + inject + clicked() + InjectTransactions + accept() + + + 462 + 484 + + + 449 + 504 + + + + + cancel + clicked() + InjectTransactions + reject() + + + 381 + 483 + + + 351 + 506 + + + + + From 18d9398525ae4bf6b5d526d12b4a91a8370b394c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 14:00:05 +0200 Subject: [PATCH 34/57] Fix --sign-tx in ethkey. --- ethkey/KeyAux.h | 17 ++++++++--------- libdevcore/FixedHash.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index d69b801bbf1..0dac480dc44 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -228,17 +228,16 @@ class KeyCLI { if (h128 u = fromUUID(_signKey)) return Secret(secretStore().secret(u, [&](){ return getPassword("Enter password for key: "); })); - else if (Address a = Address(_signKey)) - return keyManager().secret(a, [&](){ return getPassword("Enter password for key (hint:" + keyManager().passwordHint(a) + "): "); }); - else if (_signKey.substr(0, 6) == "brain:") + if (_signKey.substr(0, 6) == "brain:") return KeyManager::brain(_signKey.substr(6)); - else if (_signKey == "brain") + if (_signKey == "brain") return KeyManager::brain(getPassword("Enter brain wallet phrase: ")); - else - { - cerr << "Bad file, UUID and address: " << _signKey << endl; - exit(-1); - } + Address a; + DEV_IGNORE_EXCEPTIONS(a = Address(_signKey)); + if (a) + return keyManager().secret(a, [&](){ return getPassword("Enter password for key (hint:" + keyManager().passwordHint(a) + "): "); }); + cerr << "Bad file, UUID and address: " << _signKey << endl; + exit(-1); } } diff --git a/libdevcore/FixedHash.cpp b/libdevcore/FixedHash.cpp index be202b5f4f4..420e2bb165c 100644 --- a/libdevcore/FixedHash.cpp +++ b/libdevcore/FixedHash.cpp @@ -30,7 +30,14 @@ boost::random_device dev::s_fixedHashEngine; h128 dev::fromUUID(std::string const& _uuid) { - return h128(boost::replace_all_copy(_uuid, "-", "")); + try + { + return h128(boost::replace_all_copy(_uuid, "-", "")); + } + catch (...) + { + return h128(); + } } std::string dev::toUUID(h128 const& _uuid) From 03351a10b601f379183767ca1ce2d1572f9b82f0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 16:04:10 +0200 Subject: [PATCH 35/57] Fix templates. --- templates/dockplugin.cpp | 4 +++- templates/plugin.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/dockplugin.cpp b/templates/dockplugin.cpp index 479896f5475..944eec341ae 100644 --- a/templates/dockplugin.cpp +++ b/templates/dockplugin.cpp @@ -14,11 +14,13 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file $NAME.h +/** @file $NAME.cpp * @author Gav Wood * @date 2015 */ +DEV_AZ_NOTE_PLUGIN($NAME); + #include "$NAME.h" #include #include diff --git a/templates/plugin.cpp b/templates/plugin.cpp index 7c072aa2ed4..9158498d965 100644 --- a/templates/plugin.cpp +++ b/templates/plugin.cpp @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file $NAME.h +/** @file $NAME.cpp * @author Gav Wood * @date 2015 */ @@ -27,6 +27,8 @@ using namespace dev; using namespace az; using namespace eth; +DEV_AZ_NOTE_PLUGIN($NAME); + $NAME::$NAME(MainFace* _m): Plugin(_m, "$NAME") { From a13be48ae08f30023f39de278eb5378c3100bba7 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 16:13:40 +0200 Subject: [PATCH 36/57] ethkey can be used to make transactions as well as sign them. --- ethkey/KeyAux.h | 100 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 20 deletions(-) diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index 0dac480dc44..891a07063ac 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -144,6 +144,67 @@ class KeyCLI m_mode = OperationMode::SignTx; m_signKey = argv[++i]; } + else if (arg == "--tx-data" && i + 1 < argc) + try + { + m_toSign.data = fromHex(argv[++i]); + } + catch (...) + { + cerr << "Invalid argument to " << arg << endl; + exit(-1); + } + else if (arg == "--tx-nonce" && i + 1 < argc) + try + { + m_toSign.nonce = u256(argv[++i]); + } + catch (...) + { + cerr << "Invalid argument to " << arg << endl; + exit(-1); + } + else if ((arg == "--tx-dest" || arg == "--tx-to" || arg == "--tx-destination") && i + 1 < argc) + try + { + m_toSign.creation = false; + m_toSign.to = toAddress(argv[++i]); + } + catch (...) + { + cerr << "Invalid argument to " << arg << endl; + exit(-1); + } + else if (arg == "--tx-gas" && i + 1 < argc) + try + { + m_toSign.gas = u256(argv[++i]); + } + catch (...) + { + cerr << "Invalid argument to " << arg << endl; + exit(-1); + } + else if (arg == "--tx-gasprice" && i + 1 < argc) + try + { + m_toSign.gasPrice = u256(argv[++i]); + } + catch (...) + { + cerr << "Invalid argument to " << arg << endl; + exit(-1); + } + else if (arg == "--tx-value" && i + 1 < argc) + try + { + m_toSign.value = u256(argv[++i]); + } + catch (...) + { + cerr << "Invalid argument to " << arg << endl; + exit(-1); + } else if (arg == "--decode-tx") m_mode = OperationMode::DecodeTx; else if (arg == "--import-bare") @@ -315,30 +376,28 @@ class KeyCLI case OperationMode::SignTx: { Secret s = getSecret(m_signKey); + if (m_inputs.empty()) + m_inputs.push_back(string()); for (string const& i: m_inputs) { - bool isFile; - bytes b = inputData(i, &isFile); - if (b.empty()) - cerr << "Unknown file or bad hex: '" << i << "'" << endl; - else - try - { - TransactionBase t(b, CheckTransaction::None); - t.sign(s); - cout << t.sha3() << ": "; - if (isFile) - { - writeFile(i + ".signed", toHex(t.rlp())); - cout << i + ".signed" << endl; - } - else - cout << toHex(t.rlp()) << endl; - } - catch (Exception& ex) + bool isFile = false; + try + { + TransactionBase t = i.empty() ? TransactionBase(m_toSign) : TransactionBase(inputData(i, &isFile), CheckTransaction::None); + t.sign(s); + cout << t.sha3() << ": "; + if (isFile) { - cerr << "Invalid transaction: " << ex.what() << endl; + writeFile(i + ".signed", toHex(t.rlp())); + cout << i + ".signed" << endl; } + else + cout << toHex(t.rlp()) << endl; + } + catch (Exception& ex) + { + cerr << "Invalid transaction: " << ex.what() << endl; + } } break; } @@ -699,6 +758,7 @@ class KeyCLI /// Signing string m_signKey; + TransactionSkeleton m_toSign; string m_kdf = "scrypt"; map m_kdfParams; From 0fc3d1b21ff3d1dd77c1e43ea2d3a2b79028a474 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 16:13:58 +0200 Subject: [PATCH 37/57] All Accounts panel works with address book. --- alethzero/plugins/blockchain/AllAccounts.cpp | 20 ++++++++++++-------- alethzero/plugins/blockchain/AllAccounts.h | 2 +- alethzero/plugins/blockchain/AllAccounts.ui | 11 +++++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/alethzero/plugins/blockchain/AllAccounts.cpp b/alethzero/plugins/blockchain/AllAccounts.cpp index f0a08f0845d..12f17d33ea5 100644 --- a/alethzero/plugins/blockchain/AllAccounts.cpp +++ b/alethzero/plugins/blockchain/AllAccounts.cpp @@ -14,12 +14,12 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file AllAccounts.h +/** @file AllAccounts.cpp * @author Gav Wood * @date 2015 */ -#if ETH_FATDB +#if ETH_FATDB || !ETH_TRUE #include "AllAccounts.h" #include @@ -51,7 +51,7 @@ AllAccounts::AllAccounts(MainFace* _m): connect(m_ui->accountsFilter, SIGNAL(textChanged(QString)), SLOT(onAllChange())); connect(m_ui->showBasic, SIGNAL(toggled(bool)), SLOT(onAllChange())); connect(m_ui->showContracts, SIGNAL(toggled(bool)), SLOT(onAllChange())); - connect(m_ui->onlyNamed, SIGNAL(toggled(bool)), SLOT(onAllChange())); + connect(m_ui->onlyKnown, SIGNAL(toggled(bool)), SLOT(onAllChange())); } AllAccounts::~AllAccounts() @@ -72,20 +72,24 @@ void AllAccounts::refresh() m_ui->accounts->clear(); bool showContract = m_ui->showContracts->isChecked(); bool showBasic = m_ui->showBasic->isChecked(); - bool onlyNamed = m_ui->onlyNamed->isChecked(); - auto as = ethereum()->addresses(); - sort(as.begin(), as.end()); + bool onlyKnown = m_ui->onlyKnown->isChecked(); + + Addresses as; + if (onlyKnown) + as = main()->allKnownAddresses(); + else + as = ethereum()->addresses(); + for (auto const& i: as) { bool isContract = (ethereum()->codeHashAt(i) != EmptySHA3); if (!((showContract && isContract) || (showBasic && !isContract))) continue; string r = static_cast(main())->render(i); - if (onlyNamed && !(r.find('"') != string::npos || r.substr(0, 2) == "XE")) - continue; (new QListWidgetItem(QString("%2: %1 [%3]").arg(formatBalance(ethereum()->balanceAt(i)).c_str()).arg(QString::fromStdString(r)).arg((unsigned)ethereum()->countAt(i)), m_ui->accounts)) ->setData(Qt::UserRole, QByteArray((char const*)i.data(), Address::size)); } + m_ui->accounts->sortItems(); #endif m_ui->refreshAccounts->setEnabled(false); } diff --git a/alethzero/plugins/blockchain/AllAccounts.h b/alethzero/plugins/blockchain/AllAccounts.h index dd9d4e64f57..fa268406f1f 100644 --- a/alethzero/plugins/blockchain/AllAccounts.h +++ b/alethzero/plugins/blockchain/AllAccounts.h @@ -21,7 +21,7 @@ #pragma once -#if ETH_FATDB +#if ETH_FATDB || !ETH_TRUE #include #include diff --git a/alethzero/plugins/blockchain/AllAccounts.ui b/alethzero/plugins/blockchain/AllAccounts.ui index ca0ad31bcde..a1bdad53585 100644 --- a/alethzero/plugins/blockchain/AllAccounts.ui +++ b/alethzero/plugins/blockchain/AllAccounts.ui @@ -6,7 +6,7 @@ 0 0 - 400 + 405 300 @@ -46,6 +46,9 @@ true + + true + @@ -62,15 +65,15 @@ - + - Only Named + Only Known true - false + true From be9f868eb0a684bbbaf8a647cc6741a3955a723f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 21:26:44 +0200 Subject: [PATCH 38/57] HD wallet stuff. --- alethzero/Main.ui | 9 +++++++++ alethzero/MainWin.cpp | 27 +++++++++++++++++++++++++-- alethzero/MainWin.h | 3 ++- ethkey/KeyAux.h | 4 +++- libethcore/Common.cpp | 4 ++-- libethcore/KeyManager.cpp | 10 ++++++++++ libethcore/KeyManager.h | 3 +++ 7 files changed, 54 insertions(+), 6 deletions(-) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 7d9d032b7bf..32a806feabc 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -211,6 +211,7 @@ &Debug + @@ -1385,6 +1386,14 @@ font-size: 14pt &Bulk Inject Transactions... + + + false + + + Debug &Pending Transaction + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 5d5250ac152..05c2667dffc 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -240,7 +240,7 @@ Main::Main(QWidget* _parent): ui->vmSmart->setEnabled(false); #endif - readSettings(); + readSettings(true, false); m_transact = new Transact(this, this); m_transact->setWindowFlags(Qt::Dialog); @@ -262,6 +262,8 @@ Main::Main(QWidget* _parent): for (auto const& i: *s_linkedPlugins) initPlugin(i(this)); + + readSettings(false, true); } Main::~Main() @@ -850,13 +852,15 @@ Secret Main::retrieveSecret(Address const& _address) const } } -void Main::readSettings(bool _skipGeometry) +void Main::readSettings(bool _skipGeometry, bool _onlyGeometry) { QSettings s("ethereum", "alethzero"); if (!_skipGeometry) restoreGeometry(s.value("geometry").toByteArray()); restoreState(s.value("windowState").toByteArray()); + if (_onlyGeometry) + return; forEach([&](std::shared_ptr p) { @@ -1543,6 +1547,7 @@ void Main::on_transactionQueue_currentItemChanged() int i = ui->transactionQueue->currentRow(); if (i >= 0 && i < (int)ethereum()->pending().size()) { + ui->debugPending->setEnabled(true); Transaction tx(ethereum()->pending()[i]); TransactionReceipt receipt(ethereum()->postState().receipt(i)); auto ss = tx.safeSender(); @@ -1582,6 +1587,8 @@ void Main::on_transactionQueue_currentItemChanged() // s << "Pre: " << fs.rootHash() << "
"; // s << "Post: " << ts.rootHash() << ""; } + else + ui->debugPending->setEnabled(false); ui->pendingInfo->setHtml(QString::fromStdString(s.str())); ui->pendingInfo->moveCursor(QTextCursor::Start); @@ -1779,6 +1786,22 @@ void Main::on_debugCurrent_triggered() } } +void Main::on_debugPending_triggered() +{ + int txi = ui->transactionQueue->currentRow(); + if (txi == -1) + return; + + Block b = ethereum()->postState(); + bytes t = b.pending()[txi].rlp(); + State s(ethereum()->state(txi)); + BlockInfo bi(b.info()); + Executive e(s, ethereum()->blockChain(), EnvInfo(bi)); + Debugger dw(this, this); + dw.populate(e, Transaction(t, CheckTransaction::Everything)); + dw.exec(); +} + std::string minHex(h256 const& _h) { unsigned i = 0; diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index 69b4d920ad2..dd2e668b86b 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -191,6 +191,7 @@ private slots: // Debugger void on_debugCurrent_triggered(); + void on_debugPending_triggered(); void on_debugDumpState_triggered() { debugDumpState(1); } void on_debugDumpStatePre_triggered() { debugDumpState(0); } void on_dumpBlockState_triggered(); @@ -223,7 +224,7 @@ private slots: Address getCurrencies() const; void updateFee(); - void readSettings(bool _skipGeometry = false); + void readSettings(bool _skipGeometry = false, bool _onlyGeometry = false); void writeSettings(); void setPrivateChain(QString const& _private, bool _forceConfigure = false); diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index 891a07063ac..63066f1327f 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -289,6 +289,8 @@ class KeyCLI { if (h128 u = fromUUID(_signKey)) return Secret(secretStore().secret(u, [&](){ return getPassword("Enter password for key: "); })); + if (_signKey.substr(0, 6) == "brain#" && _signKey.find(":") != string::npos) + return KeyManager::subkey(KeyManager::brain(_signKey.substr(_signKey.find(":"))), stoul(_signKey.substr(6, _signKey.find(":" - 7)))); if (_signKey.substr(0, 6) == "brain:") return KeyManager::brain(_signKey.substr(6)); if (_signKey == "brain") @@ -644,7 +646,7 @@ class KeyCLI << endl << "Transaction operating modes:" << endl << " -d,--decode-tx [|] Decode given transaction." << endl - << " -s,--sign-tx [
|||brain(:) ] [ | , ... ] (Re-)Sign given transaction." << endl + << " -s,--sign-tx [
|||brain((#):) ] [ | , ... ] (Re-)Sign given transaction." << endl << endl << "Encryption configuration:" << endl << " --kdf Specify KDF to use when encrypting (default: sc rypt)" << endl diff --git a/libethcore/Common.cpp b/libethcore/Common.cpp index b6d9fd93575..2d042f4aebd 100644 --- a/libethcore/Common.cpp +++ b/libethcore/Common.cpp @@ -112,14 +112,14 @@ std::string formatBalance(bigint const& _b) else b = (u256)_b; - if (b > units()[0].first * 10000) + if (b > units()[0].first * 1000) { ret << (b / units()[0].first) << " " << units()[0].second; return ret.str(); } ret << setprecision(5); for (auto const& i: units()) - if (i.first != 1 && b >= i.first * 100) + if (i.first != 1 && b >= i.first * 1) { ret << (double(b / (i.first / 1000)) / 1000.0) << " " << i.second; return ret.str(); diff --git a/libethcore/KeyManager.cpp b/libethcore/KeyManager.cpp index ba653508572..6f3733d749b 100644 --- a/libethcore/KeyManager.cpp +++ b/libethcore/KeyManager.cpp @@ -224,6 +224,16 @@ Secret KeyManager::brain(string const& _seed) return ret; } +Secret KeyManager::subkey(Secret const& _s, unsigned _index) +{ + RLPStream out(2); + out << _s.ref(); + out << _index; + bytesSec r; + out.swapOut(r.writable()); + return sha3(r); +} + Address KeyManager::importBrain(string const& _seed, string const& _accountName, string const& _passwordHint) { Address addr = toAddress(brain(_seed)); diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index ac242c5cf81..8830f0044de 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -135,6 +135,9 @@ class KeyManager /// @returns the brainwallet secret for the given seed. static Secret brain(std::string const& _seed); + /// @returns the HD subkey for a given key. + static Secret subkey(Secret const& _s, unsigned _index); + private: std::string getPassword(h128 const& _uuid, std::function const& _pass = DontKnowThrow) const; std::string getPassword(h256 const& _passHash, std::function const& _pass = DontKnowThrow) const; From de420f9daf67569639f135340b31332787264923 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 21:45:36 +0200 Subject: [PATCH 39/57] Storage keys in order in AllAccounts view. --- alethzero/plugins/blockchain/AllAccounts.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alethzero/plugins/blockchain/AllAccounts.cpp b/alethzero/plugins/blockchain/AllAccounts.cpp index 12f17d33ea5..7a133094c89 100644 --- a/alethzero/plugins/blockchain/AllAccounts.cpp +++ b/alethzero/plugins/blockchain/AllAccounts.cpp @@ -112,8 +112,10 @@ void AllAccounts::on_accounts_currentItemChanged() try { auto storage = ethereum()->storageAt(address); - for (auto const& i: storage) - s << "@" << showbase << hex << main()->prettyU256(i.first) << "    " << showbase << hex << main()->prettyU256(i.second) << "
"; + u256s keys = keysOf(storage); + sort(keys.begin(), keys.end()); + for (auto const& i: keys) + s << "@" << showbase << hex << main()->prettyU256(i) << "    " << showbase << hex << main()->prettyU256(storage[i]) << "
"; s << "

Body Code (" << sha3(ethereum()->codeAt(address)).abridged() << ")

" << disassemble(ethereum()->codeAt(address)); s << ETH_HTML_DIV(ETH_HTML_MONO) << toHex(ethereum()->codeAt(address)) << ""; s << "

Creation Addresses (" << ethereum()->countAt(address) << "+)

"; From 15e9979cbc2e8419ad418ab3dc301bf68acc55e0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 21:54:54 +0200 Subject: [PATCH 40/57] Presale import in AZ. --- alethzero/Main.ui | 6 ++++++ alethzero/MainWin.cpp | 22 ++++++++++++++++++++++ alethzero/MainWin.h | 1 + 3 files changed, 29 insertions(+) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 32a806feabc..a26fb8f2c17 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -164,6 +164,7 @@ + @@ -1394,6 +1395,11 @@ font-size: 14pt Debug &Pending Transaction + + + Import Ether &Presale Wallet... + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 05c2667dffc..995553803ec 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1022,6 +1022,28 @@ void Main::on_claimPresale_triggered() } } +void Main::on_importPresale_triggered() +{ + QString s = QFileDialog::getOpenFileName(this, "Claim Account Contents", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); + try + { + string pass; + KeyPair k = m_keyManager.presaleSecret(dev::contentsString(s.toStdString()), [&](bool){ return (pass = QInputDialog::getText(this, "Enter Password", "Enter the wallet's passphrase", QLineEdit::Password).toStdString()); }); + cnote << k.address(); + if (!m_keyManager.hasAccount(k.address())) + keyManager().import(k.secret(), "Presale wallet (" + s.toStdString() + ")", pass, "Same password as for the presale wallet"); + else + QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account."); + } + catch (dev::eth::PasswordUnknown&) {} + catch (...) + { + cerr << "Unhandled exception!" << endl << + boost::current_exception_diagnostic_information(); + QMessageBox::warning(this, "Key File Invalid", "Could not find secret key definition. This is probably not an Ethereum key file."); + } +} + void Main::on_exportKey_triggered() { if (ui->ourAccounts->currentRow() >= 0) diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index dd2e668b86b..2bccbde579c 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -157,6 +157,7 @@ private slots: void on_reencryptAll_triggered(); void on_importKeyFile_triggered(); void on_claimPresale_triggered(); + void on_importPresale_triggered(); void on_exportKey_triggered(); // Tools From 17cbfd0838e66e8734a50079e1b145757205028d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 15 Aug 2015 22:01:52 +0200 Subject: [PATCH 41/57] Bug fix in ethkey. --- ethkey/KeyAux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index 63066f1327f..0324bd08b5c 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -290,7 +290,7 @@ class KeyCLI if (h128 u = fromUUID(_signKey)) return Secret(secretStore().secret(u, [&](){ return getPassword("Enter password for key: "); })); if (_signKey.substr(0, 6) == "brain#" && _signKey.find(":") != string::npos) - return KeyManager::subkey(KeyManager::brain(_signKey.substr(_signKey.find(":"))), stoul(_signKey.substr(6, _signKey.find(":" - 7)))); + return KeyManager::subkey(KeyManager::brain(_signKey.substr(_signKey.find(":"))), stoul(_signKey.substr(6, _signKey.find(":") - 7))); if (_signKey.substr(0, 6) == "brain:") return KeyManager::brain(_signKey.substr(6)); if (_signKey == "brain") From 07eb0a06377a9f46604c7ee723a3a6e2f2aa510e Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Sat, 15 Aug 2015 23:11:22 +0200 Subject: [PATCH 42/57] Fix build for gcc 5.2.0 --- alethzero/MainFace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alethzero/MainFace.h b/alethzero/MainFace.h index 2c25b0584cb..5db47367866 100644 --- a/alethzero/MainFace.h +++ b/alethzero/MainFace.h @@ -44,7 +44,7 @@ namespace az { #define DEV_AZ_NOTE_PLUGIN(ClassName) \ - static bool s_notePlugin = [](){ MainFace::notePlugin([](MainFace* m){ return new ClassName(m); }); return true; }() + static bool s_notePlugin __attribute__((unused)) = [](){ MainFace::notePlugin([](MainFace* m){ return new ClassName(m); }); return true; }() class Plugin; class MainFace; From 05a1df5154ae5f631308233382e703b9aaa71b0b Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Sun, 16 Aug 2015 00:07:31 +0200 Subject: [PATCH 43/57] msvc does not like gcc attributes --- alethzero/MainFace.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/alethzero/MainFace.h b/alethzero/MainFace.h index 5db47367866..2e9f806a8cc 100644 --- a/alethzero/MainFace.h +++ b/alethzero/MainFace.h @@ -43,8 +43,13 @@ namespace shh { class WhisperHost; } namespace az { +#ifndef _MSC_VER // MSVC does not like gcc compiler attributes #define DEV_AZ_NOTE_PLUGIN(ClassName) \ static bool s_notePlugin __attribute__((unused)) = [](){ MainFace::notePlugin([](MainFace* m){ return new ClassName(m); }); return true; }() +#else +#define DEV_AZ_NOTE_PLUGIN(ClassName) \ + static bool s_notePlugin = [](){ MainFace::notePlugin([](MainFace* m){ return new ClassName(m); }); return true; }() +#endif class Plugin; class MainFace; From e8b6d43636e09ff977d06902a8139a3e4e5ef299 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 16:41:34 +0200 Subject: [PATCH 44/57] vector_ref::cleanse actually sets to zero. --- libdevcore/vector_ref.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h index c7ba3a43706..b5d0453a666 100644 --- a/libdevcore/vector_ref.h +++ b/libdevcore/vector_ref.h @@ -86,7 +86,7 @@ class vector_ref void cleanse() { uint8_t* p = (uint8_t*)begin(); - size_t len = (uint8_t*)end() - p; + size_t const len = (uint8_t*)end() - p; size_t loop = len; size_t count = s_cleanseCounter; while (loop--) @@ -98,6 +98,7 @@ class vector_ref if (p) count += (63 + (size_t)p); s_cleanseCounter = (uint8_t)count; + memset((uint8_t*)begin(), 0, len); } _T* begin() { return m_data; } From 441105ec4c568c28c0539bd78b2c6c139012dc00 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 16:41:48 +0200 Subject: [PATCH 45/57] ImportKey dialog. --- alethzero/Transact.cpp | 15 +- alethzero/plugins/keys/ImportKey.cpp | 181 +++++++++++++++++ alethzero/plugins/keys/ImportKey.h | 44 ++++ alethzero/plugins/keys/ImportKey.ui | 291 +++++++++++++++++++++++++++ libdevcrypto/SecretStore.cpp | 10 +- libdevcrypto/SecretStore.h | 3 + libethcore/KeyManager.cpp | 7 + libethcore/KeyManager.h | 3 +- 8 files changed, 544 insertions(+), 10 deletions(-) create mode 100644 alethzero/plugins/keys/ImportKey.cpp create mode 100644 alethzero/plugins/keys/ImportKey.h create mode 100644 alethzero/plugins/keys/ImportKey.ui diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index c9d687ef3db..e51e3f6e04f 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -136,11 +136,12 @@ void Transact::updateDestination() // TODO: should be a Qt model. ui->destination->clear(); ui->destination->addItem("(Create Contract)"); + QMultiMap in; for (Address const& a: m_main->allKnownAddresses()) - { - cdebug << "Adding" << a << m_main->toName(a) << " -> " << (m_main->toName(a) + " (" + ICAP(a).encoded() + ")"); - ui->destination->addItem(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QString::fromStdString(a.hex())); - } + in.insert(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QString::fromStdString(a.hex())); + for (auto i = in.begin(); i != in.end(); ++i) + ui->destination->addItem(i.key(), i.value()); + } void Transact::updateFee() @@ -361,9 +362,8 @@ void Transact::timerEvent(QTimerEvent*) } updateBounds(); - if (m_lowerBound == m_upperBound) - finaliseBounds(); } + finaliseBounds(); } void Transact::updateBounds() @@ -380,6 +380,8 @@ void Transact::updateBounds() void Transact::finaliseBounds() { + killTimer(m_gasCalcTimer); + quint64 baseGas = (quint64)Transaction::gasRequired(m_data, 0); ui->progressGas->setVisible(false); @@ -420,7 +422,6 @@ void Transact::finaliseBounds() updateFee(); ui->code->setHtml(htmlInfo + m_dataInfo); ui->send->setEnabled(true); - killTimer(m_gasCalcTimer); } GasRequirements Transact::determineGasRequirements() diff --git a/alethzero/plugins/keys/ImportKey.cpp b/alethzero/plugins/keys/ImportKey.cpp new file mode 100644 index 00000000000..3769e7ed6b1 --- /dev/null +++ b/alethzero/plugins/keys/ImportKey.cpp @@ -0,0 +1,181 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file ImportKey.cpp + * @author Gav Wood + * @date 2015 + */ + +#include "ImportKey.h" +#include +#include +#include +#include +#include +#include +#include +#include "ui_ImportKey.h" +using namespace std; +using namespace dev; +using namespace az; +using namespace eth; + +DEV_AZ_NOTE_PLUGIN(ImportKey); + +ImportKey::ImportKey(MainFace* _m): + Plugin(_m, "ImportKey") +{ + connect(addMenuItem("Import Key...", "menuTools", true), SIGNAL(triggered()), SLOT(import())); +} + +ImportKey::~ImportKey() +{ +} + +void ImportKey::import() +{ + QDialog d; + Ui_ImportKey u; + u.setupUi(&d); + d.setWindowTitle("Import Key"); + + string lastKey; + Secret lastSecret; + string lastPassword; + + auto updateImport = [&](){ + u.import_2->setDisabled(u.addressOut->text().isEmpty() || u.name->text().isEmpty()); + }; + + auto updateAddress = [&](){ + string as = u.address->text().toStdString(); + try + { + u.addressOut->setText(QString::fromStdString(main()->render(eth::toAddress(as)))); + } + catch (...) + { + u.addressOut->setText(""); + } + updateImport(); + }; + + auto updatePassword = [&](){ + u.passwordHash->setText(QString::fromStdString(sha3(u.password->text().toStdString()).hex())); + }; + + function updateKey = [&](){ + // update according to key. + if (lastKey == u.key->text().toStdString()) + return; + lastKey = u.key->text().toStdString(); + lastSecret.clear(); + u.address->clear(); + u.oldPassword->setEnabled(false); + u.oldPassword->setChecked(false); + bytes b; + DEV_IGNORE_EXCEPTIONS(b = fromHex(lastKey, WhenError::Throw)); + if (b.size() == 32) + { + lastSecret = Secret(b); + bytesRef(&b).cleanse(); + } + while (!lastKey.empty() && !lastSecret) + { + bool ok; + lastPassword = QInputDialog::getText(&d, "Open Key File", "Enter the password protecting this key file. Cancel if you do not want to provide te password.", QLineEdit::Password, QString(), &ok).toStdString(); + if (!ok) + { + lastSecret.clear(); + break; + } + // Try to open as a file. + lastSecret = KeyManager::presaleSecret(contentsString(lastKey), [&](bool first){ return first ? lastPassword : string(); }).secret(); + if (!lastSecret) + lastSecret = Secret(SecretStore::secret(contentsString(lastKey), lastPassword)); + if (!lastSecret && QMessageBox::warning(&d, "Invalid Password or Key File", "The given password could not be used to decrypt the key file given. Are you sure it is a valid key file and that the password is correct?", QMessageBox::Abort, QMessageBox::Retry) == QMessageBox::Abort) + { + u.key->clear(); + updateKey(); + return; + } + } + u.oldPassword->setEnabled(!!lastSecret); + u.newPassword->setEnabled(!!lastSecret); + u.noPassword->setEnabled(!!lastSecret); + u.password->setEnabled(!!lastSecret); + u.passwordHash->setReadOnly(!!lastSecret); + u.address->setReadOnly(!lastSecret); + if (lastSecret) + { + u.oldPassword->setEnabled(!lastPassword.empty()); + if (lastPassword.empty()) + u.oldPassword->setChecked(false); + u.address->setText(QString::fromStdString(ICAP(toAddress(lastSecret)).encoded())); + updateAddress(); + } + else + u.address->clear(); + }; + + connect(u.noPassword, &QRadioButton::clicked, [&](){ + u.passwordHash->clear(); + u.hint->setText("Same as master password."); + }); + connect(u.oldPassword, &QRadioButton::clicked, [&](){ + u.passwordHash->setText(QString::fromStdString(sha3(lastPassword).hex())); + u.hint->setText("Same as original password for file " + QString::fromStdString(lastKey)); + }); + connect(u.newPassword, &QRadioButton::clicked, [&](){ + u.hint->setText(""); + updatePassword(); + }); + connect(u.password, &QLineEdit::textChanged, [&](){ updatePassword(); }); + connect(u.address, &QLineEdit::textChanged, [&](){ updateAddress(); }); + connect(u.key, &QLineEdit::textEdited, [&](){ updateKey(); }); + connect(u.name, &QLineEdit::textEdited, [&](){ updateImport(); }); + connect(u.openKey, &QToolButton::clicked, [&](){ + QString fn = QFileDialog::getOpenFileName(main(), "Open Key File", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); + if (!fn.isEmpty()) + { + u.key->setText(fn); + updateKey(); + } + }); + + if (d.exec() == QDialog::Accepted) + { + Address a = ICAP::decoded(u.addressOut->text().toStdString()).direct(); + string n = u.name->text().toStdString(); + h256 ph; + DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); + string h = u.hint->text().toStdString(); + bool mp = u.noPassword->isChecked(); + string p = mp ? string() : u.oldPassword ? lastPassword : u.password->text().toStdString(); + + // check for a brain wallet import + if (lastKey.empty() && !lastSecret) + main()->keyManager().importExistingBrain(a, n, h); + else if (!lastKey.empty() && !lastSecret) + main()->keyManager().importExisting(main()->keyManager().store().importKey(lastKey), n, a, ph, h); + else if (mp) + main()->keyManager().import(lastSecret, n); + else + main()->keyManager().import(lastSecret, n, p, h); + + main()->noteKeysChanged(); + } +} diff --git a/alethzero/plugins/keys/ImportKey.h b/alethzero/plugins/keys/ImportKey.h new file mode 100644 index 00000000000..ed233664e4e --- /dev/null +++ b/alethzero/plugins/keys/ImportKey.h @@ -0,0 +1,44 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file ImportKey.h + * @author Gav Wood + * @date 2015 + */ + +#pragma once + +#include "MainFace.h" + +namespace dev +{ +namespace az +{ + +class ImportKey: public QObject, public Plugin +{ + Q_OBJECT + +public: + ImportKey(MainFace* _m); + ~ImportKey(); + +private slots: + void import(); +}; + +} +} diff --git a/alethzero/plugins/keys/ImportKey.ui b/alethzero/plugins/keys/ImportKey.ui new file mode 100644 index 00000000000..855877eb9cd --- /dev/null +++ b/alethzero/plugins/keys/ImportKey.ui @@ -0,0 +1,291 @@ + + + ImportKey + + + + 0 + 0 + 575 + 315 + + + + Dialog + + + + + + + + Leave blank for a brain wallet + + + + + + + ... + + + + + + + true + + + + + + + Show + + + + + + + Address: + + + address + + + + + + + New Password: + + + buttonGroup + + + + + + + Place the address of the key here + + + + + + + Name: + + + name + + + + + + + Master password + + + true + + + buttonGroup + + + + + + + + + + false + + + Old password + + + buttonGroup + + + + + + + Enter the password you wish to use for the key here + + + + + + + true + + + Unknown Address + + + + + + + Enter this key's name here + + + + + + + Password Hash: + + + passwordHash + + + + + + + Password Hint: + + + hint + + + + + + + Use same password for the key as for the master. + + + false + + + + + + + Key: + + + key + + + + + + + Use the same password as in the key file. + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + false + + + &Import + + + true + + + + + + + + + key + openKey + name + address + noPassword + oldPassword + newPassword + password + showPassword + passwordHash + hint + cancel + import_2 + + + + + import_2 + clicked() + ImportKey + accept() + + + 564 + 304 + + + 449 + 504 + + + + + cancel + clicked() + ImportKey + reject() + + + 478 + 304 + + + 351 + 506 + + + + + + + + diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index 39f421f3e78..b214c92b2ae 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -107,6 +107,14 @@ bytesSec SecretStore::secret(h128 const& _uuid, function const& _pass, return key; } +bytesSec SecretStore::secret(string const& _content, string const& _pass) +{ + js::mValue u = upgraded(_content); + if (u.type() != js::obj_type) + return bytesSec(); + return decrypt(js::write_string(u.get_obj()["crypto"], false), _pass); +} + h128 SecretStore::importSecret(bytesSec const& _s, string const& _pass) { h128 r; @@ -169,8 +177,6 @@ void SecretStore::save(string const& _keysPath) void SecretStore::load(string const& _keysPath) { fs::path p(_keysPath); - fs::create_directories(p); - DEV_IGNORE_EXCEPTIONS(fs::permissions(p, fs::owner_all)); for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) if (fs::is_regular_file(it->path())) readKey(it->path().string(), true); diff --git a/libdevcrypto/SecretStore.h b/libdevcrypto/SecretStore.h index 0fcb187343a..9117788cbb9 100644 --- a/libdevcrypto/SecretStore.h +++ b/libdevcrypto/SecretStore.h @@ -53,6 +53,9 @@ class SecretStore /// @param _pass function that returns the password for the key. /// @param _useCache if true, allow previously decrypted keys to be returned directly. bytesSec secret(h128 const& _uuid, std::function const& _pass, bool _useCache = true) const; + /// @returns the secret key stored by the given @a _uuid. + /// @param _pass function that returns the password for the key. + static bytesSec secret(std::string const& _content, std::string const& _pass); /// Imports the (encrypted) key stored in the file @a _file and copies it to the managed directory. h128 importKey(std::string const& _file) { auto ret = readKey(_file, false); if (ret) save(); return ret; } /// Imports the (encrypted) key contained in the json formatted @a _content and stores it in diff --git a/libethcore/KeyManager.cpp b/libethcore/KeyManager.cpp index 6f3733d749b..e00cb68d76c 100644 --- a/libethcore/KeyManager.cpp +++ b/libethcore/KeyManager.cpp @@ -243,6 +243,13 @@ Address KeyManager::importBrain(string const& _seed, string const& _accountName, return addr; } +void KeyManager::importExistingBrain(Address const& _a, string const& _accountName, string const& _passwordHint) +{ + m_keyInfo[_a].accountName = _accountName; + m_keyInfo[_a].passwordHint = _passwordHint; + write(); +} + void KeyManager::importExisting(h128 const& _uuid, string const& _info, string const& _pass, string const& _passwordHint) { bytesSec key = m_store.secret(_uuid, [&](){ return _pass; }); diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index 8830f0044de..f1081116a77 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -108,6 +108,7 @@ class KeyManager h128 import(Secret const& _s, std::string const& _accountName, std::string const& _pass, std::string const& _passwordHint); h128 import(Secret const& _s, std::string const& _accountName) { return import(_s, _accountName, defaultPassword(), std::string()); } Address importBrain(std::string const& _seed, std::string const& _accountName, std::string const& _seedHint); + void importExistingBrain(Address const& _a, std::string const& _accountName, std::string const& _seedHint); SecretStore& store() { return m_store; } void importExisting(h128 const& _uuid, std::string const& _accountName, std::string const& _pass, std::string const& _passwordHint); @@ -130,7 +131,7 @@ class KeyManager static std::string defaultPath() { return getDataDir("ethereum") + "/keys.info"; } /// Extracts the secret key from the presale wallet. - KeyPair presaleSecret(std::string const& _json, std::function const& _password); + static KeyPair presaleSecret(std::string const& _json, std::function const& _password); /// @returns the brainwallet secret for the given seed. static Secret brain(std::string const& _seed); From d5776ef0b4d48d7c18277217e36da967f72dec3d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 18:42:36 +0200 Subject: [PATCH 46/57] Fixes for new import dialog. --- alethzero/plugins/keys/ImportKey.cpp | 65 ++++++++++--- alethzero/plugins/keys/ImportKey.ui | 132 ++++++++++++++++++--------- 2 files changed, 140 insertions(+), 57 deletions(-) diff --git a/alethzero/plugins/keys/ImportKey.cpp b/alethzero/plugins/keys/ImportKey.cpp index 3769e7ed6b1..f9278a1fcf9 100644 --- a/alethzero/plugins/keys/ImportKey.cpp +++ b/alethzero/plugins/keys/ImportKey.cpp @@ -55,16 +55,44 @@ void ImportKey::import() string lastKey; Secret lastSecret; string lastPassword; + Address lastAddress; + + auto updateAction = [&](){ + if (!u.import_2->isEnabled()) + u.action->clear(); + else if (lastKey.empty() && !lastSecret) + u.action->setText("Import brainwallet with given address and hint"); + else if (!lastKey.empty() && !lastSecret) + { + h256 ph; + DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); + if (ph) + u.action->setText("Import untouched key with given address and hint"); + else + u.action->setText("Import untouched key with given address, password hash and hint"); + } + else + { + bool mp = u.noPassword->isChecked(); + if (mp) + u.action->setText("Import recast key using master password and given hint"); + else + u.action->setText("Import recast key with given password and hint"); + } + }; auto updateImport = [&](){ - u.import_2->setDisabled(u.addressOut->text().isEmpty() || u.name->text().isEmpty()); + u.import_2->setDisabled(u.addressOut->text().isEmpty() || u.name->text().isEmpty() || !(u.oldPassword->isChecked() || u.newPassword->isChecked() || u.noPassword->isChecked())); + updateAction(); }; auto updateAddress = [&](){ + lastAddress.clear(); string as = u.address->text().toStdString(); try { - u.addressOut->setText(QString::fromStdString(main()->render(eth::toAddress(as)))); + lastAddress = eth::toAddress(as); + u.addressOut->setText(QString::fromStdString(main()->render(lastAddress))); } catch (...) { @@ -75,6 +103,7 @@ void ImportKey::import() auto updatePassword = [&](){ u.passwordHash->setText(QString::fromStdString(sha3(u.password->text().toStdString()).hex())); + updateAction(); }; function updateKey = [&](){ @@ -116,9 +145,12 @@ void ImportKey::import() u.oldPassword->setEnabled(!!lastSecret); u.newPassword->setEnabled(!!lastSecret); u.noPassword->setEnabled(!!lastSecret); + u.masterLabel->setEnabled(!!lastSecret); + u.oldLabel->setEnabled(!!lastSecret); + u.showPassword->setEnabled(!!lastSecret); u.password->setEnabled(!!lastSecret); u.passwordHash->setReadOnly(!!lastSecret); - u.address->setReadOnly(!lastSecret); + u.address->setReadOnly(!!lastSecret); if (lastSecret) { u.oldPassword->setEnabled(!lastPassword.empty()); @@ -129,15 +161,18 @@ void ImportKey::import() } else u.address->clear(); + updateImport(); }; connect(u.noPassword, &QRadioButton::clicked, [&](){ u.passwordHash->clear(); - u.hint->setText("Same as master password."); + u.hint->setText("No additional password (same as master password)."); + updateAction(); }); connect(u.oldPassword, &QRadioButton::clicked, [&](){ u.passwordHash->setText(QString::fromStdString(sha3(lastPassword).hex())); u.hint->setText("Same as original password for file " + QString::fromStdString(lastKey)); + updateAction(); }); connect(u.newPassword, &QRadioButton::clicked, [&](){ u.hint->setText(""); @@ -147,6 +182,7 @@ void ImportKey::import() connect(u.address, &QLineEdit::textChanged, [&](){ updateAddress(); }); connect(u.key, &QLineEdit::textEdited, [&](){ updateKey(); }); connect(u.name, &QLineEdit::textEdited, [&](){ updateImport(); }); + connect(u.showPassword, &QCheckBox::toggled, [&](bool show){ u.password->setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password); }); connect(u.openKey, &QToolButton::clicked, [&](){ QString fn = QFileDialog::getOpenFileName(main(), "Open Key File", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); if (!fn.isEmpty()) @@ -158,23 +194,28 @@ void ImportKey::import() if (d.exec() == QDialog::Accepted) { - Address a = ICAP::decoded(u.addressOut->text().toStdString()).direct(); + Address a = ICAP::decoded(lastAddress).direct(); string n = u.name->text().toStdString(); - h256 ph; - DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); string h = u.hint->text().toStdString(); - bool mp = u.noPassword->isChecked(); - string p = mp ? string() : u.oldPassword ? lastPassword : u.password->text().toStdString(); // check for a brain wallet import if (lastKey.empty() && !lastSecret) main()->keyManager().importExistingBrain(a, n, h); else if (!lastKey.empty() && !lastSecret) + { + h256 ph; + DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); main()->keyManager().importExisting(main()->keyManager().store().importKey(lastKey), n, a, ph, h); - else if (mp) - main()->keyManager().import(lastSecret, n); + } else - main()->keyManager().import(lastSecret, n, p, h); + { + bool mp = u.noPassword->isChecked(); + string p = mp ? string() : u.oldPassword ? lastPassword : u.password->text().toStdString(); + if (mp) + main()->keyManager().import(lastSecret, n); + else + main()->keyManager().import(lastSecret, n, p, h); + } main()->noteKeysChanged(); } diff --git a/alethzero/plugins/keys/ImportKey.ui b/alethzero/plugins/keys/ImportKey.ui index 855877eb9cd..56aa7a9fab6 100644 --- a/alethzero/plugins/keys/ImportKey.ui +++ b/alethzero/plugins/keys/ImportKey.ui @@ -6,8 +6,8 @@ 0 0 - 575 - 315 + 530 + 389 @@ -16,20 +16,6 @@ - - - - Leave blank for a brain wallet - - - - - - - ... - - - @@ -39,6 +25,9 @@ + + false + Show @@ -47,17 +36,27 @@ - Address: + &Address: address + + + + ... + + + + + false + - New Password: + New &Password: buttonGroup @@ -74,7 +73,7 @@ - Name: + &Name: name @@ -83,8 +82,11 @@ + + false + - Master password + &Master password true @@ -103,7 +105,7 @@ false - Old password + &Old password buttonGroup @@ -117,16 +119,6 @@ - - - - true - - - Unknown Address - - - @@ -137,7 +129,7 @@ - Password Hash: + Password &Hash: passwordHash @@ -147,7 +139,7 @@ - Password Hint: + Password Hin&t: hint @@ -155,7 +147,10 @@ - + + + false + Use same password for the key as for the master. @@ -164,10 +159,20 @@ - + + + + Brain wallet (no key file) + + + true + + + + - Key: + &Key: key @@ -175,12 +180,25 @@ - + + + false + Use the same password as in the key file. + + + + true + + + Unknown Address + + + @@ -198,6 +216,13 @@ + + + + + + + @@ -216,6 +241,9 @@ Cancel + + Esc + @@ -236,8 +264,6 @@ - key - openKey name address noPassword @@ -259,12 +285,12 @@ accept() - 564 - 304 + 519 + 378 449 - 504 + 388 @@ -275,12 +301,28 @@ reject() - 478 - 304 + 433 + 378 351 - 506 + 388 + + + + + newPassword + pressed() + password + setFocus() + + + 80 + 211 + + + 185 + 215 From bb8e88f05cd91d59150c105235c6aac0145202a1 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 18:42:56 +0200 Subject: [PATCH 47/57] Minor additional fix for dialog. --- alethzero/plugins/keys/ImportKey.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alethzero/plugins/keys/ImportKey.cpp b/alethzero/plugins/keys/ImportKey.cpp index f9278a1fcf9..6f47505d47c 100644 --- a/alethzero/plugins/keys/ImportKey.cpp +++ b/alethzero/plugins/keys/ImportKey.cpp @@ -194,7 +194,7 @@ void ImportKey::import() if (d.exec() == QDialog::Accepted) { - Address a = ICAP::decoded(lastAddress).direct(); + Address a = lastAddress; string n = u.name->text().toStdString(); string h = u.hint->text().toStdString(); From 7362c38bb06c6003495276f213ef39ace162b51c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 22:30:23 +0200 Subject: [PATCH 48/57] Minor UI improvements --- alethzero/plugins/keys/ImportKey.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/alethzero/plugins/keys/ImportKey.ui b/alethzero/plugins/keys/ImportKey.ui index 56aa7a9fab6..03f62e15205 100644 --- a/alethzero/plugins/keys/ImportKey.ui +++ b/alethzero/plugins/keys/ImportKey.ui @@ -265,7 +265,10 @@ name + key + openKey address + addressOut noPassword oldPassword newPassword From bcbe9aee6e2df5a3b9255fd306e33fb58b809e09 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 17 Aug 2015 08:45:23 +0200 Subject: [PATCH 49/57] style --- test/libethereum/blockchain.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index f090db8ee25..10bda395e35 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -69,10 +69,10 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) TBOOST_REQUIRE(o.count("pre")); ImportTest importer(o, _fillin, testType::BlockChainTests); - TransientDirectory td_stateDB_tmp; + TransientDirectory tdStateDB; BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); - State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); + State trueState(OverlayDB(State::openDB(tdStateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); Block trueBlock; //lastBlock of trueBlockchain ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex @@ -129,12 +129,12 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiBlocks.clear(); vBiBlocks.push_back(biGenesisBlock); - TransientDirectory td_bc; - TransientDirectory td_stateDB; - FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); + TransientDirectory tdBc; + TransientDirectory tdStateDB; + FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), tdBc.path(), WithExisting::Kill); //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state(OverlayDB(State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; + State state(OverlayDB(State::openDB(tdStateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; ImportTest::importState(o["pre"].get_obj(), state); state.commit(); From 413ebfe429700f2c2001245251baa294b2e10554 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 17 Aug 2015 09:37:21 +0200 Subject: [PATCH 50/57] fix coinbase rewards in blockChainTests --- test/libethereum/blockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 10bda395e35..633707560d4 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -284,6 +284,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //attempt to import new block to the true blockchain trueBc.sync(uncleBlockQueue, trueState.db(), 4); trueBc.attemptImport(blockRLP.out(), trueState.db()); + trueState = block.state(); blockSet newBlock; newBlock.first = blockRLP.out(); From 0d1fd853863088631b8e541110aad1a03feb764f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 17 Aug 2015 10:48:32 +0200 Subject: [PATCH 51/57] Tests fix; ignore missing web3 keys path. --- libdevcrypto/SecretStore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index b214c92b2ae..1b1e67e9b60 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -177,9 +177,13 @@ void SecretStore::save(string const& _keysPath) void SecretStore::load(string const& _keysPath) { fs::path p(_keysPath); - for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) - if (fs::is_regular_file(it->path())) - readKey(it->path().string(), true); + try + { + for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) + if (fs::is_regular_file(it->path())) + readKey(it->path().string(), true); + } + catch (...) {} } h128 SecretStore::readKey(string const& _file, bool _takeFileOwnership) From ea2e290c94882135d98f9dc3197aaf3204c41599 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Tue, 11 Aug 2015 17:26:21 +0300 Subject: [PATCH 52/57] BLock2: state test filling issue --- test/libethereum/state.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 30c0ccff0dc..c37169949d9 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -62,7 +62,6 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) const State importedStatePost = importer.m_statePost; bytes output; - // execute transaction Listener::ExecTimeGuard guard{i.first}; output = importer.executeTest(); From 5824c88088d4cde349d3bd679cd66b721c7eb7b3 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 12 Aug 2015 17:16:40 +0300 Subject: [PATCH 53/57] restore lost changes blockmining --- test/libethereum/blockchain.cpp | 237 ++++++++++++++++---------------- 1 file changed, 118 insertions(+), 119 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 3ec62368517..df50e33181f 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -73,7 +73,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); - importer.importState(o["pre"].get_obj(), trueState); + ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); @@ -189,7 +189,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } } bc.sync(uncleBlockQueue, state.db(), 4); - block.commitToSeal(bc); //mine a new block on top of previously imported try @@ -210,125 +209,125 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } -// blObj["rlp"] = toHex(state.blockData(), 2, HexPrefix::Add); - -// //get valid transactions -// Transactions txList; -// for (auto const& txi: txs.topTransactions(std::numeric_limits::max())) -// txList.push_back(txi); -// blObj["transactions"] = writeTransactionsToJson(txList); - -// BlockHeader current_BlockHeader = state.info(); - -// RLPStream uncleStream; -// uncleStream.appendList(vBiUncles.size()); -// for (unsigned i = 0; i < vBiUncles.size(); ++i) -// { -// RLPStream uncleRlp; -// vBiUncles[i].streamRLP(uncleRlp); -// uncleStream.appendRaw(uncleRlp.out()); -// } - -// if (blObj.count("blockHeader")) -// overwriteBlockHeader(current_BlockHeader, blObj); - -// if (blObj.count("blockHeader") && blObj["blockHeader"].get_obj().count("bruncle")) -// current_BlockHeader.populateFromParent(vBiBlocks[vBiBlocks.size() -1]); - -// if (vBiUncles.size()) -// { -// // update unclehash in case of invalid uncles -// current_BlockHeader.setSha3Uncles(sha3(uncleStream.out())); -// updatePoW(current_BlockHeader); -// } - -// // write block header -// mObject oBlockHeader; -// writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); -// blObj["blockHeader"] = oBlockHeader; -// vBiBlocks.push_back(current_BlockHeader); - -// // compare blocks from state and from rlp -// RLPStream txStream; -// txStream.appendList(txList.size()); -// for (unsigned i = 0; i < txList.size(); ++i) -// { -// RLPStream txrlp; -// txList[i].streamRLP(txrlp); -// txStream.appendRaw(txrlp.out()); -// } - -// RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); - -// blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); - -// if (sha3(RLP(state.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) -// { -// cnote << "block header mismatch state.blockData() vs updated state.info()\n"; -// cerr << toHex(state.blockData()) << "vs" << toHex(block2.out()); -// } - -// if (sha3(RLP(state.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) -// cnote << "txs mismatch\n"; - -// if (sha3(RLP(state.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) -// cnote << "uncle list mismatch\n" << RLP(state.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); - -// try -// { -// state.sync(bc); -// bc.import(block2.out(), state.db()); -// state.sync(bc); -// state.commit(); - -// //there we get new blockchain status in state which could have more difficulty than we have in trueState -// //attempt to import new block to the true blockchain -// trueBc.sync(uncleBlockQueue, trueState.db(), 4); -// trueBc.attemptImport(block2.out(), trueState.db()); -// trueState.sync(trueBc); - -// blockSet newBlock; -// newBlock.first = block2.out(); -// newBlock.second = uncleBlockQueueList; -// if (importBlockNumber < blockSets.size()) -// { -// //make new correct history of imported blocks -// blockSets[importBlockNumber] = newBlock; -// for (size_t i = importBlockNumber + 1; i < blockSets.size(); i++) -// blockSets.pop_back(); -// } -// else -// blockSets.push_back(newBlock); -// } -// // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given -// catch (...) -// { -// cnote << "block is invalid!\n"; -// blObj.erase(blObj.find("blockHeader")); -// blObj.erase(blObj.find("uncleHeaders")); -// blObj.erase(blObj.find("transactions")); -// } -// blArray.push_back(blObj); -// this_thread::sleep_for(chrono::seconds(1)); + blObj["rlp"] = toHex(block.blockData(), 2, HexPrefix::Add); + + //get valid transactions + Transactions txList; + for (auto const& txi: txs.topTransactions(std::numeric_limits::max())) + txList.push_back(txi); + blObj["transactions"] = writeTransactionsToJson(txList); + + BlockHeader current_BlockHeader = block.info(); + + RLPStream uncleStream; + uncleStream.appendList(vBiUncles.size()); + for (unsigned i = 0; i < vBiUncles.size(); ++i) + { + RLPStream uncleRlp; + vBiUncles[i].streamRLP(uncleRlp); + uncleStream.appendRaw(uncleRlp.out()); + } + + if (blObj.count("blockHeader")) + overwriteBlockHeader(current_BlockHeader, blObj, bc.info()); + + if (blObj.count("blockHeader") && blObj["blockHeader"].get_obj().count("bruncle")) + current_BlockHeader.populateFromParent(vBiBlocks[vBiBlocks.size() -1]); + + if (vBiUncles.size()) + { + // update unclehash in case of invalid uncles + current_BlockHeader.setSha3Uncles(sha3(uncleStream.out())); + updatePoW(current_BlockHeader); + } + + // write block header + mObject oBlockHeader; + writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); + blObj["blockHeader"] = oBlockHeader; + vBiBlocks.push_back(current_BlockHeader); + + // compare blocks from state and from rlp + RLPStream txStream; + txStream.appendList(txList.size()); + for (unsigned i = 0; i < txList.size(); ++i) + { + RLPStream txrlp; + txList[i].streamRLP(txrlp); + txStream.appendRaw(txrlp.out()); + } + + RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); + + blObj["rlp"] = toHex(block2.out(), 2, HexPrefix::Add); + + if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) + { + cnote << "block header mismatch block.blockData() vs updated block.info()\n"; + cerr << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(block2.out())[0].data()); + } + + if (sha3(RLP(block.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) + cnote << "txs mismatch\n"; + + if (sha3(RLP(block.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) + cnote << "uncle list mismatch\n" << RLP(block.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); + + try + { + block.sync(bc); + bc.import(block2.out(), block.db()); + block.sync(bc); + //block.commit(); + + //there we get new blockchain status in state which could have more difficulty than we have in trueState + //attempt to import new block to the true blockchain + trueBc.sync(uncleBlockQueue, trueState.db(), 4); + trueBc.attemptImport(block2.out(), trueState.db()); + //trueState.sync(trueBc); + + blockSet newBlock; + newBlock.first = block2.out(); + newBlock.second = uncleBlockQueueList; + if (importBlockNumber < blockSets.size()) + { + //make new correct history of imported blocks + blockSets[importBlockNumber] = newBlock; + for (size_t i = importBlockNumber + 1; i < blockSets.size(); i++) + blockSets.pop_back(); + } + else + blockSets.push_back(newBlock); + } + // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given + catch (...) + { + cnote << "block is invalid!\n"; + blObj.erase(blObj.find("blockHeader")); + blObj.erase(blObj.find("uncleHeaders")); + blObj.erase(blObj.find("transactions")); + } + blArray.push_back(blObj); + this_thread::sleep_for(chrono::seconds(1)); } //for blocks -// if (o.count("expect") > 0) -// { -// AccountMaskMap expectStateMap; -// State stateExpect(OverlayDB(), BaseState::Empty, biGenesisBlock.beneficiary()); -// ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); -// ImportTest::checkExpectedState(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); -// o.erase(o.find("expect")); -// } - -// o["blocks"] = blArray; -// o["postState"] = fillJsonWithState(trueState); -// o["lastblockhash"] = toString(trueBc.info().hash()); - -// //make all values hex in pre section -// State prestate(OverlayDB(), BaseState::Empty); -// ImportTest::importState(o["pre"].get_obj(), prestate); -// o["pre"] = fillJsonWithState(prestate); + if (o.count("expect") > 0) + { + AccountMaskMap expectStateMap; + State stateExpect(OverlayDB(), BaseState::Empty); + ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); + ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + o.erase(o.find("expect")); + } + + o["blocks"] = blArray; + o["postState"] = fillJsonWithState(trueState); + o["lastblockhash"] = toString(trueBc.info().hash()); + + //make all values hex in pre section + State prestate(OverlayDB(), BaseState::Empty); + ImportTest::importState(o["pre"].get_obj(), prestate); + o["pre"] = fillJsonWithState(prestate); }//_fillin else { From eae2407e659a8fee0008bfbda4446275942f7694 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 16:38:38 +0300 Subject: [PATCH 54/57] BlockChainTests mining --- libethereum/Block.cpp | 2 +- libethereum/Block.h | 5 +++-- test/libethereum/blockchain.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libethereum/Block.cpp b/libethereum/Block.cpp index 1c8dc1b211a..fd2a5152772 100644 --- a/libethereum/Block.cpp +++ b/libethereum/Block.cpp @@ -709,7 +709,7 @@ bool Block::sealBlock(bytesConstRef _header) ret.appendRaw(m_currentTxs); ret.appendRaw(m_currentUncles); ret.swapOut(m_currentBytes); - m_currentBlock = BlockInfo(_header, CheckNothing, h256(), HeaderData); + m_currentBlock = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData); cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash() << ")"; // TODO: move into Sealer StructuredLogger::minedNewBlock( diff --git a/libethereum/Block.h b/libethereum/Block.h index feadbba7344..f030661f118 100644 --- a/libethereum/Block.h +++ b/libethereum/Block.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "Account.h" @@ -252,7 +253,7 @@ class Block bytes const& blockData() const { return m_currentBytes; } /// Get the header information on the present block. - BlockInfo const& info() const { return m_currentBlock; } + Ethash::BlockHeader const& info() const { return m_currentBlock; } private: @@ -288,7 +289,7 @@ class Block State m_precommit; ///< State at the point immediately prior to rewards. BlockInfo m_previousBlock; ///< The previous block's information. - BlockInfo m_currentBlock; ///< The current block's information. + Ethash::BlockHeader m_currentBlock; ///< The current block's information. bytes m_currentBytes; ///< The current block. bool m_committedToMine = false; ///< Have we committed to mine on the present m_currentBlock? diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index df50e33181f..aed4ddf82a0 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -128,12 +128,12 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) vBiBlocks.clear(); vBiBlocks.push_back(biGenesisBlock); - TransientDirectory td_stateDB, td_bc; + TransientDirectory td_bc; + TransientDirectory td_stateDB; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); State state(database, BaseState::Empty); - Block block(database, BaseState::Empty, biGenesisBlock.beneficiary()); state = importer.m_statePre; state.commit(); @@ -188,7 +188,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) cnote << "error in importing uncle! This produces an invalid block (May be by purpose for testing)."; } } + bc.sync(uncleBlockQueue, state.db(), 4); + Block block = bc.genesisBlock(state.db()); //mine a new block on top of previously imported try From 1459e282d9278209f1ae5d678462a9007f06fe60 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 14 Aug 2015 17:21:34 +0300 Subject: [PATCH 55/57] Mining --- test/libethereum/blockchain.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index aed4ddf82a0..0188951b208 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -132,9 +132,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) TransientDirectory td_stateDB; FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); - OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state(database, BaseState::Empty); - state = importer.m_statePre; + //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); + State state = importer.m_statePre; state.commit(); //import previous blocks @@ -210,7 +209,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) return; } - blObj["rlp"] = toHex(block.blockData(), 2, HexPrefix::Add); //get valid transactions From 0e32935647d58d1a8db46c9bb791335bf263bc73 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Sat, 15 Aug 2015 12:11:41 +0300 Subject: [PATCH 56/57] Fill tests --- .../bcValidBlockTestFiller.json | 2 +- test/libethereum/blockchain.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json index a1995ddbd2b..c983ca107bb 100644 --- a/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json +++ b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json @@ -167,7 +167,7 @@ }, "expect" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100" + "balance" : "5100" } }, "pre" : { diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 0188951b208..475904b2782 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -73,6 +73,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path(), h256{}, WithExisting::Kill)), BaseState::Empty); + Block trueBlock; //lastBlock of trueBlockchain ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); @@ -133,7 +134,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) FullBlockChain bc(rlpGenesisBlock.out(), AccountMap(), td_bc.path(), WithExisting::Kill); //OverlayDB database (State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)); - State state = importer.m_statePre; + State state(OverlayDB(State::openDB(td_stateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); //= importer.m_statePre; + ImportTest::importState(o["pre"].get_obj(), state); state.commit(); //import previous blocks @@ -149,7 +151,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) bc.sync(uncleQueue, state.db(), 4); bc.attemptImport(blockFromSet, state.db()); vBiBlocks.push_back(BlockHeader(blockFromSet)); - //state.sync(bc); } // get txs @@ -189,9 +190,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } bc.sync(uncleBlockQueue, state.db(), 4); - Block block = bc.genesisBlock(state.db()); - //mine a new block on top of previously imported + Block block = bc.genesisBlock(state.db()); //NOT CLEAR WHAT IT RETURNS IF bc INITIALIZED WITH CUSTOM GENESIS BLOCK + block.setBeneficiary(biGenesisBlock.beneficiary()); try { block.sync(bc); @@ -284,7 +285,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //attempt to import new block to the true blockchain trueBc.sync(uncleBlockQueue, trueState.db(), 4); trueBc.attemptImport(block2.out(), trueState.db()); - //trueState.sync(trueBc); + trueBlock = block; //seems to be the last imported block blockSet newBlock; newBlock.first = block2.out(); @@ -316,7 +317,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) AccountMaskMap expectStateMap; State stateExpect(OverlayDB(), BaseState::Empty); ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); - ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + ImportTest::compareStates(stateExpect, trueBlock.state(), expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); o.erase(o.find("expect")); } From 795521291ae792d78005d42d321d63d02faf8cee Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 17 Aug 2015 15:21:56 +0300 Subject: [PATCH 57/57] BlockTests: restore corelibs and mining --- libethereum/Block.cpp | 2 +- libethereum/Block.h | 5 ++--- test/TestHelper.cpp | 2 +- test/libethereum/blockchain.cpp | 12 +++++++----- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libethereum/Block.cpp b/libethereum/Block.cpp index fd2a5152772..1c8dc1b211a 100644 --- a/libethereum/Block.cpp +++ b/libethereum/Block.cpp @@ -709,7 +709,7 @@ bool Block::sealBlock(bytesConstRef _header) ret.appendRaw(m_currentTxs); ret.appendRaw(m_currentUncles); ret.swapOut(m_currentBytes); - m_currentBlock = Ethash::BlockHeader(_header, CheckNothing, h256(), HeaderData); + m_currentBlock = BlockInfo(_header, CheckNothing, h256(), HeaderData); cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash() << ")"; // TODO: move into Sealer StructuredLogger::minedNewBlock( diff --git a/libethereum/Block.h b/libethereum/Block.h index f030661f118..feadbba7344 100644 --- a/libethereum/Block.h +++ b/libethereum/Block.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include "Account.h" @@ -253,7 +252,7 @@ class Block bytes const& blockData() const { return m_currentBytes; } /// Get the header information on the present block. - Ethash::BlockHeader const& info() const { return m_currentBlock; } + BlockInfo const& info() const { return m_currentBlock; } private: @@ -289,7 +288,7 @@ class Block State m_precommit; ///< State at the point immediately prior to rewards. BlockInfo m_previousBlock; ///< The previous block's information. - Ethash::BlockHeader m_currentBlock; ///< The current block's information. + BlockInfo m_currentBlock; ///< The current block's information. bytes m_currentBytes; ///< The current block. bool m_committedToMine = false; ///< Have we committed to mine on the present m_currentBlock? diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 15a5d56331e..e7633c5e303 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -269,7 +269,7 @@ int ImportTest::compareStates(State const& _stateExpect, State const& _statePost for (auto const& a: _stateExpect.addresses()) { - CHECK(_statePost.addressInUse(a.first), "Filling Test: " << a.first << " missing expected address!"); + CHECK(_statePost.addressInUse(a.first), "Check State: " << a.first << " missing expected address!"); if (_statePost.addressInUse(a.first)) { AccountMask addressOptions(true); diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 633707560d4..5a4e65be50a 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -73,7 +73,6 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BlockHeader biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj(), h256{}); State trueState(OverlayDB(State::openDB(tdStateDB.path(), h256{}, WithExisting::Kill)), BaseState::Empty); - Block trueBlock; //lastBlock of trueBlockchain ImportTest::importState(o["pre"].get_obj(), trueState); o["pre"] = fillJsonWithState(trueState); //convert all fields to hex trueState.commit(); @@ -218,7 +217,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) txList.push_back(txi); blObj["transactions"] = writeTransactionsToJson(txList); - BlockHeader current_BlockHeader = block.info(); + BlockHeader current_BlockHeader(block.blockData()); RLPStream uncleStream; uncleStream.appendList(vBiUncles.size()); @@ -263,7 +262,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) blObj["rlp"] = toHex(blockRLP.out(), 2, HexPrefix::Add); if (sha3(RLP(block.blockData())[0].data()) != sha3(RLP(blockRLP.out())[0].data())) - { + { cnote << "block header mismatch block.blockData() vs updated block.info()\n"; cnote << toHex(RLP(block.blockData())[0].data()) << "vs" << toHex(RLP(blockRLP.out())[0].data()); } @@ -284,7 +283,9 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //attempt to import new block to the true blockchain trueBc.sync(uncleBlockQueue, trueState.db(), 4); trueBc.attemptImport(blockRLP.out(), trueState.db()); - trueState = block.state(); + + if (block.blockData() == trueBc.block()) + trueState = block.state(); blockSet newBlock; newBlock.first = blockRLP.out(); @@ -316,7 +317,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) AccountMaskMap expectStateMap; State stateExpect(OverlayDB(), BaseState::Empty); ImportTest::importState(o["expect"].get_obj(), stateExpect, expectStateMap); - ImportTest::compareStates(stateExpect, trueBlock.state(), expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + if (ImportTest::compareStates(stateExpect, trueState, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow)) + cerr << testname << endl; o.erase(o.find("expect")); }