Skip to content

Commit

Permalink
Merge pull request #86 from moneroexamples/devel
Browse files Browse the repository at this point in the history
Add support for Monero 0.12.0, sub-addresses, JS decoding/proving txs and stagenet
  • Loading branch information
moneroexamples committed Apr 4, 2018
2 parents 7c6b418 + b4ea9f7 commit 53e50ed
Show file tree
Hide file tree
Showing 64 changed files with 12,866 additions and 6,190 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
*.log
*.orig
tests/
build/
cmake-build-debug/
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project(${PROJECT_NAME})
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++14")


if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3")
endif()
Expand Down Expand Up @@ -52,7 +53,8 @@ find_package(Boost COMPONENTS
date_time
REQUIRED)


#info https://github.com/arsenm/sanitizers-cmake
find_package(Sanitizers)

if(APPLE)
include_directories(/usr/local/opt/openssl/include)
Expand All @@ -68,6 +70,7 @@ endif()
# include boost headers
include_directories(${Boost_INCLUDE_DIRS})
include_directories("ext/mstch/include")
include_directories("ext/crow")

# add ext/ subfolder
add_subdirectory(ext/)
Expand All @@ -84,11 +87,14 @@ set(SOURCE_FILES
add_executable(${PROJECT_NAME}
${SOURCE_FILES})

add_sanitizers(${PROJECT_NAME})

create_git_version()

configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates ${CMAKE_CURRENT_BINARY_DIR}/templates)
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates/css ${CMAKE_CURRENT_BINARY_DIR}/templates/css)
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates/partials ${CMAKE_CURRENT_BINARY_DIR}/templates/partials)
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/src/templates/js ${CMAKE_CURRENT_BINARY_DIR}/templates/js)

set(LIBRARIES
myxrm
Expand All @@ -99,15 +105,20 @@ set(LIBRARIES
cryptonote_core
cryptonote_protocol
cryptonote_basic
multisig
daemonizer
cncrypto
blocks
lmdb
ringct
ringct_basic
device
common
mnemonics
epee
easylogging
checkpoints
version
epee
${Boost_LIBRARIES}
pthread
unbound
Expand All @@ -116,7 +127,7 @@ set(LIBRARIES
ssl)

if(APPLE)
set(LIBRARIES ${LIBRARIES} "-framework IOKit")
set(LIBRARIES ${LIBRARIES} "-framework IOKit -framework PCSC")
else()
set(LIBRARIES ${LIBRARIES} atomic)
endif()
Expand Down
71 changes: 50 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ special importance to privacy-oriented users:
- track users activates through google analytics,
- are closed sourced,
- are not available as hidden services,
- do not support Monero testnet,
- do not support Monero testnet nor stagenet networks,
- have limited JSON API.


Expand All @@ -29,23 +29,28 @@ Tor users:

Clearnet versions:

- [https://oculus.serveo.net/](https://oculus.serveo.net/) - bleeding edge version.
- [https://oculus.serveo.net/](https://oculus.serveo.net/) - bleeding edge version (down for now).
- [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://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.
- [https://moneroexplorer.pro/](https://moneroexplorer.pro/) - nice looking one, https enabled.
- [https://explorer.monero-otc.com/](https://explorer.monero-otc.com/) - https enabled.
- [http://monerochain.com/](http://monerochain.com/) - JSON API based, multiple nodes.
- [http://atesti.mooo.com:8081/](http://atesti.mooo.com:8081/) - Proof of Existence built with Monero and IPFS.
- [https://anunknownamount.com](https://anunknownamount.com/) - looks nice, https enabled.
- [http://atesti.mooo.com:8081/](http://atesti.mooo.com:8081/) - Proof of Existence built with Monero and IPFS (down currently).
- [https://anunknownamount.com](https://anunknownamount.com/) - looks nice, https enabled (down currently).

Clearnet testnet Monero version:

- [https://retineo.serveo.net](https://retineo.serveo.net) - bleeding edge version (v8).
- [http://nimis.serveo.net/](http://nimis.serveo.net/) - bleeding edge version (down currently).

- [https://testnet.xmrchain.com/](https://testnet.xmrchain.com/) - https enabled.
- [https://explorer.monero-otc.com/](https://explorer.monero-otc.com/) - https enabled.
- [https://testnet.MoneroExplorer.com/](https://testnet.moneroexplorer.com/) - https enabled.
- [https://testnet.MoneroExplorer.com/](https://testnet.moneroexplorer.com/) - https enabled (down currently).

Clearnet stagenet Monero version:

- [http://162.210.173.150:8083/](http://162.210.173.150:8083/) - recent version.

i2p users (main Monero network):

Expand All @@ -62,7 +67,8 @@ Alternative block explorers:

The key features of the Onion Monero Blockchain Explorer are:

- no javascript, no cookies, no web analytics trackers, no images,
- 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,
Expand All @@ -71,14 +77,14 @@ The key features of the Onion Monero Blockchain Explorer are:
- 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 mixins, such as, mixins'
age, timescale, mixin of mixins,
- detailed information about mixins, such as, mixins' age, timescale, mixin of mixins,
- showing number of amount output indices,
- support Monero testnet network,
- 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.


## Development branch
Expand All @@ -91,25 +97,25 @@ Current development branch, which includes support for sub-addresses is:

## Compilation on Ubuntu 16.04

##### Compile latest Monero release v0.11
##### Compile latest Monero development version

Download and compile recent Monero into your home folder:

```bash
# first install monero dependecines
sudo apt update

sudo apt install git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev libreadline-dev libzmq3-dev
sudo apt install git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev libreadline-dev libzmq3-dev libsodium-dev

# go to home folder
cd ~

git clone https://github.com/monero-project/monero
git clone --recursive https://github.com/monero-project/monero

cd monero/

# checkout last monero version
git checkout -b last_release v0.11.1.0
#git checkout -b last_release v0.12.0.0

make
```
Expand Down Expand Up @@ -137,6 +143,9 @@ cmake ..

# altearnatively can use: cmake -DMONERO_DIR=/path/to/monero_folder ..
# if monero is not in ~/monero
#
# also can build with ASAN (sanitizers), for example
# cmake -DSANITIZE_ADDRESS=On ..

# compile
make
Expand Down Expand Up @@ -170,6 +179,7 @@ Go to your browser: http://127.0.0.1:8081
xmrblocks, Onion Monero 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,
Expand All @@ -179,11 +189,13 @@ xmrblocks, Onion Monero Blockchain Explorer:
enable key images file checker
--enable-output-key-checker [=arg(=1)] (=0)
enable outputs key file checker
--enable-json-api arg (=1) enable JSON REST api
--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
Expand All @@ -192,11 +204,14 @@ xmrblocks, Onion Monero Blockchain Explorer:
thread
-p [ --port ] arg (=8081) default explorer port
--testnet-url arg you can specify testnet url, if you run
it on mainnet. link will show on front
page to testnet explorer
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. link will show on front
page to mainnet explorer
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
Expand Down Expand Up @@ -239,14 +254,14 @@ 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 `~/.bitmonero/lmdb/emission_amount.txt`. For testnet network,
it is `~/.bitmonero/testnet/lmdb/emission_amount.txt`. This file is used so that we don't
in `~/.bitmonero/lmdb/emission_amount.txt`. For testnet or stagenet networks,
it is `~/.bitmonero/testnet/lmdb/emission_amount.txt` or `~/.bitmonero/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 `~/.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
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 and testnet. Thus, for example, you cant have
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
Expand All @@ -263,6 +278,15 @@ The values given, can be checked using Monero daemon's `print_coinbase_tx_sum`
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.

## 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)

Expand Down Expand Up @@ -290,6 +314,11 @@ for any practical use need to have properly issued ssl certificates.
## 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/<tx_hash>

Expand Down
59 changes: 59 additions & 0 deletions cmake/FindASan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)

set(FLAG_CANDIDATES
# Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
"-g -fsanitize=address -fno-omit-frame-pointer"
"-g -fsanitize=address"

# Older deprecated flag for ASan
"-g -faddress-sanitizer"
)


if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
message(FATAL_ERROR "AddressSanitizer is not compatible with "
"ThreadSanitizer or MemorySanitizer.")
endif ()


include(sanitize-helpers)

if (SANITIZE_ADDRESS)
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer"
"ASan")

find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
mark_as_advanced(ASan_WRAPPER)
endif ()

function (add_sanitize_address TARGET)
if (NOT SANITIZE_ADDRESS)
return()
endif ()

sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
endfunction ()
57 changes: 57 additions & 0 deletions cmake/FindMSan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)

set(FLAG_CANDIDATES
"-g -fsanitize=memory"
)


include(sanitize-helpers)

if (SANITIZE_MEMORY)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
"MemorySanitizer is supported for Linux systems only.")
set(SANITIZE_MEMORY Off CACHE BOOL
"Enable MemorySanitizer for sanitized targets." FORCE)
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
"MemorySanitizer is supported for 64bit systems only.")
set(SANITIZE_MEMORY Off CACHE BOOL
"Enable MemorySanitizer for sanitized targets." FORCE)
else ()
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
"MSan")
endif ()
endif ()

function (add_sanitize_memory TARGET)
if (NOT SANITIZE_MEMORY)
return()
endif ()

sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
endfunction ()

0 comments on commit 53e50ed

Please sign in to comment.