onion-wownero-blockchain-ex.../README.md

783 lines
25 KiB
Markdown
Raw Permalink Normal View History

2016-09-22 01:48:29 +00:00
# Onion Monero Blockchain Explorer
2016-05-07 09:32:28 +00:00
2018-05-01 01:15:17 +00:00
Currently available Monero blockchain explorers have several limitations which are of
2017-04-28 07:34:08 +00:00
special importance to privacy-oriented users:
2016-05-07 09:32:28 +00:00
2016-09-22 01:48:29 +00:00
- they use JavaScript,
- have images which might be used for [cookieless tracking](http://lucb1e.com/rp/cookielesscookies/),
- track users activities through google analytics,
2016-09-22 01:48:29 +00:00
- are closed sourced,
- are not available as hidden services,
2018-03-27 00:16:02 +00:00
- do not support Monero testnet nor stagenet networks,
2017-05-04 06:22:54 +00:00
- have limited JSON API.
2016-05-07 09:32:28 +00:00
2016-05-09 01:40:16 +00:00
In this example, these limitations are addressed by development of
2018-05-01 01:15:17 +00:00
an Onion Monero Blockchain Explorer. The example not only shows how to use
Monero C++ libraries, but also demonstrates how to use:
2016-05-09 01:40:16 +00:00
2018-05-01 01:15:17 +00:00
- [crow](https://github.com/ipkn/crow) - C++ micro web framework
2016-05-09 01:40:16 +00:00
- [mstch](https://github.com/no1msd/mstch) - C++ {{mustache}} templates
- [json](https://github.com/nlohmann/json) - JSON for Modern C++
2016-11-23 06:29:03 +00:00
- [fmt](https://github.com/fmtlib/fmt) - Small, safe and fast string formatting library
2016-05-07 09:32:28 +00:00
2018-06-03 00:39:54 +00:00
## Explorer hosts
2016-05-21 07:50:28 +00:00
2018-05-01 01:15:17 +00:00
Clearnet versions:
- [https://xmrchain.net/](https://xmrchain.net/) - https enabled, most popular and very stable.
2017-09-02 20:54:30 +00:00
- [https://monerohash.com/explorer/](https://monerohash.com/explorer/) - nice looking one, https enabled.
- [http://monerochain.com/](http://monerochain.com/) - JSON API based, multiple nodes.
2018-04-06 10:08:49 +00:00
- [https://blox.minexmr.com/](https://blox.minexmr.com/) - - https enabled.
2019-02-28 00:22:06 +00:00
- [https://community.xmr.to/explorer/mainnet/](https://community.xmr.to/explorer/mainnet/)
2018-05-01 01:15:17 +00:00
2018-04-13 11:56:58 +00:00
Testnet version:
2018-04-04 23:48:26 +00:00
2017-02-20 00:46:33 +00:00
- [https://testnet.xmrchain.com/](https://testnet.xmrchain.com/) - https enabled.
2019-02-28 00:22:06 +00:00
- [https://community.xmr.to/explorer/testnet/](https://community.xmr.to/explorer/testnet/)
2018-05-01 01:15:17 +00:00
2018-04-13 11:56:58 +00:00
Stagenet version:
2019-02-28 00:22:06 +00:00
2018-10-16 23:04:01 +00:00
- [https://stagenet.xmrchain.net/](https://stagenet.xmrchain.net/)
2019-02-28 00:22:06 +00:00
- [https://community.xmr.to/explorer/stagenet/](https://community.xmr.to/explorer/stagenet/)
2017-04-04 06:42:36 +00:00
2017-08-22 00:38:23 +00:00
i2p users (main Monero network):
2016-11-24 03:29:47 +00:00
2017-08-22 00:38:23 +00:00
- [http://7o4gezpkye6ekibhgpkg7v626ze4idsirapufzrefkdysa6zxhha.b32.i2p/](http://7o4gezpkye6ekibhgpkg7v626ze4idsirapufzrefkdysa6zxhha.b32.i2p/)
2016-05-21 07:50:28 +00:00
2017-05-26 01:25:02 +00:00
Alternative block explorers:
- [https://localmonero.co/blocks](https://localmonero.co/blocks)
- [https://monerovision.com](https://monerovision.com)
2018-05-01 01:15:17 +00:00
2016-09-22 01:48:29 +00:00
## Onion Monero Blockchain Explorer features
The key features of the Onion Monero Blockchain Explorer are:
2016-09-22 01:48:29 +00:00
2018-01-19 03:58:27 +00:00
- no cookies, no web analytics trackers, no images,
2016-09-22 01:48:29 +00:00
- open sourced,
- made fully in C++,
2017-08-25 22:18:13 +00:00
- showing encrypted payments ID,
- showing ring signatures,
- showing transaction extra field,
- showing public components of Monero addresses,
- decoding which outputs and mixins belong to the given Monero address and viewkey,
- can prove that you send Monero to someone,
- detailed information about ring members, such as their age, timescale, and ring sizes,
2017-08-25 22:18:13 +00:00
- showing number of amount output indices,
2018-05-13 05:48:37 +00:00
- support Monero testnet and stagnet networks,
2017-08-25 22:18:13 +00:00
- tx checker and pusher for online pushing of transactions,
- estimate possible spendings based on address and viewkey,
2018-05-13 05:48:37 +00:00
- can provide total amount of all miner fees,
- decoding encrypted payment id,
2017-11-20 01:06:14 +00:00
- decoding outputs and proving txs sent to sub-address.
2019-10-24 08:25:29 +00:00
- listing RandomX code for each block
2016-09-22 01:48:29 +00:00
2017-11-20 01:04:42 +00:00
## Development branch
2018-04-13 11:56:58 +00:00
Current development branch:
2017-11-20 01:04:42 +00:00
- https://github.com/moneroexamples/onion-monero-blockchain-explorer/tree/devel
2018-05-01 01:15:17 +00:00
2019-12-15 06:34:45 +00:00
Note: `devel` branch of the explorer follows `master` branch of the monero!
2017-11-20 01:04:42 +00:00
2020-09-23 13:01:03 +00:00
## Compilation on Ubuntu 18.04/20.04
2016-05-07 09:32:28 +00:00
2016-05-08 08:45:51 +00:00
2019-06-16 00:45:16 +00:00
#### Monero download and compilation
2016-05-23 01:17:15 +00:00
2019-06-16 00:45:16 +00:00
To download and compile recent Monero follow instructions
in the following link:
2016-05-28 01:53:11 +00:00
2019-06-16 00:45:16 +00:00
https://github.com/moneroexamples/monero-compilation/blob/master/README.md
##### Compile and run the explorer
2017-09-06 23:05:18 +00:00
2019-06-16 00:45:16 +00:00
Once the Monero compiles, the explorer can be downloaded and compiled
2016-05-28 02:06:35 +00:00
as follows:
2016-05-08 08:45:51 +00:00
```bash
# go to home folder if still in ~/monero
cd ~
2019-02-27 15:14:51 +00:00
# download the source code
git clone https://github.com/moneroexamples/onion-monero-blockchain-explorer.git
2016-05-08 08:45:51 +00:00
# enter the downloaded sourced code folder
cd onion-monero-blockchain-explorer
2016-11-23 06:29:03 +00:00
# make a build folder and enter it
mkdir build && cd build
2016-05-08 08:45:51 +00:00
# create the makefile
2016-11-23 06:29:03 +00:00
cmake ..
2016-05-08 08:45:51 +00:00
# compile
make
```
2016-05-28 02:06:35 +00:00
To run it:
```
./xmrblocks
```
2017-04-18 05:18:37 +00:00
By default it will look for blockchain in its default location i.e., `~/.bitmonero/lmdb`.
2018-05-13 05:48:37 +00:00
You can use `-b` option if its in different location.
For example:
```bash
2021-04-25 03:49:27 +00:00
./xmrblocks -b /home/mwo/non-default-monero-location/lmdb/
2018-05-13 05:48:37 +00:00
```
2016-05-28 02:06:35 +00:00
Example output:
```bash
[mwo@arch onion-monero-blockchain-explorer]$ ./xmrblocks
2016-May-28 10:04:49.160280 Blockchain initialized. last block: 1056761, d0.h0.m12.s47 time ago, current difficulty: 1517857750
(2016-05-28 02:04:49) [INFO ] Crow/0.1 server is running, local port 8081
```
Go to your browser: http://127.0.0.1:8081
2017-01-17 02:48:46 +00:00
## The explorer's command line options
```
xmrblocks, Onion Monero Blockchain Explorer:
2017-01-17 02:48:46 +00:00
-h [ --help ] [=arg(=1)] (=0) produce help message
-t [ --testnet ] [=arg(=1)] (=0) use testnet blockchain
2018-03-27 00:16:02 +00:00
-s [ --stagenet ] [=arg(=1)] (=0) use stagenet blockchain
--enable-pusher [=arg(=1)] (=0) enable signed transaction pusher
2019-11-05 00:06:11 +00:00
--enable-randomx [=arg(=1)] (=0) enable generation of randomx code
--enable-mixin-details [=arg(=1)] (=0)
2018-05-01 01:15:17 +00:00
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
2019-11-05 00:06:11 +00:00
--enable-json-api [=arg(=1)] (=0) enable JSON REST api
--enable-as-hex [=arg(=1)] (=0) enable links to provide hex
represtations of a tx and a block
--enable-autorefresh-option [=arg(=1)] (=0)
2018-05-01 01:15:17 +00:00
enable users to have the index page on
autorefresh
--enable-emission-monitor [=arg(=1)] (=0)
enable Monero total emission monitoring
thread
-p [ --port ] arg (=8081) default explorer port
2019-11-05 00:06:11 +00:00
-x [ --bindaddr ] arg (=0.0.0.0) default bind address for the explorer
--testnet-url arg you can specify testnet url, if you run
2018-05-01 01:15:17 +00:00
it on mainnet or stagenet. link will
2018-03-27 00:16:02 +00:00
show on front page to testnet explorer
2018-05-01 01:15:17 +00:00
--stagenet-url arg you can specify stagenet url, if you
2018-03-27 00:16:02 +00:00
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
2018-05-01 01:15:17 +00:00
it on testnet or stagenet. link will
2018-03-27 00:16:02 +00:00
show on front page to mainnet explorer
2018-05-01 01:15:17 +00:00
--no-blocks-on-index arg (=10) number of last blocks to be shown on
index page
2018-05-01 01:15:17 +00:00
--mempool-info-timeout arg (=5000) maximum time, in milliseconds, to wait
for mempool data for the front page
2018-05-01 01:15:17 +00:00
--mempool-refresh-time arg (=5) time, in seconds, for each refresh of
2017-06-02 05:15:42 +00:00
mempool state
2019-11-05 00:06:11 +00:00
-c [ --concurrency ] arg (=0) number of threads handling http
queries. Default is 0 which means it is
based you on the cpu
2018-05-01 01:15:17 +00:00
-b [ --bc-path ] arg path to lmdb folder of the blockchain,
e.g., ~/.bitmonero/lmdb
2018-05-01 01:15:17 +00:00
--ssl-crt-file arg path to crt file for ssl (https)
2017-01-17 02:48:46 +00:00
functionality
2018-05-01 01:15:17 +00:00
--ssl-key-file arg path to key file for ssl (https)
2017-01-17 02:48:46 +00:00
functionality
-d [ --deamon-url ] arg (=http:://127.0.0.1:18081)
2019-11-05 00:06:11 +00:00
Monero daemon url
2019-12-25 23:12:25 +00:00
--daemon-login arg Specify username[:password] for daemon
RPC client
2017-01-17 02:48:46 +00:00
```
2017-05-04 06:28:55 +00:00
Example usage, defined as bash aliases.
```bash
2017-05-04 06:30:28 +00:00
# for mainnet explorer
2017-08-27 23:58:43 +00:00
alias xmrblocksmainnet='~/onion-monero-blockchain-explorer/build/xmrblocks --port 8081 --testnet-url "http://139.162.32.245:8082" --enable-pusher --enable-emission-monitor'
2017-05-04 06:30:28 +00:00
# for testnet explorer
2017-08-27 23:58:43 +00:00
alias xmrblockstestnet='~/onion-monero-blockchain-explorer/build/xmrblocks -t --port 8082 --mainnet-url "http://139.162.32.245:8081" --enable-pusher --enable-emission-monitor'
2017-05-04 06:28:55 +00:00
```
2018-05-01 01:15:17 +00:00
## Enable Monero emission
2018-05-01 01:15:17 +00:00
Obtaining current Monero emission amount is not straight forward. Thus, by default it is
disabled. To enable it use `--enable-emission-monitor` flag, e.g.,
```bash
2018-05-01 01:15:17 +00:00
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.
2018-05-01 01:15:17 +00:00
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 `~/.bitmonero/lmdb/emission_amount.txt`. For testnet or stagenet networks,
2018-03-27 00:16:02 +00:00
it is `~/.bitmonero/testnet/lmdb/emission_amount.txt` or `~/.bitmonero/stagenet/lmdb/emission_amount.txt`. This file is used so that we don't
2018-05-01 01:15:17 +00:00
need to rescan entire blockchain whenever the explorer is restarted. When the
explorer restarts, the thread will first check if `~/.bitmonero/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
2017-05-26 01:25:02 +00:00
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 can't have
2017-05-26 01:25:02 +00:00
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.
2018-05-01 01:15:17 +00:00
When the emission monitor is enabled, information about current emission of coinbase and fees is
displayed on the front page, e.g., :
2018-05-01 01:15:17 +00:00
```
Monero emission (fees) is 14485540.430 (52545.373) as of 1313448 block
```
2018-05-01 01:15:17 +00:00
The values given, can be checked using Monero daemon's `print_coinbase_tx_sum` command.
For example, for the above example: `print_coinbase_tx_sum 0 1313449`.
2018-05-01 01:15:17 +00:00
To disable the monitor, simply restart the explorer without `--enable-emission-monitor` flag.
2018-01-28 01:17:12 +00:00
2016-12-19 01:51:58 +00:00
## Enable SSL (https)
2018-05-01 01:15:17 +00:00
By default, the explorer does not use ssl. But it has such a functionality.
2016-12-19 01:51:58 +00:00
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
2018-05-01 01:15:17 +00:00
./xmrblocks --ssl-crt-file=/tmp/server.crt --ssl-key-file=/tmp/server.key
2016-12-19 01:51:58 +00:00
```
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
2018-05-01 01:15:17 +00:00
for any practical use need to have properly issued ssl certificates.
2016-05-28 02:06:35 +00:00
## JSON API
2017-01-14 01:20:56 +00:00
The explorer has JSON api. For the API, it uses conventions defined by [JSend](https://labs.omniti.com/labs/jsend).
2018-04-04 08:57:01 +00:00
By default the api is disabled. To enable it, use `--enable-json-api` flag, e.g.,
```
./xmrblocks --enable-json-api
```
2017-01-14 01:20:56 +00:00
#### api/transaction/<tx_hash>
2017-01-14 01:20:56 +00:00
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/transaction/6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d"
2017-01-14 01:20:56 +00:00
```
Partial results shown:
```json
{
"data": {
"block_height": 1268252,
"coinbase": false,
2021-03-27 11:41:31 +00:00
"confirmations": 1057855,
"current_height": 2326107,
"extra": "01be23e277aed6b5f41f66b05244bf994c13108347366ec678ae16657f0fc3a22b",
"inputs": [
{
"amount": 0,
"key_image": "67838fd0ffd79f13e735830d3ec60412aed59e53e1f997feb6f73d088b949611",
"mixins": [
{
"block_no": 1238623,
2021-03-27 11:41:31 +00:00
"public_key": "0a5b853c55303c10e1326acfb085b9e246e088b1ccac7e37f7a810d46a28a914",
"tx_hash": "686555fb053dd53f6f9eb79449e2bdcd377221f823f508158d70d4a1966fe955"
},
{
"block_no": 1246942,
2021-03-27 11:41:31 +00:00
"public_key": "527cf86f5abbfb006c970f7c6eb40493786d4751306f8985c6a43f98a88c0dff",
"tx_hash": "4fa1999f9e0d2ad031dbe5594f2e8336651b6cad19dd3cee7980a01c47600f91"
}
]
}
],
"mixin": 9,
"outputs": [
{
"amount": 0,
"public_key": "525779873776e4a42f517fd79b72e7c31c3ba03e730fc32287f6414fb702c1d7"
},
{
"amount": 0,
"public_key": "e25f00fceb77af841d780b68647618812695b4ca6ebe338faba6e077f758ac30"
}
],
"payment_id": "",
"payment_id8": "",
"rct_type": 1,
"timestamp": 1489753456,
"timestamp_utc": "2017-03-17 12:24:16",
"tx_fee": 12517785574,
"tx_hash": "6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d",
"tx_size": 13323,
"tx_version": 2,
"xmr_inputs": 0,
"xmr_outputs": 0
},
"status": "success"
}
2021-03-27 11:41:31 +00:00
```
#### api/transactions
Transactions in last 25 blocks
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/transactions"
```
Partial results shown:
```json
{
"data": {
"blocks": [
{
"age": "33:16:49:53",
"height": 1268252,
"size": 105390000000000000,
"timestamp": 1489753456,
"timestamp_utc": "2017-03-17 12:24:16",
"txs": [
{
"coinbase": true,
"mixin": 0,
"outputs": 8491554678365,
"rct_type": 0,
"tx_fee": 0,
"tx_hash": "7c4286f64544568265bb5418df84ae69afaa3567749210e46f8340c247f4803f",
"tx_size": 151000000000000,
"tx_version": 2
},
{
"coinbase": false,
"mixin": 5,
"outputs": 0,
"rct_type": 2,
"tx_fee": 17882516700,
"tx_hash": "2bfbccb918ee5f050808dd040ce03943b7315b81788e9cdee59cf86b557ba48c",
"tx_size": 19586000000000000,
"tx_version": 2
}
]
}
],
"limit": 25,
"page": 0
},
"status": "success"
}
```
#### api/transactions?page=<page_no>&limit=<tx_per_page>
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/transactions?page=2&limit=10"
```
Result analogical to the one above.
#### api/block/<block_number|block_hash>
2017-01-17 02:50:18 +00:00
```bash
curl -w "\n" -X GET "http://139.162.32.245:8081/api/block/1293257"
```
Partial results shown:
```json
{
"data": {
"block_height": 1293257,
"block_reward": 0,
"current_height": 1293264,
"hash": "9ef6bb8f9b8bd253fc6390e5c2cdc45c8ee99fad16447437108bf301fe6bd6e1",
"size": 141244,
"timestamp": 1492761974,
"timestamp_utc": "2017-04-21 08:06:14",
"txs": [
{
"coinbase": true,
"extra": "018ae9560eb85d5ebd22d3beaed55c21d469eab430c5e3cac61b3fe2f5ad156770020800000001a9030800",
"mixin": 0,
"payment_id": "",
"payment_id8": "",
"rct_type": 0,
"tx_fee": 0,
"tx_hash": "3ff71b65bec34c9261e01a856e6a03594cf0472acf6b77db3f17ebd18eaa30bf",
"tx_size": 95,
"tx_version": 2,
"xmr_inputs": 0,
"xmr_outputs": 8025365394426
}
]
},
"status": "success"
}
```
#### api/mempool
Return all txs in the mempool.
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/mempool"
```
Partial results shown:
```json
{
2017-05-11 02:52:43 +00:00
"data": {
"limit": 100000000,
"page": 0,
"total_page_no": 0,
"txs": [
{
"coinbase": false,
"extra": "022100325f677d96f94155a4840a84d8e0c905f7a4697a25744633bcb438feb1e51fb2012eda81bf552c53c2168f4130dbe0265c3a7898f3a7eee7c1fed955a778167b5d",
"mixin": 3,
"payment_id": "325f677d96f94155a4840a84d8e0c905f7a4697a25744633bcb438feb1e51fb2",
"payment_id8": "",
"rct_type": 2,
"timestamp": 1494470894,
"timestamp_utc": "2017-05-11 02:48:14",
"tx_fee": 15894840000,
"tx_hash": "9f3374f8ac67febaab153eab297937a3d0d2c706601e496bf5028146da0c9aef",
"tx_size": 13291,
"tx_version": 2,
"xmr_inputs": 0,
"xmr_outputs": 0
}
],
"txs_no": 7
},
"status": "success"
}
```
2017-05-11 02:52:43 +00:00
Limit of 100000000 is just default value above to ensure that all mempool txs are fetched
if no specific limit given.
#### api/mempool?limit=<no_of_top_txs>
Return number of newest mempool txs, e.g., only 10.
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/mempool?limit=10"
```
Result analogical to the one above.
#### api/search/<block_number|tx_hash|block_hash>
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/search/1293669"
```
2017-01-17 02:50:18 +00:00
Partial results shown:
```json
{
"data": {
"block_height": 1293669,
"current_height": 1293670,
"hash": "5d55b8fabf85b0b4c959d66ad509eb92ddfe5c2b0e84e1760abcb090195c1913",
"size": 118026,
"timestamp": 1492815321,
"timestamp_utc": "2017-04-21 22:55:21",
"title": "block",
"txs": [
{
"coinbase": true,
"extra": "01cb7fda09033a5fa06dc601b9295ef3790397cf3c645e958e34cf7ab699d2f5230208000000027f030200",
"mixin": 0,
"payment_id": "",
"payment_id8": "",
"rct_type": 0,
"tx_fee": 0,
"tx_hash": "479ba432f5c88736b438dd4446a11a13046a752d469f7828151f5c5b86be4e9a",
"tx_size": 95,
"tx_version": 2,
"xmr_inputs": 0,
"xmr_outputs": 7992697599717
}
]
},
"status": "success"
}
```
#### api/outputs?txhash=<tx_hash>&address=<address>&viewkey=<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,
2018-05-01 01:15:17 +00:00
i.e., `viewkey=<tx_private_key>`
Checking outputs:
```bash
# we use here official Monero project's donation address as an example
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/outputs?txhash=17049bc5f2d9fbca1ce8dae443bbbbed2fc02f1ee003ffdd0571996905faa831&address=44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A&viewkey=f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501&txprove=0"
```
```json
{
"data": {
"address": "42f18fc61586554095b0799b5c4b6f00cdeb26a93b20540d366932c6001617b75db35109fbba7d5f275fef4b9c49e0cc1c84b219ec6ff652fda54f89f7f63c88",
"outputs": [
{
"amount": 34980000000000,
"match": true,
"output_idx": 0,
"output_pubkey": "35d7200229e725c2bce0da3a2f20ef0720d242ecf88bfcb71eff2025c2501fdb"
},
{
"amount": 0,
"match": false,
"output_idx": 1,
"output_pubkey": "44efccab9f9b42e83c12da7988785d6c4eb3ec6e7aa2ae1234e2f0f7cb9ed6dd"
}
],
"tx_hash": "17049bc5f2d9fbca1ce8dae443bbbbed2fc02f1ee003ffdd0571996905faa831",
"tx_prove": false,
"viewkey": "f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501"
},
"status": "success"
}
```
Proving transfer:
We use recipient's address (i.e. not our address from which we sent xmr to recipient).
2018-05-01 01:15:17 +00:00
For the viewkey, we use `tx_private_key` (although the GET variable is still called `viewkey`) that we obtained by sending this txs.
```bash
2018-05-01 01:15:17 +00:00
# this is for testnet transaction
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8082/api/outputs?txhash=94782a8c0aa8d8768afa0c040ef0544b63eb5148ca971a024ac402cad313d3b3&address=9wUf8UcPUtb2huK7RphBw5PFCyKosKxqtGxbcKBDnzTCPrdNfJjLjtuht87zhTgsffCB21qmjxjj18Pw7cBnRctcKHrUB7N&viewkey=e94b5bfc599d2f741d6f07e3ab2a83f915e96fb374dfb2cd3dbe730e34ecb40b&txprove=1"
```
```json
{
"data": {
"address": "71bef5945b70bc0a31dbbe6cd0bd5884fe694bbfd18fff5f68f709438554fb88a51b1291e378e2f46a0155108782c242cc1be78af229242c36d4f4d1c4f72da2",
"outputs": [
{
"amount": 1000000000000,
"match": true,
"output_idx": 0,
"output_pubkey": "c1bf4dd020b5f0ab70bd672d2f9e800ea7b8ab108b080825c1d6cfc0b7f7ee00"
},
{
"amount": 0,
"match": false,
"output_idx": 1,
"output_pubkey": "8c61fae6ada2a103565dfdd307c7145b2479ddb1dab1eaadfa6c34db65d189d5"
}
],
"tx_hash": "94782a8c0aa8d8768afa0c040ef0544b63eb5148ca971a024ac402cad313d3b3",
"tx_prove": true,
"viewkey": "e94b5bfc599d2f741d6f07e3ab2a83f915e96fb374dfb2cd3dbe730e34ecb40b"
},
"status": "success"
}
```
2017-01-17 02:50:18 +00:00
2017-05-11 04:17:10 +00:00
Result analogical to the one above.
#### api/networkinfo
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/networkinfo"
2017-05-11 04:17:10 +00:00
```
```json
{
"data": {
"alt_blocks_count": 0,
"block_size_limit": 600000,
"cumulative_difficulty": 2091549555696348,
"difficulty": 7941560081,
"fee_per_kb": 303970000,
"grey_peerlist_size": 4991,
"hash_rate": 66179667,
"height": 1310423,
2017-05-11 04:17:10 +00:00
"incoming_connections_count": 0,
"outgoing_connections_count": 5,
"start_time": 1494822692,
2017-05-11 04:17:10 +00:00
"status": "OK",
"target": 120,
"target_height": 0,
2017-05-11 04:17:10 +00:00
"testnet": false,
"top_block_hash": "76f9e85d62415312758bc09e0b9b48fd2b005231ad1eee435a8081e551203f82",
"tx_count": 1219048,
"tx_pool_size": 2,
2017-05-11 04:17:10 +00:00
"white_peerlist_size": 1000
},
"status": "success"
}
```
#### api/outputsblocks
2018-05-01 01:15:17 +00:00
Search for our outputs in last few blocks (up to 5 blocks), using provided address and viewkey.
```bash
# testnet address
curl -w "\n" -X GET http://127.0.0.1:8081/api/outputsblocks?address=9sDyNU82ih1gdhDgrqHbEcfSDFASjFgxL9B9v5f1AytFUrYsVEj7bD9Pyx5Sw2qLk8HgGdFM8qj5DNecqGhm24Ce6QwEGDi&viewkey=807079280293998634d66e745562edaaca45c0a75c8290603578b54e9397e90a&limit=5&mempool=1
```
Example result:
```json
{
"data": {
"address": "0182d5be0f708cecf2b6f9889738bde5c930fad846d5b530e021afd1ae7e24a687ad50af3a5d38896655669079ad0163b4a369f6c852cc816dace5fc7792b72f",
"height": 960526,
"limit": "5",
"mempool": true,
"outputs": [
{
"amount": 33000000000000,
"block_no": 0,
"in_mempool": true,
"output_idx": 1,
"output_pubkey": "2417b24fc99b2cbd9459278b532b37f15eab6b09bbfc44f9d17e15cd25d5b44f",
"payment_id": "",
"tx_hash": "9233708004c51d15f44e86ac1a3b99582ed2bede4aaac6e2dd71424a9147b06f"
},
{
"amount": 2000000000000,
"block_no": 960525,
"in_mempool": false,
"output_idx": 0,
"output_pubkey": "9984101f5471dda461f091962f1f970b122d4469077aed6b978a910dc3ed4576",
"payment_id": "0000000000000055",
"tx_hash": "37825d0feb2e96cd10fa9ec0b990ac2e97d2648c0f23e4f7d68d2298996acefd"
},
{
"amount": 96947454120000,
"block_no": 960525,
"in_mempool": false,
"output_idx": 1,
"output_pubkey": "e4bded8e2a9ec4d41682a34d0a37596ec62742b28e74b897fcc00a47fcaa8629",
"payment_id": "0000000000000000000000000000000000000000000000000000000000001234",
"tx_hash": "4fad5f2bdb6dbd7efc2ce7efa3dd20edbd2a91640ce35e54c6887f0ee5a1a679"
}
],
"viewkey": "807079280293998634d66e745562edaaca45c0a75c8290603578b54e9397e90a"
},
"status": "success"
}
```
2017-05-20 02:31:52 +00:00
#### api/emission
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/emission"
2017-05-20 02:31:52 +00:00
```
```json
{
"data": {
"blk_no": 1313969,
"coinbase": 14489473877253413000,
"fee": 52601974988641130
},
"status": "success"
}
```
Emission only works when the emission monitoring thread is enabled.
#### api/version
```bash
2017-08-25 22:18:13 +00:00
curl -w "\n" -X GET "http://127.0.0.1:8081/api/version"
```
```json
{
"data": {
2018-05-01 01:15:17 +00:00
"api": 65536,
"blockchain_height": 1357031,
"git_branch_name": "update_to_current_monero",
"last_git_commit_date": "2017-07-25",
"last_git_commit_hash": "a549f25",
"monero_version_full": "0.10.3.1-ab594cfe"
},
"status": "success"
}
```
2018-05-01 01:15:17 +00:00
api number is store as `uint32_t`. In this case `65536` represents
2017-07-29 22:21:44 +00:00
major version 1 and minor version 0.
In JavaScript to get these numbers, one can do as follows:
```javascript
var api_major = response.data.api >> 16;
var api_minor = response.data.api & 0xffff;
```
2017-05-11 04:17:10 +00:00
#### api/rawblock/<block_number|block_hash>
Return raw json block data, as represented in Monero.
```bash
curl -w "\n" -X GET "http://139.162.32.245:8081/api/rawblock/1293257"
```
Example result not shown.
#### api/rawtransaction/<tx_hash>
Return raw json tx data, as represented in Monero.
```bash
curl -w "\n" -X GET "http://139.162.32.245:8081/api/rawtransaction/6093260dbe79fd6277694d14789dc8718f1bd54457df8bab338c2efa3bb0f03d"
```
Example result not shown.
2017-05-11 04:17:10 +00:00
## Other monero examples
2016-05-23 01:17:15 +00:00
2016-05-08 08:45:51 +00:00
Other examples can be found on [github](https://github.com/moneroexamples?tab=repositories).
Please know that some of the examples/repositories are not
finished and may not work as intended.
## How can you help?
Constructive criticism, code and website edits are always good. They can be made through github.