Merge pull request #149 from moneroexamples/devel

For Monero version 0.13
master
moneroexamples 6 years ago committed by GitHub
commit e6006acf48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,9 +6,7 @@ set(PROJECT_NAME
project(${PROJECT_NAME}) project(${PROJECT_NAME})
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_STANDARD 11)
"${CMAKE_CXX_FLAGS} -std=c++14")
if (WIN32) if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3")
@ -119,7 +117,7 @@ set(LIBRARIES
checkpoints checkpoints
version version
epee epee
pcsclite sodium
${Boost_LIBRARIES} ${Boost_LIBRARIES}
pthread pthread
unbound unbound
@ -130,7 +128,7 @@ set(LIBRARIES
if(APPLE) if(APPLE)
set(LIBRARIES ${LIBRARIES} "-framework IOKit -framework PCSC") set(LIBRARIES ${LIBRARIES} "-framework IOKit -framework PCSC")
else() else()
set(LIBRARIES ${LIBRARIES} atomic) set(LIBRARIES ${LIBRARIES} atomic pcsclite)
endif() endif()
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT WIN32) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT WIN32)

@ -28,24 +28,22 @@ Tor users:
- [http://dvwae436pd7nt4bc.onion](http://dvwae436pd7nt4bc.onion) (Front-end templates are [maintained by @suhz](https://github.com/suhz/onion-monero-blockchain-explorer/tree/moneroexplorer.com/src/templates)). - [http://dvwae436pd7nt4bc.onion](http://dvwae436pd7nt4bc.onion) (Front-end templates are [maintained by @suhz](https://github.com/suhz/onion-monero-blockchain-explorer/tree/moneroexplorer.com/src/templates)).
Clearnet versions: Clearnet versions:
- [https://labor.serveo.net/](https://labor.serveo.net/) - temprorary link (slow), bleading edge version.
- [https://xmrchain.net/](https://xmrchain.net/) - https enabled, most popular and very stable. - [https://xmrchain.net/](https://xmrchain.net/) - https enabled, most popular and very stable.
- [https://MoneroExplorer.com/](https://moneroexplorer.com/) - nice looking one, https enabled. - [https://MoneroExplorer.com/](https://moneroexplorer.com/) - nice looking one, https enabled.
- [https://monerohash.com/explorer/](https://monerohash.com/explorer/) - nice looking one, https enabled. - [https://monerohash.com/explorer/](https://monerohash.com/explorer/) - nice looking one, https enabled.
- [http://explore.MoneroWorld.com](http://explore.moneroworld.com) - same as the second one. - [http://explore.MoneroWorld.com](http://explore.moneroworld.com) - same as the second one.
- [https://moneroexplorer.pro/](https://moneroexplorer.pro/) - nice looking one, https enabled.
- [http://monerochain.com/](http://monerochain.com/) - JSON API based, multiple nodes. - [http://monerochain.com/](http://monerochain.com/) - JSON API based, multiple nodes.
- [https://blox.minexmr.com/](https://blox.minexmr.com/) - - https enabled. - [https://blox.minexmr.com/](https://blox.minexmr.com/) - - https enabled.
Testnet version: Testnet version:
- [http://nimis.serveo.net/](http://nimis.serveo.net/) - bleeding edge version (down currently).
- [https://testnet.xmrchain.com/](https://testnet.xmrchain.com/) - https enabled. - [https://testnet.xmrchain.com/](https://testnet.xmrchain.com/) - https enabled.
- [https://explorer.monero-otc.com/](https://explorer.monero-otc.com/) - https enabled. - [https://explorer.monero-otc.com/](https://explorer.monero-otc.com/) - https enabled.
Stagenet version: Stagenet version:
- [http://162.210.173.150:8083/](http://162.210.173.150:8083/) - recent version. - [https://stagenet.xmrchain.net/](https://stagenet.xmrchain.net/)
- [http://162.210.173.150:8083/](http://162.210.173.150:8083/)
i2p users (main Monero network): i2p users (main Monero network):
@ -54,7 +52,6 @@ i2p users (main Monero network):
Alternative block explorers: Alternative block explorers:
- [http://moneroblocks.info](http://moneroblocks.info/) - [http://moneroblocks.info](http://moneroblocks.info/)
- [https://monerobase.com](https://monerobase.com/)
- [https://monerovision.com](https://monerovision.com) - [https://monerovision.com](https://monerovision.com)
- [http://chainradar.com](http://chainradar.com/xmr/blocks) - [http://chainradar.com](http://chainradar.com/xmr/blocks)
@ -93,7 +90,7 @@ Current development branch:
## Compilation on Ubuntu 16.04/18.04 ## Compilation on Ubuntu 16.04/18.04
##### Compile latest Monero development version ##### Compile latest Monero version (0.13)
Download and compile recent Monero into your home folder: Download and compile recent Monero into your home folder:
@ -110,10 +107,8 @@ git clone --recursive https://github.com/monero-project/monero
cd monero/ cd monero/
# checkout last monero version
git checkout -b last_release v0.12.1.0
make USE_SINGLE_BUILDDIR=1 make
``` ```
##### Compile and run the explorer ##### Compile and run the explorer
@ -697,7 +692,6 @@ curl -w "\n" -X GET http://127.0.0.1:8081/api/outputsblocks?address=9sDyNU82ih1
Example result: Example result:
```json ```json
{
{ {
"data": { "data": {
"address": "0182d5be0f708cecf2b6f9889738bde5c930fad846d5b530e021afd1ae7e24a687ad50af3a5d38896655669079ad0163b4a369f6c852cc816dace5fc7792b72f", "address": "0182d5be0f708cecf2b6f9889738bde5c930fad846d5b530e021afd1ae7e24a687ad50af3a5d38896655669079ad0163b4a369f6c852cc816dace5fc7792b72f",

File diff suppressed because it is too large Load Diff

@ -44,6 +44,7 @@ main(int ac, const char* av[])
} }
auto port_opt = opts.get_option<string>("port"); auto port_opt = opts.get_option<string>("port");
auto bindaddr_opt = opts.get_option<string>("bindaddr");
auto bc_path_opt = opts.get_option<string>("bc-path"); auto bc_path_opt = opts.get_option<string>("bc-path");
auto deamon_url_opt = opts.get_option<string>("deamon-url"); auto deamon_url_opt = opts.get_option<string>("deamon-url");
auto ssl_crt_file_opt = opts.get_option<string>("ssl-crt-file"); auto ssl_crt_file_opt = opts.get_option<string>("ssl-crt-file");
@ -63,6 +64,7 @@ main(int ac, const char* av[])
auto enable_js_opt = opts.get_option<bool>("enable-js"); auto enable_js_opt = opts.get_option<bool>("enable-js");
auto enable_mixin_details_opt = opts.get_option<bool>("enable-mixin-details"); auto enable_mixin_details_opt = opts.get_option<bool>("enable-mixin-details");
auto enable_json_api_opt = opts.get_option<bool>("enable-json-api"); auto enable_json_api_opt = opts.get_option<bool>("enable-json-api");
auto enable_as_hex_opt = opts.get_option<bool>("enable-as-hex");
auto enable_tx_cache_opt = opts.get_option<bool>("enable-tx-cache"); auto enable_tx_cache_opt = opts.get_option<bool>("enable-tx-cache");
auto enable_block_cache_opt = opts.get_option<bool>("enable-block-cache"); auto enable_block_cache_opt = opts.get_option<bool>("enable-block-cache");
auto show_cache_times_opt = opts.get_option<bool>("show-cache-times"); auto show_cache_times_opt = opts.get_option<bool>("show-cache-times");
@ -90,6 +92,7 @@ main(int ac, const char* av[])
bool enable_output_key_checker {*enable_output_key_checker_opt}; bool enable_output_key_checker {*enable_output_key_checker_opt};
bool enable_mixin_details {*enable_mixin_details_opt}; bool enable_mixin_details {*enable_mixin_details_opt};
bool enable_json_api {*enable_json_api_opt}; bool enable_json_api {*enable_json_api_opt};
bool enable_as_hex {*enable_as_hex_opt};
bool enable_tx_cache {*enable_tx_cache_opt}; bool enable_tx_cache {*enable_tx_cache_opt};
bool enable_block_cache {*enable_block_cache_opt}; bool enable_block_cache {*enable_block_cache_opt};
bool enable_emission_monitor {*enable_emission_monitor_opt}; bool enable_emission_monitor {*enable_emission_monitor_opt};
@ -100,9 +103,13 @@ main(int ac, const char* av[])
uint32_t log_level = 0; uint32_t log_level = 0;
mlog_configure("", true); mlog_configure("", true);
(void) log_level;
//cast port number in string to uint //cast port number in string to uint
uint16_t app_port = boost::lexical_cast<uint16_t>(*port_opt); uint16_t app_port = boost::lexical_cast<uint16_t>(*port_opt);
string bindaddr = *bindaddr_opt;
// cast no_blocks_on_index_opt to uint // cast no_blocks_on_index_opt to uint
uint64_t no_blocks_on_index = boost::lexical_cast<uint64_t>(*no_blocks_on_index_opt); uint64_t no_blocks_on_index = boost::lexical_cast<uint64_t>(*no_blocks_on_index_opt);
@ -259,6 +266,7 @@ main(int ac, const char* av[])
nettype, nettype,
enable_pusher, enable_pusher,
enable_js, enable_js,
enable_as_hex,
enable_key_image_checker, enable_key_image_checker,
enable_output_key_checker, enable_output_key_checker,
enable_autorefresh_option, enable_autorefresh_option,
@ -282,7 +290,7 @@ main(int ac, const char* av[])
}; };
CROW_ROUTE(app, "/") CROW_ROUTE(app, "/")
([&](const crow::request& req) { ([&]() {
return crow::response(xmrblocks.index2()); return crow::response(xmrblocks.index2());
}); });
@ -292,20 +300,43 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/block/<uint>") CROW_ROUTE(app, "/block/<uint>")
([&](const crow::request& req, size_t block_height) { ([&](size_t block_height) {
return crow::response(xmrblocks.show_block(block_height)); return crow::response(xmrblocks.show_block(block_height));
}); });
CROW_ROUTE(app, "/block/<string>") CROW_ROUTE(app, "/block/<string>")
([&](const crow::request& req, string block_hash) { ([&](string block_hash) {
return crow::response(xmrblocks.show_block(remove_bad_chars(block_hash))); return crow::response(xmrblocks.show_block(remove_bad_chars(block_hash)));
}); });
CROW_ROUTE(app, "/tx/<string>") CROW_ROUTE(app, "/tx/<string>")
([&](const crow::request& req, string tx_hash) { ([&](string tx_hash) {
return crow::response(xmrblocks.show_tx(remove_bad_chars(tx_hash))); return crow::response(xmrblocks.show_tx(remove_bad_chars(tx_hash)));
}); });
if (enable_as_hex)
{
CROW_ROUTE(app, "/txhex/<string>")
([&](string tx_hash) {
return crow::response(xmrblocks.show_tx_hex(remove_bad_chars(tx_hash)));
});
CROW_ROUTE(app, "/ringmembershex/<string>")
([&](string tx_hash) {
return crow::response(xmrblocks.show_ringmembers_hex(remove_bad_chars(tx_hash)));
});
CROW_ROUTE(app, "/blockhex/<uint>")
([&](size_t block_height) {
return crow::response(xmrblocks.show_block_hex(block_height, false));
});
CROW_ROUTE(app, "/blockhexcomplete/<uint>")
([&](size_t block_height) {
return crow::response(xmrblocks.show_block_hex(block_height, true));
});
}
CROW_ROUTE(app, "/tx/<string>/<uint>") CROW_ROUTE(app, "/tx/<string>/<uint>")
([&](string tx_hash, uint16_t with_ring_signatures) ([&](string tx_hash, uint16_t with_ring_signatures)
{ {
@ -403,7 +434,7 @@ main(int ac, const char* av[])
if (enable_pusher) if (enable_pusher)
{ {
CROW_ROUTE(app, "/rawtx") CROW_ROUTE(app, "/rawtx")
([&](const crow::request& req) { ([&]() {
return xmrblocks.show_rawtx(); return xmrblocks.show_rawtx();
}); });
@ -433,7 +464,7 @@ main(int ac, const char* av[])
if (enable_key_image_checker) if (enable_key_image_checker)
{ {
CROW_ROUTE(app, "/rawkeyimgs") CROW_ROUTE(app, "/rawkeyimgs")
([&](const crow::request& req) { ([&]() {
return xmrblocks.show_rawkeyimgs(); return xmrblocks.show_rawkeyimgs();
}); });
@ -464,7 +495,7 @@ main(int ac, const char* av[])
if (enable_output_key_checker) if (enable_output_key_checker)
{ {
CROW_ROUTE(app, "/rawoutputkeys") CROW_ROUTE(app, "/rawoutputkeys")
([&](const crow::request& req) { ([&]() {
return xmrblocks.show_rawoutputkeys(); return xmrblocks.show_rawoutputkeys();
}); });
@ -499,13 +530,13 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/mempool") CROW_ROUTE(app, "/mempool")
([&](const crow::request& req) { ([&]() {
return xmrblocks.mempool(true); return xmrblocks.mempool(true);
}); });
// alias to "/mempool" // alias to "/mempool"
CROW_ROUTE(app, "/txpool") CROW_ROUTE(app, "/txpool")
([&](const crow::request& req) { ([&]() {
return xmrblocks.mempool(true); return xmrblocks.mempool(true);
}); });
@ -526,52 +557,52 @@ main(int ac, const char* av[])
cout << "Enable JavaScript checking of outputs and proving txs\n"; cout << "Enable JavaScript checking of outputs and proving txs\n";
CROW_ROUTE(app, "/js/jquery.min.js") CROW_ROUTE(app, "/js/jquery.min.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("jquery.min.js"); return xmrblocks.get_js_file("jquery.min.js");
}); });
CROW_ROUTE(app, "/js/crc32.js") CROW_ROUTE(app, "/js/crc32.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("crc32.js"); return xmrblocks.get_js_file("crc32.js");
}); });
CROW_ROUTE(app, "/js/biginteger.js") CROW_ROUTE(app, "/js/biginteger.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("biginteger.js"); return xmrblocks.get_js_file("biginteger.js");
}); });
CROW_ROUTE(app, "/js/crypto.js") CROW_ROUTE(app, "/js/crypto.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("crypto.js"); return xmrblocks.get_js_file("crypto.js");
}); });
CROW_ROUTE(app, "/js/config.js") CROW_ROUTE(app, "/js/config.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("config.js"); return xmrblocks.get_js_file("config.js");
}); });
CROW_ROUTE(app, "/js/nacl-fast-cn.js") CROW_ROUTE(app, "/js/nacl-fast-cn.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("nacl-fast-cn.js"); return xmrblocks.get_js_file("nacl-fast-cn.js");
}); });
CROW_ROUTE(app, "/js/base58.js") CROW_ROUTE(app, "/js/base58.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("base58.js"); return xmrblocks.get_js_file("base58.js");
}); });
CROW_ROUTE(app, "/js/cn_util.js") CROW_ROUTE(app, "/js/cn_util.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("cn_util.js"); return xmrblocks.get_js_file("cn_util.js");
}); });
CROW_ROUTE(app, "/js/sha3.js") CROW_ROUTE(app, "/js/sha3.js")
([&](const crow::request& req) { ([&]() {
return xmrblocks.get_js_file("sha3.js"); return xmrblocks.get_js_file("sha3.js");
}); });
CROW_ROUTE(app, "/js/all_in_one.js") CROW_ROUTE(app, "/js/all_in_one.js")
([&](const crow::request& req) { ([&]() {
// /js/all_in_one.js file does not exist. it is generated on the fly // /js/all_in_one.js file does not exist. it is generated on the fly
// from the above real files. // from the above real files.
return xmrblocks.get_js_file("all_in_one.js"); return xmrblocks.get_js_file("all_in_one.js");
@ -585,7 +616,7 @@ main(int ac, const char* av[])
cout << "Enable JSON API\n"; cout << "Enable JSON API\n";
CROW_ROUTE(app, "/api/transaction/<string>") CROW_ROUTE(app, "/api/transaction/<string>")
([&](const crow::request &req, string tx_hash) { ([&](string tx_hash) {
myxmr::jsonresponse r{xmrblocks.json_transaction(remove_bad_chars(tx_hash))}; myxmr::jsonresponse r{xmrblocks.json_transaction(remove_bad_chars(tx_hash))};
@ -593,15 +624,23 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/api/rawtransaction/<string>") CROW_ROUTE(app, "/api/rawtransaction/<string>")
([&](const crow::request &req, string tx_hash) { ([&](string tx_hash) {
myxmr::jsonresponse r{xmrblocks.json_rawtransaction(remove_bad_chars(tx_hash))}; myxmr::jsonresponse r{xmrblocks.json_rawtransaction(remove_bad_chars(tx_hash))};
return r; return r;
}); });
CROW_ROUTE(app, "/api/detailedtransaction/<string>")
([&](string tx_hash) {
myxmr::jsonresponse r{xmrblocks.json_detailedtransaction(remove_bad_chars(tx_hash))};
return r;
});
CROW_ROUTE(app, "/api/block/<string>") CROW_ROUTE(app, "/api/block/<string>")
([&](const crow::request &req, string block_no_or_hash) { ([&](string block_no_or_hash) {
myxmr::jsonresponse r{xmrblocks.json_block(remove_bad_chars(block_no_or_hash))}; myxmr::jsonresponse r{xmrblocks.json_block(remove_bad_chars(block_no_or_hash))};
@ -609,7 +648,7 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/api/rawblock/<string>") CROW_ROUTE(app, "/api/rawblock/<string>")
([&](const crow::request &req, string block_no_or_hash) { ([&](string block_no_or_hash) {
myxmr::jsonresponse r{xmrblocks.json_rawblock(remove_bad_chars(block_no_or_hash))}; myxmr::jsonresponse r{xmrblocks.json_rawblock(remove_bad_chars(block_no_or_hash))};
@ -650,7 +689,7 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/api/search/<string>") CROW_ROUTE(app, "/api/search/<string>")
([&](const crow::request &req, string search_value) { ([&](string search_value) {
myxmr::jsonresponse r{xmrblocks.json_search(remove_bad_chars(search_value))}; myxmr::jsonresponse r{xmrblocks.json_search(remove_bad_chars(search_value))};
@ -658,7 +697,7 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/api/networkinfo") CROW_ROUTE(app, "/api/networkinfo")
([&](const crow::request &req) { ([&]() {
myxmr::jsonresponse r{xmrblocks.json_networkinfo()}; myxmr::jsonresponse r{xmrblocks.json_networkinfo()};
@ -666,7 +705,7 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/api/emission") CROW_ROUTE(app, "/api/emission")
([&](const crow::request &req) { ([&]() {
myxmr::jsonresponse r{xmrblocks.json_emission()}; myxmr::jsonresponse r{xmrblocks.json_emission()};
@ -742,7 +781,7 @@ main(int ac, const char* av[])
}); });
CROW_ROUTE(app, "/api/version") CROW_ROUTE(app, "/api/version")
([&](const crow::request &req) { ([&]() {
myxmr::jsonresponse r{xmrblocks.json_version()}; myxmr::jsonresponse r{xmrblocks.json_version()};
@ -766,13 +805,13 @@ main(int ac, const char* av[])
if (use_ssl) if (use_ssl)
{ {
cout << "Staring in ssl mode" << endl; cout << "Staring in ssl mode" << endl;
app.port(app_port).ssl_file(ssl_crt_file, ssl_key_file) app.bindaddr(bindaddr).port(app_port).ssl_file(ssl_crt_file, ssl_key_file)
.multithreaded().run(); .multithreaded().run();
} }
else else
{ {
cout << "Staring in non-ssl mode" << endl; cout << "Staring in non-ssl mode" << endl;
app.port(app_port).multithreaded().run(); app.bindaddr(bindaddr).port(app_port).multithreaded().run();
} }

@ -45,12 +45,16 @@ namespace xmreg
"enable caching of block details") "enable caching of block details")
("enable-js", value<bool>()->default_value(false)->implicit_value(true), ("enable-js", value<bool>()->default_value(false)->implicit_value(true),
"enable checking outputs and proving txs using JavaScript on client side") "enable checking outputs and proving txs using JavaScript on client side")
("enable-as-hex", value<bool>()->default_value(false)->implicit_value(true),
"enable links to provide hex represtations of a tx and a block")
("enable-autorefresh-option", value<bool>()->default_value(false)->implicit_value(true), ("enable-autorefresh-option", value<bool>()->default_value(false)->implicit_value(true),
"enable users to have the index page on autorefresh") "enable users to have the index page on autorefresh")
("enable-emission-monitor", value<bool>()->default_value(false)->implicit_value(true), ("enable-emission-monitor", value<bool>()->default_value(false)->implicit_value(true),
"enable Monero total emission monitoring thread") "enable Monero total emission monitoring thread")
("port,p", value<string>()->default_value("8081"), ("port,p", value<string>()->default_value("8081"),
"default explorer port") "default explorer port")
("bindaddr,x", value<string>()->default_value("0.0.0.0"),
"default bind address for the explorer")
("testnet-url", value<string>()->default_value(""), ("testnet-url", value<string>()->default_value(""),
"you can specify testnet url, if you run it on mainnet or stagenet. link will show on front page to testnet explorer") "you can specify testnet url, if you run it on mainnet or stagenet. link will show on front page to testnet explorer")
("stagenet-url", value<string>()->default_value(""), ("stagenet-url", value<string>()->default_value(""),

@ -137,8 +137,8 @@ CurrentBlockchainStatus::calculate_emission_in_blocks(
uint64_t coinbase_amount = get_outs_money_amount(blk.miner_tx); uint64_t coinbase_amount = get_outs_money_amount(blk.miner_tx);
std::list<transaction> txs; vector<transaction> txs;
std::list<crypto::hash> missed_txs; vector<crypto::hash> missed_txs;
uint64_t tx_fee_amount = 0; uint64_t tx_fee_amount = 0;

@ -139,10 +139,13 @@ MempoolStatus::read_mempool()
mempool_size_kB += _tx_info.blob_size; mempool_size_kB += _tx_info.blob_size;
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash, tx}); local_copy_of_mempool_txs.push_back(mempool_tx{});
mempool_tx& last_tx = local_copy_of_mempool_txs.back(); mempool_tx& last_tx = local_copy_of_mempool_txs.back();
last_tx.tx_hash = tx_hash;
last_tx.tx = tx;
// key images of inputs // key images of inputs
vector<txin_to_key> input_key_imgs; vector<txin_to_key> input_key_imgs;
@ -168,7 +171,7 @@ MempoolStatus::read_mempool()
last_tx.mixin_no = sum_data[2]; last_tx.mixin_no = sum_data[2];
last_tx.num_nonrct_inputs = sum_data[3]; last_tx.num_nonrct_inputs = sum_data[3];
last_tx.fee_str = xmreg::xmr_amount_to_str(_tx_info.fee, "{:0.3f}", false); last_tx.fee_str = xmreg::xmr_amount_to_str(_tx_info.fee, "{:0.4f}", false);
last_tx.payed_for_kB_str = fmt::format("{:0.4f}", payed_for_kB); last_tx.payed_for_kB_str = fmt::format("{:0.4f}", payed_for_kB);
last_tx.xmr_inputs_str = xmreg::xmr_amount_to_str(last_tx.sum_inputs , "{:0.3f}"); last_tx.xmr_inputs_str = xmreg::xmr_amount_to_str(last_tx.sum_inputs , "{:0.3f}");
last_tx.xmr_outputs_str = xmreg::xmr_amount_to_str(last_tx.sum_outputs, "{:0.3f}"); last_tx.xmr_outputs_str = xmreg::xmr_amount_to_str(last_tx.sum_outputs, "{:0.3f}");
@ -264,6 +267,7 @@ MempoolStatus::read_network_info()
local_copy.cumulative_difficulty = rpc_network_info.cumulative_difficulty; local_copy.cumulative_difficulty = rpc_network_info.cumulative_difficulty;
local_copy.block_size_limit = rpc_network_info.block_size_limit; local_copy.block_size_limit = rpc_network_info.block_size_limit;
local_copy.block_size_median = rpc_network_info.block_size_median; local_copy.block_size_median = rpc_network_info.block_size_median;
local_copy.block_weight_limit = rpc_network_info.block_weight_limit;
local_copy.start_time = rpc_network_info.start_time; local_copy.start_time = rpc_network_info.start_time;

@ -72,6 +72,7 @@ struct MempoolStatus
uint64_t cumulative_difficulty {0}; uint64_t cumulative_difficulty {0};
uint64_t block_size_limit {0}; uint64_t block_size_limit {0};
uint64_t block_size_median {0}; uint64_t block_size_median {0};
uint64_t block_weight_limit {0};
char block_size_limit_str[10]; // needs to be trivially copyable char block_size_limit_str[10]; // needs to be trivially copyable
char block_size_median_str[10]; // std::string is not trivially copyable char block_size_median_str[10]; // std::string is not trivially copyable
uint64_t start_time {0}; uint64_t start_time {0};

@ -80,6 +80,12 @@ MicroCore::get_core()
return m_blockchain_storage; return m_blockchain_storage;
} }
tx_memory_pool&
MicroCore::get_mempool()
{
return m_mempool;
}
/** /**
* Get block by its height * Get block by its height
* *
@ -210,78 +216,6 @@ MicroCore::find_output_in_tx(const transaction& tx,
} }
/**
* Returns tx hash in a given block which
* contains given output's public key
*/
bool
MicroCore::get_tx_hash_from_output_pubkey(const public_key& output_pubkey,
const uint64_t& block_height,
crypto::hash& tx_hash,
cryptonote::transaction& tx_found)
{
tx_hash = null_hash;
// get block of given height
block blk;
if (!get_block_by_height(block_height, blk))
{
cerr << "Cant get block of height: " << block_height << endl;
return false;
}
// get all transactions in the block found
// initialize the first list with transaction for solving
// the block i.e. coinbase.
list<transaction> txs {blk.miner_tx};
list<crypto::hash> missed_txs;
if (!m_blockchain_storage.get_transactions(blk.tx_hashes, txs, missed_txs))
{
cerr << "Cant find transcations in block: " << block_height << endl;
return false;
}
if (!missed_txs.empty())
{
cerr << "Transactions not found in blk: " << block_height << endl;
for (const crypto::hash& h : missed_txs)
{
cerr << " - tx hash: " << h << endl;
}
return false;
}
// search outputs in each transactions
// until output with pubkey of interest is found
for (const transaction& tx : txs)
{
tx_out found_out;
// we dont need here output_index
size_t output_index;
if (find_output_in_tx(tx, output_pubkey, found_out, output_index))
{
// we found the desired public key
tx_hash = get_transaction_hash(tx);
tx_found = tx;
return true;
}
}
return false;
}
uint64_t uint64_t
MicroCore::get_blk_timestamp(uint64_t blk_height) MicroCore::get_blk_timestamp(uint64_t blk_height)
{ {
@ -332,6 +266,28 @@ init_blockchain(const string& path,
return true; return true;
} }
bool
MicroCore::get_block_complete_entry(block const& b, block_complete_entry& bce)
{
bce.block = cryptonote::block_to_blob(b);
for (const auto &tx_hash: b.tx_hashes)
{
transaction tx;
if (!get_tx(tx_hash, tx))
return false;
cryptonote::blobdata txblob = tx_to_blob(tx);
bce.txs.push_back(txblob);
}
return true;
}
string string
MicroCore::get_blkchain_path() MicroCore::get_blkchain_path()
{ {

@ -44,6 +44,9 @@ namespace xmreg
Blockchain& Blockchain&
get_core(); get_core();
tx_memory_pool&
get_mempool();
bool bool
get_block_by_height(const uint64_t& height, block& blk); get_block_by_height(const uint64_t& height, block& blk);
@ -59,15 +62,12 @@ namespace xmreg
tx_out& out, tx_out& out,
size_t& output_index); size_t& output_index);
bool
get_tx_hash_from_output_pubkey(const public_key& output_pubkey,
const uint64_t& block_height,
crypto::hash& tx_hash,
transaction& tx_found);
uint64_t uint64_t
get_blk_timestamp(uint64_t blk_height); get_blk_timestamp(uint64_t blk_height);
bool
get_block_complete_entry(block const& b, block_complete_entry& bce);
string string
get_blkchain_path(); get_blkchain_path();

File diff suppressed because it is too large Load Diff

@ -275,9 +275,9 @@ rpccalls::get_dynamic_per_kb_fee_estimate(
uint64_t& fee, uint64_t& fee,
string& error_msg) string& error_msg)
{ {
epee::json_rpc::request<COMMAND_RPC_GET_PER_KB_FEE_ESTIMATE::request> epee::json_rpc::request<COMMAND_RPC_GET_BASE_FEE_ESTIMATE::request>
req_t = AUTO_VAL_INIT(req_t); req_t = AUTO_VAL_INIT(req_t);
epee::json_rpc::response<COMMAND_RPC_GET_PER_KB_FEE_ESTIMATE::response, std::string> epee::json_rpc::response<COMMAND_RPC_GET_BASE_FEE_ESTIMATE::response, std::string>
resp_t = AUTO_VAL_INIT(resp_t); resp_t = AUTO_VAL_INIT(resp_t);

@ -30,6 +30,11 @@
<td>Total fees:</td><td>{{sum_fees}}</td> <td>Total fees:</td><td>{{sum_fees}}</td>
<td>No of txs:</td><td>{{no_txs}}</td> <td>No of txs:</td><td>{{no_txs}}</td>
</tr> </tr>
<tr>
<td>PoW hash:</td><td>{{blk_pow_hash}}</td>
<td>Difficulty:</td><td>{{blk_difficulty}}</td>
<td></td>
</tr>
</table> </table>
<h3>Miner reward transaction</h3> <h3>Miner reward transaction</h3>
@ -79,4 +84,12 @@
</table> </table>
{{/have_txs}} {{/have_txs}}
{{#enable_as_hex}}
<h5 style="margin-top:1px">
<a href="/blockhex/{{blk_height}}">Block as hex</a>
| <a href="/blockhexcomplete/{{blk_height}}">Complete block as hex</a>
</h5>
{{/enable_as_hex}}
</div> </div>

@ -152,6 +152,12 @@
it is impossible to know whether this is your real spending. <br/> it is impossible to know whether this is your real spending. <br/>
So do not take this number seriously. So do not take this number seriously.
It is probably totally wrong anyway.</span> It is probably totally wrong anyway.</span>
<br/>
<span style="font-size: 14px">
Number of possible our mixins is {{no_all_possible_mixins}}
for {{all_possible_mixins_amount}} xmr
(amount as uint64).
</span>
</h3> </h3>
</div> </div>

@ -531,7 +531,13 @@
{{^have_raw_tx}} {{^have_raw_tx}}
{{^with_ring_signatures}} {{^with_ring_signatures}}
{{#show_more_details_link}} {{#show_more_details_link}}
<h5 style="margin-top:1px"><a href="/tx/{{tx_hash}}/1">More details</a></h5> <h5 style="margin-top:1px">
<a href="/tx/{{tx_hash}}/1">More details</a>
{{#enable_as_hex}}
| <a href="/txhex/{{tx_hash}}">Tx as hex</a>
| <a href="/ringmembershex/{{tx_hash}}">Tx ring members as hex</a>
{{/enable_as_hex}}
</h5>
{{/show_more_details_link}} {{/show_more_details_link}}
{{/with_ring_signatures}} {{/with_ring_signatures}}
{{#with_ring_signatures}} {{#with_ring_signatures}}

@ -935,7 +935,7 @@ decode_ringct(rct::rctSig const& rv,
switch (rv.type) switch (rv.type)
{ {
case rct::RCTTypeSimple: case rct::RCTTypeSimple:
case rct::RCTTypeSimpleBulletproof: case rct::RCTTypeBulletproof:
amount = rct::decodeRctSimple(rv, amount = rct::decodeRctSimple(rv,
rct::sk2rct(scalar1), rct::sk2rct(scalar1),
i, i,
@ -943,7 +943,6 @@ decode_ringct(rct::rctSig const& rv,
hw::get_device("default")); hw::get_device("default"));
break; break;
case rct::RCTTypeFull: case rct::RCTTypeFull:
case rct::RCTTypeFullBulletproof:
amount = rct::decodeRct(rv, amount = rct::decodeRct(rv,
rct::sk2rct(scalar1), rct::sk2rct(scalar1),
i, i,
@ -1048,7 +1047,7 @@ decrypt(const std::string &ciphertext,
} }
crypto::chacha_key key; crypto::chacha_key key;
crypto::generate_chacha_key(&skey, sizeof(skey), key); crypto::generate_chacha_key(&skey, sizeof(skey), key, 1);
const crypto::chacha_iv &iv = *(const crypto::chacha_iv*)&ciphertext[0]; const crypto::chacha_iv &iv = *(const crypto::chacha_iv*)&ciphertext[0];
@ -1266,4 +1265,10 @@ pause_execution(uint64_t no_seconds, const string& text)
cout << endl; cout << endl;
} }
string
tx_to_hex(transaction const& tx)
{
return epee::string_tools::buff_to_hex_nodelimer(t_serializable_object_to_blob(tx));
}
} }

@ -370,6 +370,9 @@ calc_median(It it_begin, It it_end)
void void
pause_execution(uint64_t no_seconds, const string& text = "now"); pause_execution(uint64_t no_seconds, const string& text = "now");
string
tx_to_hex(transaction const& tx);
} }
#endif //XMREG01_TOOLS_H #endif //XMREG01_TOOLS_H
Loading…
Cancel
Save