Merge branch 'master' into devel

master
moneroexamples 2 years ago committed by GitHub
commit 296836b639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@
FROM ubuntu:20.04 as builder
# Set Monero branch/tag to be used for monerod compilation
ARG MONERO_BRANCH=release-v18
# Added DEBIAN_FRONTEND=noninteractive to workaround tzdata prompt on installation

@ -24,26 +24,27 @@ Monero C++ libraries, but also demonstrates how to use:
## Explorer hosts
Clearnet versions:
- [https://xmrchain.net/](https://xmrchain.net/) - https enabled, most popular and very stable.
- [https://monerohash.com/explorer/](https://monerohash.com/explorer/) - nice looking one, https enabled.
- [https://xmrchain.net/](https://xmrchain.net/) - HTTPS enabled, most popular, and very stable.
- [https://monerohash.com/explorer/](https://monerohash.com/explorer/) - nice looking one, HTTPS enabled.
- [http://monerochain.com/](http://monerochain.com/) - JSON API based, multiple nodes.
- [https://blox.minexmr.com/](https://blox.minexmr.com/) - - https enabled.
- [https://community.xmr.to/explorer/mainnet/](https://community.xmr.to/explorer/mainnet/)
- [https://blox.minexmr.com/](https://blox.minexmr.com/) - HTTPS enabled.
Testnet version:
- [https://testnet.xmrchain.com/](https://testnet.xmrchain.com/) - https enabled.
- [https://community.xmr.to/explorer/testnet/](https://community.xmr.to/explorer/testnet/)
Stagenet version:
- [https://stagenet.xmrchain.net/](https://stagenet.xmrchain.net/)
- [https://community.xmr.to/explorer/stagenet/](https://community.xmr.to/explorer/stagenet/)
i2p users (main Monero network):
- [http://7o4gezpkye6ekibhgpkg7v626ze4idsirapufzrefkdysa6zxhha.b32.i2p/](http://7o4gezpkye6ekibhgpkg7v626ze4idsirapufzrefkdysa6zxhha.b32.i2p/)
Tor versions:
- [http://exploredv42tq2nowrll6f27nuymenndwupueqvyugaqzbrvmjhhceqd.onion/](http://exploredv42tq2nowrll6f27nuymenndwupueqvyugaqzbrvmjhhceqd.onion/) - Native v3 Onion, JSON API enabled, emission enabled, rawtx enabled.
Alternative block explorers:
- [https://localmonero.co/blocks](https://localmonero.co/blocks)
@ -235,16 +236,6 @@ docker-compose up -d
When running via Docker, please use something like [Traefik](https://doc.traefik.io/traefik/) or [enable SSL](#enable-ssl-https) to secure communications.
## The explorer's command line options
```
@ -297,7 +288,7 @@ xmrblocks, Onion Monero Blockchain Explorer:
functionality
--ssl-key-file arg path to key file for ssl (https)
functionality
-d [ --deamon-url ] arg (=127.0.0.1:18081)
-d [ --daemon-url ] arg (=http:://127.0.0.1:18081)
Monero daemon url
--daemon-login arg Specify username[:password] for daemon
RPC client
@ -326,7 +317,6 @@ docker run -it -d -v <path-to-monero-blockchain-on-the-host>:/home/monero/.bitmo
Make sure to always start the portion of command line flags with `./xmrblocks` and set any flags you would like after that, as shown above.
## Enable Monero emission
Obtaining current Monero emission amount is not straight forward. Thus, by default it is

@ -56,7 +56,7 @@ main(int ac, const char* av[])
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 deamon_url_opt = opts.get_option<string>("deamon-url");
auto daemon_url_opt = opts.get_option<string>("daemon-url");
auto ssl_crt_file_opt = opts.get_option<string>("ssl-crt-file");
auto ssl_key_file_opt = opts.get_option<string>("ssl-key-file");
auto no_blocks_on_index_opt = opts.get_option<string>("no-blocks-on-index");
@ -206,7 +206,7 @@ main(int ac, const char* av[])
return EXIT_FAILURE;
}
string deamon_url {*deamon_url_opt};
string daemon_url {*daemon_url_opt};
if (testnet && deamon_url == "127.0.0.1:18081")
deamon_url = "127.0.0.1:28081";
@ -248,8 +248,8 @@ main(int ac, const char* av[])
= blockchain_path;
xmreg::CurrentBlockchainStatus::nettype
= nettype;
xmreg::CurrentBlockchainStatus::deamon_url
= deamon_url;
xmreg::CurrentBlockchainStatus::daemon_url
= daemon_url;
xmreg::CurrentBlockchainStatus::set_blockchain_variables(
&mcore, core_storage);
@ -265,8 +265,8 @@ main(int ac, const char* av[])
= blockchain_path;
xmreg::MempoolStatus::nettype
= nettype;
xmreg::MempoolStatus::deamon_url
= deamon_url;
xmreg::MempoolStatus::daemon_url
= daemon_url;
xmreg::MempoolStatus::login
= daemon_rpc_login;
xmreg::MempoolStatus::set_blockchain_variables(
@ -300,7 +300,7 @@ main(int ac, const char* av[])
// contains logic for the website
xmreg::page xmrblocks(&mcore,
core_storage,
deamon_url,
daemon_url,
nettype,
enable_pusher,
enable_randomx,

@ -71,7 +71,7 @@ namespace xmreg
"path to key file for ssl (https) functionality")
("daemon-login", value<string>(),
"Specify username[:password] for daemon RPC client")
("deamon-url,d", value<string>()->default_value("127.0.0.1:18081"),
("daemon-url,d", value<string>()->default_value("127.0.0.1:18081"),
"Monero daemon url")
("enable-mixin-guess", value<bool>()->default_value(false)->implicit_value(true),
"enable guessing real outputs in key images based on viewkey");

@ -303,7 +303,7 @@ cryptonote::network_type CurrentBlockchainStatus::nettype {cryptonote::network_t
string CurrentBlockchainStatus::output_file {"emission_amount.txt"};
string CurrentBlockchainStatus::deamon_url {"http:://127.0.0.1:18081"};
string CurrentBlockchainStatus::daemon_url {"http:://127.0.0.1:18081"};
uint64_t CurrentBlockchainStatus::blockchain_chunk_size {10000};

@ -51,7 +51,7 @@ struct CurrentBlockchainStatus
static string output_file;
static string deamon_url;
static string daemon_url;
// how many blocks to read before thread goes to sleep
static uint64_t blockchain_chunk_size;

@ -96,7 +96,7 @@ MempoolStatus::start_mempool_status_thread()
bool
MempoolStatus::read_mempool()
{
rpccalls rpc {deamon_url, login};
rpccalls rpc {daemon_url, login};
string error_msg;
@ -222,7 +222,7 @@ MempoolStatus::read_mempool()
bool
MempoolStatus::read_network_info()
{
rpccalls rpc {deamon_url, login};
rpccalls rpc {daemon_url, login};
COMMAND_RPC_GET_INFO::response rpc_network_info;
@ -329,7 +329,7 @@ MempoolStatus::is_thread_running()
}
bf::path MempoolStatus::blockchain_path {"/home/mwo/.bitmonero/lmdb"};
string MempoolStatus::deamon_url {"http:://127.0.0.1:18081"};
string MempoolStatus::daemon_url {"http:://127.0.0.1:18081"};
cryptonote::network_type MempoolStatus::nettype {cryptonote::network_type::MAINNET};
atomic<bool> MempoolStatus::is_running {false};
boost::thread MempoolStatus::m_thread;

@ -125,7 +125,7 @@ struct MempoolStatus
static atomic<uint64_t> mempool_size; // size in bytes.
static bf::path blockchain_path;
static string deamon_url;
static string daemon_url;
static cryptonote::network_type nettype;
static rpccalls::login_opt login;

@ -499,7 +499,7 @@ public:
page(MicroCore* _mcore,
Blockchain* _core_storage,
string _deamon_url,
string _daemon_url,
cryptonote::network_type _nettype,
bool _enable_pusher,
bool _enable_randomx,
@ -517,7 +517,7 @@ page(MicroCore* _mcore,
rpccalls::login_opt _daemon_rpc_login)
: mcore {_mcore},
core_storage {_core_storage},
rpc {_deamon_url, _daemon_rpc_login},
rpc {_daemon_url, _daemon_rpc_login},
server_timestamp {std::time(nullptr)},
nettype {_nettype},
enable_pusher {_enable_pusher},
@ -1436,6 +1436,7 @@ show_block_hex(size_t block_height, bool complete_blk)
epee::byte_slice complete_block_data_slice;
if(!epee::serialization::store_t_to_binary(
complete_block_data, complete_block_data_slice))
{
@ -1447,6 +1448,7 @@ show_block_hex(size_t block_height, bool complete_blk)
complete_block_data_slice.begin(),
complete_block_data_slice.end());
return epee::string_tools
::buff_to_hex_nodelimer(block_data_str);
}
@ -2203,6 +2205,8 @@ show_my_outputs(string tx_hash_str,
// check if generated public key matches the current output's key
bool mine_output = (std::get<0>(outp) == tx_pubkey);
bool with_additional = false;
if (!mine_output && txd.additional_pks.size()

@ -9,13 +9,13 @@ namespace xmreg
rpccalls::rpccalls(
string _deamon_url,
string _daemon_url,
login_opt login,
uint64_t _timeout)
: deamon_url {_deamon_url},
: daemon_url {_daemon_url},
timeout_time {_timeout}
{
epee::net_utils::parse_url(deamon_url, url);
epee::net_utils::parse_url(daemon_url, url);
port = std::to_string(url.port);
@ -23,12 +23,13 @@ rpccalls::rpccalls(
m_http_client.set_server(
deamon_url,
login,
epee::net_utils::ssl_support_t::e_ssl_support_disabled);
}
bool
rpccalls::connect_to_monero_deamon()
rpccalls::connect_to_monero_daemon()
{
//std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
@ -48,9 +49,9 @@ rpccalls::get_current_height()
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_current_height: not connected to deamon" << endl;
cerr << "get_current_height: not connected to daemon" << endl;
return false;
}
@ -60,8 +61,8 @@ rpccalls::get_current_height()
if (!r)
{
cerr << "Error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "Error connecting to Monero daemon at "
<< daemon_url << endl;
return 0;
}
@ -80,9 +81,9 @@ rpccalls::get_mempool(vector<tx_info>& mempool_txs)
{
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_mempool: not connected to deamon" << endl;
cerr << "get_mempool: not connected to daemon" << endl;
return false;
}
@ -93,8 +94,8 @@ rpccalls::get_mempool(vector<tx_info>& mempool_txs)
if (!r || res.status != CORE_RPC_STATUS_OK)
{
cerr << "Error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "Error connecting to Monero daemon at "
<< daemon_url << endl;
return false;
}
@ -127,9 +128,9 @@ rpccalls::commit_tx(tools::wallet2::pending_tx& ptx, string& error_msg)
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "commit_tx: not connected to deamon" << endl;
cerr << "commit_tx: not connected to daemon" << endl;
return false;
}
@ -166,9 +167,9 @@ rpccalls::get_network_info(COMMAND_RPC_GET_INFO::response& response)
{
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_network_info: not connected to deamon" << endl;
cerr << "get_network_info: not connected to daemon" << endl;
return false;
}
@ -192,15 +193,15 @@ rpccalls::get_network_info(COMMAND_RPC_GET_INFO::response& response)
if (!err.empty())
{
cerr << "Error connecting to Monero deamon due to "
cerr << "Error connecting to Monero daemon due to "
<< err << endl;
return false;
}
}
else
{
cerr << "Error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "Error connecting to Monero daemon at "
<< daemon_url << endl;
return false;
}
@ -226,9 +227,9 @@ rpccalls::get_hardfork_info(COMMAND_RPC_HARD_FORK_INFO::response& response)
{
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_hardfork_info: not connected to deamon" << endl;
cerr << "get_hardfork_info: not connected to daemon" << endl;
return false;
}
@ -253,15 +254,15 @@ rpccalls::get_hardfork_info(COMMAND_RPC_HARD_FORK_INFO::response& response)
if (!err.empty())
{
cerr << "Error connecting to Monero deamon due to "
cerr << "Error connecting to Monero daemon due to "
<< err << endl;
return false;
}
}
else
{
cerr << "Error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "Error connecting to Monero daemon at "
<< daemon_url << endl;
return false;
}
@ -294,9 +295,9 @@ rpccalls::get_dynamic_per_kb_fee_estimate(
{
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_dynamic_per_kb_fee_estimate: not connected to deamon" << endl;
cerr << "get_dynamic_per_kb_fee_estimate: not connected to daemon" << endl;
return false;
}
@ -321,15 +322,15 @@ rpccalls::get_dynamic_per_kb_fee_estimate(
if (!err.empty())
{
cerr << "Error connecting to Monero deamon due to "
cerr << "Error connecting to Monero daemon due to "
<< err << endl;
return false;
}
}
else
{
cerr << "Error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "Error connecting to Monero daemon at "
<< daemon_url << endl;
return false;
}
@ -357,9 +358,9 @@ rpccalls::get_block(string const& blk_hash, block& blk, string& error_msg)
{
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_block: not connected to deamon" << endl;
cerr << "get_block: not connected to daemon" << endl;
return false;
}
@ -384,15 +385,15 @@ rpccalls::get_block(string const& blk_hash, block& blk, string& error_msg)
if (!err.empty())
{
cerr << "Error connecting to Monero deamon due to "
cerr << "Error connecting to Monero daemon due to "
<< err << endl;
return false;
}
}
else
{
cerr << "get_block: error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "get_block: error connecting to Monero daemon at "
<< daemon_url << endl;
return false;
}

@ -69,7 +69,7 @@ using namespace std;
class rpccalls
{
string deamon_url ;
string daemon_url ;
uint64_t timeout_time;
std::chrono::milliseconds timeout_time_ms;
@ -86,12 +86,12 @@ public:
using login_opt = boost::optional<epee::net_utils::http::login>;
rpccalls(string _deamon_url = "http:://127.0.0.1:18081",
rpccalls(string _daemon_url = "http:://127.0.0.1:18081",
login_opt _login = login_opt {},
uint64_t _timeout = 200000);
bool
connect_to_monero_deamon();
connect_to_monero_daemon();
uint64_t
get_current_height();
@ -136,9 +136,9 @@ public:
{
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
if (!connect_to_monero_deamon())
if (!connect_to_monero_daemon())
{
cerr << "get_alt_blocks: not connected to deamon" << endl;
cerr << "get_alt_blocks: not connected to daemon" << endl;
return false;
}
@ -162,15 +162,15 @@ public:
if (!err.empty())
{
cerr << "Error connecting to Monero deamon due to "
cerr << "Error connecting to Monero daemon due to "
<< err << endl;
return false;
}
}
else
{
cerr << "Error connecting to Monero deamon at "
<< deamon_url << endl;
cerr << "Error connecting to Monero daemon at "
<< daemon_url << endl;
return false;
}

Loading…
Cancel
Save