|
@ -189,9 +189,9 @@ Main::Main(QWidget *parent) : |
|
|
#endif |
|
|
#endif |
|
|
m_servers.append(QString::fromStdString(Host::pocHost() + ":30303")); |
|
|
m_servers.append(QString::fromStdString(Host::pocHost() + ":30303")); |
|
|
|
|
|
|
|
|
cerr << "State root: " << CanonBlockChain::genesis().stateRoot() << endl; |
|
|
cerr << "State root: " << CanonBlockChain<Ethash>::genesis().stateRoot() << endl; |
|
|
auto block = CanonBlockChain::createGenesisBlock(); |
|
|
auto block = CanonBlockChain<Ethash>::createGenesisBlock(); |
|
|
cerr << "Block Hash: " << CanonBlockChain::genesis().hash() << endl; |
|
|
cerr << "Block Hash: " << CanonBlockChain<Ethash>::genesis().hash() << endl; |
|
|
cerr << "Block RLP: " << RLP(block) << endl; |
|
|
cerr << "Block RLP: " << RLP(block) << endl; |
|
|
cerr << "Block Hex: " << toHex(block) << endl; |
|
|
cerr << "Block Hex: " << toHex(block) << endl; |
|
|
cerr << "eth Network protocol version: " << eth::c_protocolVersion << endl; |
|
|
cerr << "eth Network protocol version: " << eth::c_protocolVersion << endl; |
|
@ -208,13 +208,14 @@ Main::Main(QWidget *parent) : |
|
|
statusBar()->addPermanentWidget(ui->chainStatus); |
|
|
statusBar()->addPermanentWidget(ui->chainStatus); |
|
|
statusBar()->addPermanentWidget(ui->blockCount); |
|
|
statusBar()->addPermanentWidget(ui->blockCount); |
|
|
|
|
|
|
|
|
ui->blockCount->setText(QString("PV%1.%2 D%3 %4-%5 v%6").arg(eth::c_protocolVersion).arg(eth::c_minorProtocolVersion).arg(c_databaseVersion).arg(QString::fromStdString(ethereum()->sealEngine()->name())).arg(ethereum()->sealEngine()->revision()).arg(dev::Version)); |
|
|
|
|
|
|
|
|
|
|
|
QSettings s("ethereum", "alethzero"); |
|
|
QSettings s("ethereum", "alethzero"); |
|
|
m_networkConfig = s.value("peers").toByteArray(); |
|
|
m_networkConfig = s.value("peers").toByteArray(); |
|
|
bytesConstRef network((byte*)m_networkConfig.data(), m_networkConfig.size()); |
|
|
bytesConstRef network((byte*)m_networkConfig.data(), m_networkConfig.size()); |
|
|
m_webThree.reset(new WebThreeDirect(string("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM), getDataDir(), WithExisting::Trust, {"eth"/*, "shh"*/}, p2p::NetworkPreferences(), network)); |
|
|
m_webThree.reset(new WebThreeDirect(string("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM), getDataDir(), WithExisting::Trust, {"eth"/*, "shh"*/}, p2p::NetworkPreferences(), network)); |
|
|
|
|
|
|
|
|
|
|
|
ui->blockCount->setText(QString("PV%1.%2 D%3 %4-%5 v%6").arg(eth::c_protocolVersion).arg(eth::c_minorProtocolVersion).arg(c_databaseVersion).arg(QString::fromStdString(ethereum()->sealEngine()->name())).arg(ethereum()->sealEngine()->revision()).arg(dev::Version)); |
|
|
|
|
|
|
|
|
m_httpConnector.reset(new jsonrpc::HttpServer(SensibleHttpPort, "", "", dev::SensibleHttpThreads)); |
|
|
m_httpConnector.reset(new jsonrpc::HttpServer(SensibleHttpPort, "", "", dev::SensibleHttpThreads)); |
|
|
auto w3ss = new OurWebThreeStubServer(*m_httpConnector, this); |
|
|
auto w3ss = new OurWebThreeStubServer(*m_httpConnector, this); |
|
|
m_server.reset(w3ss); |
|
|
m_server.reset(w3ss); |
|
@ -1124,7 +1125,7 @@ void Main::refreshMining() |
|
|
QString t; |
|
|
QString t; |
|
|
if (gp.first != EthashAux::NotGenerating) |
|
|
if (gp.first != EthashAux::NotGenerating) |
|
|
t = QString("DAG for #%1-#%2: %3% complete; ").arg(gp.first).arg(gp.first + ETHASH_EPOCH_LENGTH - 1).arg(gp.second); |
|
|
t = QString("DAG for #%1-#%2: %3% complete; ").arg(gp.first).arg(gp.first + ETHASH_EPOCH_LENGTH - 1).arg(gp.second); |
|
|
MiningProgress p = ethereum()->miningProgress(); |
|
|
WorkingProgress p = ethereum()->miningProgress(); |
|
|
ui->mineStatus->setText(t + (ethereum()->isMining() ? p.hashes > 0 ? QString("%1s @ %2kH/s").arg(p.ms / 1000).arg(p.ms ? p.hashes / p.ms : 0) : "Awaiting DAG" : "Not mining")); |
|
|
ui->mineStatus->setText(t + (ethereum()->isMining() ? p.hashes > 0 ? QString("%1s @ %2kH/s").arg(p.ms / 1000).arg(p.ms ? p.hashes / p.ms : 0) : "Awaiting DAG" : "Not mining")); |
|
|
if (ethereum()->isMining() && p.hashes > 0) |
|
|
if (ethereum()->isMining() && p.hashes > 0) |
|
|
{ |
|
|
{ |
|
@ -1629,7 +1630,7 @@ void Main::on_transactionQueue_currentItemChanged() |
|
|
else |
|
|
else |
|
|
s << "<div>Log Bloom: <b><i>Uneventful</i></b></div>"; |
|
|
s << "<div>Log Bloom: <b><i>Uneventful</i></b></div>"; |
|
|
s << "<div>Gas Used: <b>" << receipt.gasUsed() << "</b></div>"; |
|
|
s << "<div>Gas Used: <b>" << receipt.gasUsed() << "</b></div>"; |
|
|
s << "<div>End State: <b>" << receipt.stateRoot()().abridged() << "</b></div>"; |
|
|
s << "<div>End State: <b>" << receipt.stateRoot().abridged() << "</b></div>"; |
|
|
auto r = receipt.rlp(); |
|
|
auto r = receipt.rlp(); |
|
|
s << "<div>Receipt: " << toString(RLP(r)) << "</div>"; |
|
|
s << "<div>Receipt: " << toString(RLP(r)) << "</div>"; |
|
|
s << "<div>Receipt-Hex: " Span(Mono) << toHex(receipt.rlp()) << "</span></div>"; |
|
|
s << "<div>Receipt-Hex: " Span(Mono) << toHex(receipt.rlp()) << "</span></div>"; |
|
@ -1699,7 +1700,7 @@ void Main::on_blocks_currentItemChanged() |
|
|
auto details = ethereum()->blockChain().details(h); |
|
|
auto details = ethereum()->blockChain().details(h); |
|
|
auto blockData = ethereum()->blockChain().block(h); |
|
|
auto blockData = ethereum()->blockChain().block(h); |
|
|
auto block = RLP(blockData); |
|
|
auto block = RLP(blockData); |
|
|
BlockInfo info(blockData); |
|
|
Ethash::BlockHeader info(blockData); |
|
|
|
|
|
|
|
|
stringstream s; |
|
|
stringstream s; |
|
|
|
|
|
|
|
@ -1709,21 +1710,21 @@ void Main::on_blocks_currentItemChanged() |
|
|
time_t rawTime = (time_t)(uint64_t)info.timestamp(); |
|
|
time_t rawTime = (time_t)(uint64_t)info.timestamp(); |
|
|
strftime(timestamp, 64, "%c", localtime(&rawTime)); |
|
|
strftime(timestamp, 64, "%c", localtime(&rawTime)); |
|
|
s << "<h3>" << h << "</h3>"; |
|
|
s << "<h3>" << h << "</h3>"; |
|
|
s << "<h4>#" << info.number; |
|
|
s << "<h4>#" << info.number(); |
|
|
s << "   <b>" << timestamp << "</b></h4>"; |
|
|
s << "   <b>" << timestamp << "</b></h4>"; |
|
|
s << "<div>D/TD: <b>" << info.difficulty << "</b>/<b>" << details.totalDifficulty << "</b> = 2^" << log2((double)info.difficulty) << "/2^" << log2((double)details.totalDifficulty) << "</div>"; |
|
|
s << "<div>D/TD: <b>" << info.difficulty() << "</b>/<b>" << details.totalDifficulty << "</b> = 2^" << log2((double)info.difficulty()) << "/2^" << log2((double)details.totalDifficulty) << "</div>"; |
|
|
s << "   Children: <b>" << details.children.size() << "</b></div>"; |
|
|
s << "   Children: <b>" << details.children.size() << "</b></div>"; |
|
|
s << "<div>Gas used/limit: <b>" << info.gasUsed << "</b>/<b>" << info.gasLimit << "</b>" << "</div>"; |
|
|
s << "<div>Gas used/limit: <b>" << info.gasUsed() << "</b>/<b>" << info.gasLimit() << "</b>" << "</div>"; |
|
|
s << "<div>Beneficiary: <b>" << htmlEscaped(pretty(info.coinbaseAddress())) << " " << info.coinbaseAddress() << "</b>" << "</div>"; |
|
|
s << "<div>Beneficiary: <b>" << htmlEscaped(pretty(info.coinbaseAddress())) << " " << info.coinbaseAddress() << "</b>" << "</div>"; |
|
|
s << "<div>Seed hash: <b>" << info.seedHash() << "</b>" << "</div>"; |
|
|
s << "<div>Seed hash: <b>" << info.seedHash() << "</b>" << "</div>"; |
|
|
s << "<div>Mix hash: <b>" << info.mixHash << "</b>" << "</div>"; |
|
|
s << "<div>Mix hash: <b>" << info.mixHash() << "</b>" << "</div>"; |
|
|
s << "<div>Nonce: <b>" << info.nonce << "</b>" << "</div>"; |
|
|
s << "<div>Nonce: <b>" << info.nonce() << "</b>" << "</div>"; |
|
|
s << "<div>Hash w/o nonce: <b>" << info.headerHash(WithoutProof) << "</b>" << "</div>"; |
|
|
s << "<div>Hash w/o nonce: <b>" << info.hashWithout() << "</b>" << "</div>"; |
|
|
s << "<div>Difficulty: <b>" << info.difficulty << "</b>" << "</div>"; |
|
|
s << "<div>Difficulty: <b>" << info.difficulty() << "</b>" << "</div>"; |
|
|
if (info.number) |
|
|
if (info.number()) |
|
|
{ |
|
|
{ |
|
|
auto e = EthashAux::eval(info); |
|
|
auto e = EthashAux::eval(info.seedHash(), info.hashWithout(), info.nonce()); |
|
|
s << "<div>Proof-of-Work: <b>" << e.value << " <= " << (h256)u256((bigint(1) << 256) / info.difficulty) << "</b> (mixhash: " << e.mixHash.abridged() << ")" << "</div>"; |
|
|
s << "<div>Proof-of-Work: <b>" << e.value << " <= " << (h256)u256((bigint(1) << 256) / info.difficulty()) << "</b> (mixhash: " << e.mixHash.abridged() << ")" << "</div>"; |
|
|
s << "<div>Parent: <b>" << info.parentHash() << "</b>" << "</div>"; |
|
|
s << "<div>Parent: <b>" << info.parentHash() << "</b>" << "</div>"; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
@ -1740,19 +1741,19 @@ void Main::on_blocks_currentItemChanged() |
|
|
s << "<div>Uncles: <b>" << block[2].itemCount() << "</b> @<b>" << info.sha3Uncles() << "</b>" << "</div>"; |
|
|
s << "<div>Uncles: <b>" << block[2].itemCount() << "</b> @<b>" << info.sha3Uncles() << "</b>" << "</div>"; |
|
|
for (auto u: block[2]) |
|
|
for (auto u: block[2]) |
|
|
{ |
|
|
{ |
|
|
BlockInfo uncle = BlockInfo::fromHeader(u.data()); |
|
|
Ethash::BlockHeader uncle(u.data(), CheckNothing, h256(), HeaderData); |
|
|
char const* line = "<div><span style=\"margin-left: 2em\"> </span>"; |
|
|
char const* line = "<div><span style=\"margin-left: 2em\"> </span>"; |
|
|
s << line << "Hash: <b>" << uncle.hash() << "</b>" << "</div>"; |
|
|
s << line << "Hash: <b>" << uncle.hash() << "</b>" << "</div>"; |
|
|
s << line << "Parent: <b>" << uncle.parentHash() << "</b>" << "</div>"; |
|
|
s << line << "Parent: <b>" << uncle.parentHash() << "</b>" << "</div>"; |
|
|
s << line << "Number: <b>" << uncle.number << "</b>" << "</div>"; |
|
|
s << line << "Number: <b>" << uncle.number() << "</b>" << "</div>"; |
|
|
s << line << "Coinbase: <b>" << htmlEscaped(pretty(uncle.coinbaseAddress())) << " " << uncle.coinbaseAddress() << "</b>" << "</div>"; |
|
|
s << line << "Coinbase: <b>" << htmlEscaped(pretty(uncle.coinbaseAddress())) << " " << uncle.coinbaseAddress() << "</b>" << "</div>"; |
|
|
s << line << "Seed hash: <b>" << uncle.seedHash() << "</b>" << "</div>"; |
|
|
s << line << "Seed hash: <b>" << uncle.seedHash() << "</b>" << "</div>"; |
|
|
s << line << "Mix hash: <b>" << uncle.mixHash << "</b>" << "</div>"; |
|
|
s << line << "Mix hash: <b>" << uncle.mixHash() << "</b>" << "</div>"; |
|
|
s << line << "Nonce: <b>" << uncle.nonce << "</b>" << "</div>"; |
|
|
s << line << "Nonce: <b>" << uncle.nonce() << "</b>" << "</div>"; |
|
|
s << line << "Hash w/o nonce: <b>" << uncle.headerHash(WithoutProof) << "</b>" << "</div>"; |
|
|
s << line << "Hash w/o nonce: <b>" << uncle.headerHash(WithoutProof) << "</b>" << "</div>"; |
|
|
s << line << "Difficulty: <b>" << uncle.difficulty << "</b>" << "</div>"; |
|
|
s << line << "Difficulty: <b>" << uncle.difficulty() << "</b>" << "</div>"; |
|
|
auto e = EthashAux::eval(uncle); |
|
|
auto e = EthashAux::eval(uncle.seedHash(), uncle.hashWithout(), uncle.nonce()); |
|
|
s << line << "Proof-of-Work: <b>" << e.value << " <= " << (h256)u256((bigint(1) << 256) / uncle.difficulty) << "</b> (mixhash: " << e.mixHash.abridged() << ")" << "</div>"; |
|
|
s << line << "Proof-of-Work: <b>" << e.value << " <= " << (h256)u256((bigint(1) << 256) / uncle.difficulty()) << "</b> (mixhash: " << e.mixHash.abridged() << ")" << "</div>"; |
|
|
} |
|
|
} |
|
|
if (info.parentHash()) |
|
|
if (info.parentHash()) |
|
|
s << "<div>Pre: <b>" << BlockInfo(ethereum()->blockChain().block(info.parentHash())).stateRoot() << "</b>" << "</div>"; |
|
|
s << "<div>Pre: <b>" << BlockInfo(ethereum()->blockChain().block(info.parentHash())).stateRoot() << "</b>" << "</div>"; |
|
@ -1764,7 +1765,7 @@ void Main::on_blocks_currentItemChanged() |
|
|
unsigned ii = 0; |
|
|
unsigned ii = 0; |
|
|
for (auto const& i: block[1]) |
|
|
for (auto const& i: block[1]) |
|
|
{ |
|
|
{ |
|
|
s << "<div>" << sha3(i.data()).abridged() << ": <b>" << receipts.receipts[ii].stateRoot()() << "</b> [<b>" << receipts.receipts[ii].gasUsed() << "</b> used]" << "</div>"; |
|
|
s << "<div>" << sha3(i.data()).abridged() << ": <b>" << receipts.receipts[ii].stateRoot() << "</b> [<b>" << receipts.receipts[ii].gasUsed() << "</b> used]" << "</div>"; |
|
|
++ii; |
|
|
++ii; |
|
|
} |
|
|
} |
|
|
s << "<div>Post: <b>" << info.stateRoot() << "</b>" << "</div>"; |
|
|
s << "<div>Post: <b>" << info.stateRoot() << "</b>" << "</div>"; |
|
@ -1807,7 +1808,7 @@ void Main::on_blocks_currentItemChanged() |
|
|
else |
|
|
else |
|
|
s << "<div>Log Bloom: <b><i>Uneventful</i></b></div>"; |
|
|
s << "<div>Log Bloom: <b><i>Uneventful</i></b></div>"; |
|
|
s << "<div>Gas Used: <b>" << receipt.gasUsed() << "</b></div>"; |
|
|
s << "<div>Gas Used: <b>" << receipt.gasUsed() << "</b></div>"; |
|
|
s << "<div>End State: <b>" << receipt.stateRoot()().abridged() << "</b></div>"; |
|
|
s << "<div>End State: <b>" << receipt.stateRoot().abridged() << "</b></div>"; |
|
|
auto r = receipt.rlp(); |
|
|
auto r = receipt.rlp(); |
|
|
s << "<div>Receipt: " << toString(RLP(r)) << "</div>"; |
|
|
s << "<div>Receipt: " << toString(RLP(r)) << "</div>"; |
|
|
s << "<div>Receipt-Hex: " Span(Mono) << toHex(receipt.rlp()) << "</span></div>"; |
|
|
s << "<div>Receipt-Hex: " Span(Mono) << toHex(receipt.rlp()) << "</span></div>"; |
|
|