ryo-blockchain-explorer
所属分类:区块链开发
开发工具:C++
文件大小:561KB
下载次数:0
上传日期:2022-10-19 11:53:53
上 传 者:
sh-1993
说明: ryo区块链浏览器,,
(ryo-blockchain-explorer,,)
文件列表:
CMakeLists.txt (3479, 2022-10-16)
LICENSE (1486, 2022-10-16)
cmake (0, 2022-10-16)
cmake\FindASan.cmake (2144, 2022-10-16)
cmake\FindMSan.cmake (2292, 2022-10-16)
cmake\FindMonero.cmake (2708, 2022-10-16)
cmake\FindSanitizers.cmake (3361, 2022-10-16)
cmake\FindTSan.cmake (2555, 2022-10-16)
cmake\FindUBSan.cmake (1696, 2022-10-16)
cmake\MyUtils.cmake (2001, 2022-10-16)
cmake\asan-wrapper (2011, 2022-10-16)
cmake\sanitize-helpers.cmake (7352, 2022-10-16)
ext (0, 2022-10-16)
ext\CMakeLists.txt (477, 2022-10-16)
ext\crow (0, 2022-10-16)
ext\crow\crow.h (704, 2022-10-16)
ext\crow\crow (0, 2022-10-16)
ext\crow\crow\TinySHA1.hpp (5547, 2022-10-16)
ext\crow\crow\app.h (16328, 2022-10-16)
ext\crow\crow\ci_map.h (866, 2022-10-16)
ext\crow\crow\common.h (9141, 2022-10-16)
ext\crow\crow\compression.h (3540, 2022-10-16)
ext\crow\crow\http_connection.h (23692, 2022-10-16)
ext\crow\crow\http_parser_merged.h (68561, 2022-10-16)
ext\crow\crow\http_request.h (2983, 2022-10-16)
ext\crow\crow\http_response.h (8404, 2022-10-16)
ext\crow\crow\http_server.h (9143, 2022-10-16)
ext\crow\crow\json.h (67163, 2022-10-16)
ext\crow\crow\logging.h (4369, 2022-10-16)
ext\crow\crow\middleware.h (15081, 2022-10-16)
ext\crow\crow\middleware_context.h (2462, 2022-10-16)
ext\crow\crow\middlewares (0, 2022-10-16)
ext\crow\crow\middlewares\cookie_parser.h (4228, 2022-10-16)
ext\crow\crow\middlewares\cors.h (5930, 2022-10-16)
ext\crow\crow\middlewares\utf-8.h (548, 2022-10-16)
ext\crow\crow\mime_types.h (4546, 2022-10-16)
ext\crow\crow\multipart.h (10382, 2022-10-16)
... ...
# Ryo Blockchain Explorer
Forked from [Onion Monero Blockchain Explorer](https://github.com/moneroexamples/onion-monero-blockchain-explorer)
Full featured Ryo blockchain explorer for privacy-oriented users:
- Does not use JavaScript,
- Does not have images which might be used for [cookieless tracking](http://lucb1e.com/rp/cookielesscookies/),
- Does not track users activates through google analytics,
- Open source,
- Supports Ryo testnet nor stagenet networks,
- Full featured JSON API.
Libraries:
- [crow](https://github.com/ipkn/crow) - C++ micro web framework
- [mstch](https://github.com/no1msd/mstch) - C++ {{mustache}} templates
- [json](https://github.com/nlohmann/json) - JSON for Modern C++
- [fmt](https://github.com/fmtlib/fmt) - Small, safe and fast string formatting library
## Explorer hosts
- [https://explorer.ryo-currency.com/](https://explorer.ryo-currency.com/) - Official Explorer
- [https://explorer.ryoblocks.com/](https://explorer.ryoblocks.com/) - RyoBlocks Explorer
- [https://tnexp.ryo-currency.com/](https://tnexp.ryo-currency.com/) - Testnet Explorer
## Ryo Blockchain Explorer features
The key features of the Ryo Blockchain Explorer are:
- no cookies, no web analytics trackers, no images,
- by default no JavaScript, but can be enabled for client side decoding and proving transactions,
- open sourced,
- made fully in C++,
- showing encrypted payments ID,
- showing ring signatures,
- showing transaction extra field,
- showing public components of Ryo addresses,
- decoding which outputs and mixins belong to the given Ryo address and viewkey,
- can prove that you send Ryo to someone,
- detailed information about ring members, such as, their age, timescale and their ring sizes,
- showing number of amount output indices,
- support Ryo testnet and stagnet networks,
- tx checker and pusher for online pushing of transactions,
- estimate possible spendings based on address and viewkey,
- can provide total amount of all miner fees,
- decoding encrypted payment id,
- decoding outputs and proving txs sent to sub-address.
## Compilation on Ubuntu 16.04/18.04
##### Compile latest Ryo development version
Download and compile recent Ryo into your home folder:
```bash
# first install ryo dependecines
sudo apt update
sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libminiupnpc-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev doxygen graphviz libpcsclite-dev
# go to home folder
cd ~
git clone --recursive https://github.com/ryo-currency/ryo-currency.git
cd ryo-currency/
make
```
##### Compile and run the explorer
Once the Ryo is compiled, the explorer can be downloaded and compiled
as follows:
```bash
# install explorer dependecines
sudo apt install libasio-dev libcurl4-openssl-dev
# go to home folder if still in ~/ryo-currency
cd ~
# download the source code
git clone https://github.com/ryo-currency/ryo-blockchain-explorer.git
# enter the downloaded sourced code folder
cd ryo-blockchain-explorer
# make a build folder and enter it
mkdir build && cd build
# create the makefile
cmake -DMONERO_DIR=~/ryo-currency ..
# also can build with ASAN (sanitizers), for example
# cmake -DSANITIZE_ADDRESS=On ..
# compile
make
```
To run it:
```
./xmrblocks -b /home/user/.ryo/lmdb02/
```
Example output:
```bash
user@arch:~/ryo-blockchain-explorer/build$ ./xmrblocks -b /home/user/.ryo/lmdb02
Staring in non-ssl mode
(2018-07-27 01:06:02) [INFO ] Crow/0.1 server is running at 127.0.0.1:8081 using 4 threads
```
Go to your browser: http://127.0.0.1:8081
## The explorer's command line options
```
xmrblocks, Ryo Blockchain Explorer:
-h [ --help ] [=arg(=1)] (=0) produce help message
-t [ --testnet ] [=arg(=1)] (=0) use testnet blockchain
-s [ --stagenet ] [=arg(=1)] (=0) use stagenet blockchain
--enable-pusher [=arg(=1)] (=0) enable signed transaction pusher
--enable-mixin-details [=arg(=1)] (=0)
enable mixin details for key images,
e.g., timescale, mixin of mixins, in tx
context
--enable-key-image-checker [=arg(=1)] (=0)
enable key images file checker
--enable-output-key-checker [=arg(=1)] (=0)
enable outputs key file checker
--enable-json-api [=arg(=1)] (=1) enable JSON REST api
--enable-tx-cache [=arg(=1)] (=0) enable caching of transaction details
--show-cache-times [=arg(=1)] (=0) show times of getting data from cache
vs no cache
--enable-block-cache [=arg(=1)] (=0) enable caching of block details
--enable-js [=arg(=1)] (=0) enable checking outputs and proving txs
using JavaScript on client side
--enable-autorefresh-option [=arg(=1)] (=0)
enable users to have the index page on
autorefresh
--enable-emission-monitor [=arg(=1)] (=0)
enable Ryo total emission monitoring
thread
-p [ --port ] arg (=8081) default explorer port
--testnet-url arg you can specify testnet url, if you run
it on mainnet or stagenet. link will
show on front page to testnet explorer
--stagenet-url arg you can specify stagenet url, if you
run it on mainnet or testnet. link will
show on front page to stagenet explorer
--mainnet-url arg you can specify mainnet url, if you run
it on testnet or stagenet. link will
show on front page to mainnet explorer
--no-blocks-on-index arg (=10) number of last blocks to be shown on
index page
--mempool-info-timeout arg (=5000) maximum time, in milliseconds, to wait
for mempool data for the front page
--mempool-refresh-time arg (=5) time, in seconds, for each refresh of
mempool state
-b [ --bc-path ] arg path to lmdb folder of the blockchain,
e.g., ~/.ryo/lmdb02
--ssl-crt-file arg path to crt file for ssl (https)
functionality
--ssl-key-file arg path to key file for ssl (https)
functionality
-d [ --deamon-url ] arg (=http:://127.0.0.1:12211)
Ryo deamon url
```
## Enable Ryo emission
Obtaining current Ryo emission amount is not straight forward. Thus, by default it is
disabled. To enable it use `--enable-emission-monitor` flag, e.g.,
```bash
xmrblocks --enable-emission-monitor
```
This flag will enable emission monitoring thread. When started, the thread
will initially scan the entire blockchain, and calculate the cumulative emission based on each block.
Since it is a separate thread, the explorer will work as usual during this time.
Every 10000 blocks, the thread will save current emission in a file, by default,
in `~/.ryo/lmdb/emission_amount.txt`. For testnet or stagenet networks,
it is `~/.ryo/testnet/lmdb/emission_amount.txt` or `~/.ryo/stagenet/lmdb/emission_amount.txt`. This file is used so that we don't
need to rescan entire blockchain whenever the explorer is restarted. When the
explorer restarts, the thread will first check if `~/.ryo/lmdb/emission_amount.txt`
is present, read its values, and continue from there if possible. Subsequently, only the initial
use of the tread is time consuming. Once the thread scans the entire blockchain, it updates
the emission amount using new blocks as they come. Since the explorer writes this file, there can
be only one instance of it running for mainnet, testnet and stagenet. Thus, for example, you cant have
two explorers for mainnet
running at the same time, as they will be trying to write and read the same file at the same time,
leading to unexpected results. Off course having one instance for mainnet and one instance for testnet
is fine, as they write to different files.
When the emission monitor is enabled, information about current emission of coinbase and fees is
displayed on the front page, e.g., :
```
Ryo emission (fees) is 14485540.430 (52545.373) as of 1313448 block
```
The values given, can be checked using Ryo daemon's `print_coinbase_tx_sum` command.
For example, for the above example: `print_coinbase_tx_sum 0 1313449`.
To disable the monitor, simply restart the explorer without `--enable-emission-monitor` flag.
Note: The pre-mined coins have been frozen/burned in commit [c3a3cb6](https://github.com/ryo-currency/ryo-emergency/commit/c3a3cb620488e88be7c52e017072261a3063b872)/ [blockchain_db/blockchain_db.cpp#L250-L258](https://github.com/ryo-currency/ryo-emergency/blob/c3a3cb620488e88be7c52e017072261a3063b872/src/blockchain_db/blockchain_db.cpp#L250-L258) and a modification has been made to the explorer to remove 8,700,000 coins from circulation.
## Enable JavaScript for decoding proving transactions
By default, decoding and proving tx's outputs are done on the server side. To do this on the client side
(private view and tx keys are not send to the server) JavaScript-based decoding can be enabled:
```
xmrblocks --enable-js
```
## Enable SSL (https)
By default, the explorer does not use ssl. But it has such a functionality.
As an example, you can generate your own ssl certificates as follows:
```bash
cd /tmp # example folder
openssl genrsa -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
```
Having the `crt` and `key` files, run `xmrblocks` in the following way:
```bash
./xmrblocks --ssl-crt-file=/tmp/server.crt --ssl-key-file=/tmp/server.key
```
Note: Because we generated our own certificate, modern browsers will complain
about it as they can't verify the signatures against any third party. So probably
for any practical use need to have properly issued ssl certificates. Alternatively,
use an SSL terminator such as nginx.
## JSON API
The explorer has JSON api. For the API, it uses conventions defined by [JSend](https://labs.omniti.com/labs/jsend).
By default the api is disabled. To enable it, use `--enable-json-api` flag, e.g.,
```
./xmrblocks --enable-json-api
```
#### api/transaction/
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/transaction/4307e5619b29dcc1d9cdf4a52b3d0717bcbab0efc06d88fb79a1e0e33594e6ec"
```
Partial results shown:
```json
{
"data":{
"block_height":156844,
"coinbase":true,
"confirmations":4,
"current_height":156848,
"extra":"0190c6a55fe6d77033f225291b36d22b7002***d9c3f7c3***8516f73f***70216015021039303031000000020000001049d4e900",
"inputs":null,
"mixin":0,
"outputs":[
{
"amount":41978500000,
"public_key":"9935ac366ebd6fb6aee84581d9027dd04***ff6761a470bfaa8e48ff429788e22"
}
],
"payment_id":"",
"payment_id8":"",
"rct_type":0,
"timestamp":1532***9166,
"timestamp_utc":"2018-07-26 23:52:46",
"tx_fee":0,
"tx_hash":"4307e5619b29dcc1d9cdf4a52b3d0717bcbab0efc06d88fb79a1e0e33594e6ec",
"tx_size":102,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":41978500000
},
"status":"success"
}
```
---
#### api/transactions
Transactions in last 25 blocks
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/transactions"
```
Partial results shown:
```json
{
"data":{
"blocks":[
{
"age":"00:05:41",
"hash":"e3ff8c52516b838***88ee742d7f18448e3760199560f24ebd80092e46019fa9c",
"height":156848,
"size":28268.0,
"timestamp":1532***9512,
"timestamp_utc":"2018-07-26 23:58:32",
"txs":[
{
"coinbase":true,
"extra":"01c9417029a41208a7142bf3a458935403328b34ca54a6c8b8a2ecf661043844000211af08e9cf0732704a000000000000000000",
"mixin":0,
"payment_id":"",
"payment_id8":"",
"rct_type":0,
"tx_fee":0,
"tx_hash":"5ace475abe36a574ee0d73e2c6aa5ba37473361934ed1b36***1f17cbd8c6ecb4",
"tx_size":103,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":41999000000
},
{
"coinbase":false,
"extra":"0181a8586bb9e3f***e04b80496632a9fea2afa59fb5e3c844b1ab28182f833e053",
"mixin":13,
"payment_id":"",
"payment_id8":"",
"rct_type":1,
"tx_fee":14000000,
"tx_hash":"242b5bca09edf614a***40a183c949934dbc1de82176bc2103141be7aed39ae32",
"tx_size":13586,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":0
},
{
"coinbase":false,
"extra":"01622d73b89759ab0ba0d9fb211fd430ada1b5958eea6a14b5aa08f0cd0a1def1c",
"mixin":13,
"payment_id":"",
"payment_id8":"",
"rct_type":2,
"tx_fee":15000000,
"tx_hash":"01cf17ce53e132f1a***7cb1b4dbfe51d13a163425d2202744c624166514746d9",
"tx_size":14579,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":0
}
]
},
],
"current_height":156849,
"limit":25,
"page":0,
"total_page_no":6273
},
"status":"success"
}
```
---
#### api/transactions?page=&limit=
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/transactions?page=2&limit=10"
```
Result analogical to the one above.
---
#### api/block/
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/block/150000"
```
Partial results shown:
```json
{
"data":{
"block_height":150000,
"current_height":156849,
"hash":"debc58ac***fc8dc7ae35b0b8782ae33a0fe5855dc85930bc52b8fec3c1aee94a",
"size":422899,
"timestamp":1530990884,
"timestamp_utc":"2018-07-07 19:14:44",
"txs":[
{
"coinbase":true,
"extra":"01e10420c2c5461ace855ffc8aa4a8256e784e873c325d71e7***812ac90c35c19b020816d80f5c00000000",
"mixin":0,
"payment_id":"",
"payment_id8":"",
"rct_type":0,
"tx_fee":0,
"tx_hash":"2743243d3eb70b88baa26f70dd20c60***70c5995de194ad9d0d4acf83d5ab761",
"tx_size":94,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":42187500000
},
]
},
"status":"success"
}
```
---
#### api/mempool
Return all txs in the mempool.
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/mempool"
```
Partial results shown:
```json
{
"data":{
"limit":100000000,
"page":0,
"total_page_no":0,
"txs":[
{
"coinbase":false,
"extra":"0221000140bc72***830abaeb711b7214acb45c431db86c52da40f739fb6908f5dbe596019d29ab0f8b846889d1971d8d7915baab2b2335c4105bcdda1517544f2c4aa086",
"mixin":13,
"payment_id":"0140bc72***830abaeb711b7214acb45c431db86c52da40f739fb6908f5dbe596",
"payment_id8":"",
"rct_type":2,
"timestamp":0,
"timestamp_utc":"1970-01-01 00:00:00",
"tx_fee":8000000,
"tx_hash":"8f00e3746c7fe1e50bd72da69e00449b53586fbd793ed392a63c283b9fbf7c49",
"tx_size":15584,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":0
},
],
"txs_no":3
},
"status":"success"
}
```
Limit of 100000000 is just default value above to ensure that all mempool txs are fetched
if no specific limit given.
---
#### api/mempool?limit=
Return number of newest mempool txs, e.g., only 10.
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/mempool?limit=10"
```
Result analogical to the one above.
---
#### api/search/
```bash
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/search/150000"
```
Partial results shown:
```json
{
"data":{
"block_height":150000,
"current_height":156850,
"hash":"debc58ac***fc8dc7ae35b0b8782ae33a0fe5855dc85930bc52b8fec3c1aee94a",
"size":422899,
"timestamp":1530990884,
"timestamp_utc":"2018-07-07 19:14:44",
"title":"block",
"txs":[
{
"coinbase":true,
"extra":"01e10420c2c5461ace855ffc8aa4a8256e784e873c325d71e7***812ac90c35c19b020816d80f5c00000000",
"mixin":0,
"payment_id":"",
"payment_id8":"",
"rct_type":0,
"tx_fee":0,
"tx_hash":"2743243d3eb70b88baa26f70dd20c60***70c5995de194ad9d0d4acf83d5ab761",
"tx_size":94,
"tx_version":3,
"xmr_inputs":0,
"xmr_outputs":42187500000
},
]
},
"status":"success"
}
```
---
#### api/outputs?txhash=&address=&viewkey=&txprove=<0|1>
For `txprove=0` we check which outputs belong to given address and corresponding viewkey.
For `txprove=1` we use to prove to the recipient that we sent them founds.
For this, we use recipient's address and our tx private key as a viewkey value,
i.e., `viewkey=`
Checking outputs:
```bash
# we use here official Ryo project's donation address as an example
curl -w "\n" -X GET "https://explorer.ryo-currency.com/api/outputs?txhash=17049bc5f2d9fbca1ce8dae443bbbbed2fc02f1ee003ffdd0571996905faa831&address=RYoLshW4LVn8TurtCrZzAd79FURtPHb93ATRYch3JpSDgvPRubk1VeEKg33sVifjASf7NzZtgQ6urVAAAKDKDtmUiDraNbdDvyk&viewkey=f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501&txprove=0"
```
```json
{
"data": {
"address": "RYoLshW4LVn8TurtCrZzAd79FURtPHb93ATRYch3JpSDgvPRubk1VeEKg33sVifjASf7NzZtgQ6urVAAAKDKDtmUiDraNbdDvyk",
"outputs": [
{
"amount": 34***0000000000,
"match": true,
"output_idx": 0,
"output_pubkey": "35d7200229e725c2bce0da3a2f20ef0720d242ecf88bfcb71eff2025c2501fdb"
},
{
"amount": 0,
"match": false,
"output_idx": 1,
"output_pubkey": "44efccab9f9b42e83c12da7***8785d6c4eb3ec6e7aa2ae1234e2f0f7cb9ed6dd"
}
],
"tx_hash": "17049bc5f2d9fbca1ce8dae443bbbbed2fc02f1ee003ffdd0571996905faa831",
"tx_prove": false,
"viewkey": "f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c3895 ... ...
近期下载者:
相关文件:
收藏者: