|
|
|
# OpenMonero - a fully open sourced implementation of MyMonero backend
|
|
|
|
|
|
|
|
In this example [restbed](https://github.com/Corvusoft/restbed/) is used to
|
|
|
|
demonstrate how to provide Monero related JSON REST service. For this purpose,
|
|
|
|
a service called Open Monero was developed.
|
|
|
|
|
|
|
|
|
|
|
|
OpenMonero is an open source implementation of backend of
|
|
|
|
https://mymonero.com/. The frontend, which includes HTML, CSS, JavaScript, was adapted
|
|
|
|
from (and originally developed by) https://mymonero.com/.
|
|
|
|
|
|
|
|
Open Monero's backend is open sourced, free
|
|
|
|
to use, host and modify. Additionally, some features were added/changed as compared
|
|
|
|
to MyMonero. They include:
|
|
|
|
|
|
|
|
- google analytics, cloudflare, images and flash were removed.
|
|
|
|
- frontend's html and javascript upgrades and cleanups.
|
|
|
|
- transaction service fee was set to zero (same as in MyMonero).
|
|
|
|
- the wallets generated use 25 word mnemonics, fully compatible with official monero wallets
|
|
|
|
(13 word mnemonics generated by MyMonero work as usual though).
|
|
|
|
- import wallet fee was reduced (can be set to 0).
|
|
|
|
- added support of testnet and stagenet networks, and mainnet without relying transactions
|
|
|
|
- improved handling of mempool, coinbase, locked and unlocked transactions.
|
|
|
|
- view only mode added.
|
|
|
|
- Cross-Origin Resource Sharing (CORS) disabled.
|
|
|
|
- ability to select transaction priority.
|
|
|
|
- legacy address + payment_id system replaced with integrated addresses for better privacy.
|
|
|
|
- free, time based imports of recent transactions added.
|
|
|
|
|
|
|
|
## Live stagenet version
|
|
|
|
|
|
|
|
- [http://139.162.60.17:81](http://139.162.60.17:81)
|
|
|
|
- [http://139.162.60.17:8100](http://139.162.60.17:8100) - MyMonero frontend
|
|
|
|
|
|
|
|
This is OpenMonero running on stagnet network. You can use it to play around with it.
|
|
|
|
Please note that the live version is running on cheap VPS, which may result in
|
|
|
|
performance issues.
|
|
|
|
|
|
|
|
|
|
|
|
## Current development version
|
|
|
|
|
|
|
|
All current changes, bug fixes and updates are done in the
|
|
|
|
[branch](https://github.com/moneroexamples/openmonero/tree/devel).
|
|
|
|
|
|
|
|
|
|
|
|
## Screenshot
|
|
|
|
|
|
|
|
![Open Monero](https://raw.githubusercontent.com/moneroexamples/openmonero/master/screenshot/screen1.png)
|
|
|
|
|
|
|
|
|
|
|
|
## Host it yourself
|
|
|
|
|
|
|
|
The Open Monero consists of four components that need to be setup for it to work:
|
|
|
|
|
|
|
|
- MySql/Mariadb database - it stores user address (viewkey is not stored!),
|
|
|
|
associated transactions, outputs, inputs and transaction import payments information.
|
|
|
|
- Frontend - it is virtually same as that of MyMonero, except before mentioned differences.
|
|
|
|
It consists of HTML, CSS, and JavaScript.
|
|
|
|
- Monero daemon - daemon must be running and fully sync, as this is
|
|
|
|
where all transaction data is fetched from and used. Daemon also commits txs
|
|
|
|
from the Open Monero into the Monero network.
|
|
|
|
- Backend - fully written in C++. It uses [restbed](https://github.com/Corvusoft/restbed/) to serve JSON REST to the frontend
|
|
|
|
and [mysql++](http://www.tangentsoft.net/mysql++/) to interface the database. It also accesses Monero blockchain and "talks"
|
|
|
|
with Monero deamon.
|
|
|
|
|
|
|
|
|
|
|
|
## Limitations
|
|
|
|
|
|
|
|
#### Performance
|
|
|
|
|
|
|
|
Open Monero is not as fast as MyMonero.
|
|
|
|
This is because it is basic, easy to understand and
|
|
|
|
straight forward implementation of the backend. Thus,
|
|
|
|
it does not use any special memory buffers/caches for transactions,
|
|
|
|
blocks, complex database structures and SQL queries. Also, no ongoing monitoring of user's
|
|
|
|
transactions is happening, since user's viewkey is not stored (only its hash). Transaction search threads start when
|
|
|
|
user logs in (viewkey and address are submitted to the search thread), and finish shorty
|
|
|
|
after logout. Once the search threads stop, they can't be restarted without user logging
|
|
|
|
in back, because viewkey is unknown.
|
|
|
|
|
|
|
|
|
|
|
|
## Example compilation on Ubuntu 18.04
|
|
|
|
|
|
|
|
Below are example and basic instructions on how to setup up and run Open Monero on Ubuntu 16.04.
|
|
|
|
For other Linux operating systems, the instructions are analogical.
|
|
|
|
|
|
|
|
|
|
|
|
#### Monero download and compilation
|
|
|
|
|
|
|
|
To download and compile recent Monero follow instructions
|
|
|
|
in the following link:
|
|
|
|
|
|
|
|
https://github.com/moneroexamples/monero-compilation/blob/master/README.md
|
|
|
|
|
|
|
|
#### Compilation of the OpenMonero (don't run it yet)
|
|
|
|
|
|
|
|
Once Monero was downloaded and compiled, we can download Open Monero and compile it.
|
|
|
|
In fact we could postpone compilation to later, but
|
|
|
|
we can just do it now, to see if it compiles. But don't run it yet. It will not
|
|
|
|
work without database, setup frontend, and synced and running monero blockchain.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# need mysql++ library
|
|
|
|
sudo apt install libmysql++-dev
|
|
|
|
|
|
|
|
|
|
|
|
# go to home folder if still in ~/monero
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
# download the source code of the devel branch
|
|
|
|
git clone --recursive https://github.com/moneroexamples/openmonero.git
|
|
|
|
|
|
|
|
cd openmonero
|
|
|
|
|
|
|
|
mkdir build && cd build
|
|
|
|
|
|
|
|
cmake ..
|
|
|
|
|
|
|
|
# altearnatively can use cmake -DMONERO_DIR=/path/to/monero_folder ..
|
|
|
|
# if monero is not in ~/monero
|
|
|
|
|
|
|
|
make
|
|
|
|
```
|
|
|
|
|
|
|
|
#### MariaDB/MySQL (using docker)
|
|
|
|
|
|
|
|
The easiest way to setup MariaDB is through [docker](https://hub.docker.com/_/mariadb/) (assuming that you have docker setup and running)
|
|
|
|
|
|
|
|
Create mariadb container called `ommariadb` and root password of `root` (change these how you want).
|
|
|
|
|
|
|
|
```
|
|
|
|
docker run --name ommariadb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mariadb
|
|
|
|
```
|
|
|
|
|
|
|
|
Create openmonero database called `openmonero`.
|
|
|
|
|
|
|
|
```
|
|
|
|
cd openmonero/sql
|
|
|
|
docker exec -i ommariadb mysql -uroot -proot < openmonero.sql
|
|
|
|
```
|
|
|
|
|
|
|
|
#### PhpMyAdmin (using docker)
|
|
|
|
A good way to manage/view the openmonero database is through the
|
|
|
|
[PhpMyAdmin in docker](https://hub.docker.com/r/phpmyadmin/phpmyadmin/). Using docker,
|
|
|
|
this can be done:
|
|
|
|
|
|
|
|
```
|
|
|
|
docker run --name myadmin -d --link ommariadb:db -p 8080:80 phpmyadmin/phpmyadmin
|
|
|
|
```
|
|
|
|
|
|
|
|
where `ommariadb` is the name of docker container with mariadb, set in previous step.
|
|
|
|
|
|
|
|
With this, phpmyadmin should be avaliable at http://127.0.0.1:8080.
|
|
|
|
|
|
|
|
|
|
|
|
#### Nginx (using docker)
|
|
|
|
|
|
|
|
The fastest way to start up and server the frontend is through
|
|
|
|
[nginx docker image](https://hub.docker.com/_/nginx/).
|
|
|
|
|
|
|
|
```
|
|
|
|
docker run --name omhtml -p 80:80 -v /home/mwo/openmonero/html:/usr/share/nginx/html:ro -d nginx
|
|
|
|
```
|
|
|
|
|
|
|
|
where `omhtml` is docker container name, `80:80` will expose the frontend
|
|
|
|
on port 80 of the localhost, and `/home/mwo/openmonero/html` is the location on your host computer where the
|
|
|
|
frontend files are stored. All these can be changed to suit your requirements.
|
|
|
|
|
|
|
|
Go to localhost (http://127.0.0.1) and check if frontend is working.
|
|
|
|
|
|
|
|
#### mymonero-core-js (optional)
|
|
|
|
|
|
|
|
OpenMonero uses frontend code provided by mymonero.com. Among many files
|
|
|
|
used, the two crtical ones are binary webassamply
|
|
|
|
[MyMoneroCoreCpp_WASM.wasm](https://mymonero.com/js/lib/mymonero_core_js/monero_utils/MyMoneroCoreCpp_WASM.wasm) and
|
|
|
|
the corresponding JavaScript [mymonero-core.js](https://mymonero.com/js/lib/mymonero-core.js) files.
|
|
|
|
They are used by [send_coins.js](https://mymonero.com/js/controllers/send_coins.js?) for providing
|
|
|
|
transaction generation functionality.
|
|
|
|
|
|
|
|
OpenMonero provides these files here: `./html/js/lib`. They were generated using forked `mymonero-core-js` repo:
|
|
|
|
https://github.com/moneroexamples/mymonero-core-js/tree/openmonero
|
|
|
|
|
|
|
|
However, you can compile them yourself using the orginal repository located at
|
|
|
|
https://github.com/mymonero/mymonero-core-js.
|
|
|
|
|
|
|
|
Below are instructions on how it can be done on Arch Linux.
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://github.com/mymonero/mymonero-core-js.git
|
|
|
|
|
|
|
|
cd mymonero-core-js/
|
|
|
|
|
|
|
|
./bin/update_submodules
|
|
|
|
|
|
|
|
npm install
|
|
|
|
|
|
|
|
# download boost
|
|
|
|
wget -c "https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz" -O /tmp/boost.tar.gz && mkdir -p ./contrib && tar xzvf /tmp/boost.tar.gz -C ./contrib && mv ./contrib/boost_1_68_0/ ./contrib/boost-sdk
|
|
|
|
|
|
|
|
# set EMSCRIPTEN paths (for this, you need to have EMSCRIPTEN setup, e.g. in your home folder)
|
|
|
|
# http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
|
|
|
|
source ~/emsdk/emsdk_env.sh
|
|
|
|
|
|
|
|
# compile boost
|
|
|
|
./bin/build-boost-emscripten.sh
|
|
|
|
|
|
|
|
# compile mymonero-core-js
|
|
|
|
./bin/build-emcpp.sh
|
|
|
|
|
|
|
|
# generate mymonero-core.js and MyMoneroCoreCpp_WASM.wasm
|
|
|
|
./bin/package_browser_js
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
The above instructions should produce `mymonero-core.js`
|
|
|
|
and `mymonero_core_js/monero_utils/MyMoneroCoreCpp_WASM.wasm`
|
|
|
|
(both located in `./build` folder), which can
|
|
|
|
be used in place the files bundled with OpenMonero.
|
|
|
|
|
|
|
|
|
|
|
|
#### Run OpenMonero
|
|
|
|
|
|
|
|
Command line options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
./openmonero -h
|
|
|
|
openmonero, Open Monero backend service:
|
|
|
|
-h [ --help ] [=arg(=1)] (=0) produce help message
|
|
|
|
-t [ --testnet ] [=arg(=1)] (=0) use testnet blockchain
|
|
|
|
-s [ --stagenet ] [=arg(=1)] (=0) use stagenet blockchain
|
|
|
|
--do-not-relay [=arg(=1)] (=0) does not relay txs to other nodes.
|
|
|
|
useful when testing construction and
|
|
|
|
submiting txs
|
|
|
|
-p [ --port ] arg (=1984) default port for restbed service of
|
|
|
|
Open Monero
|
|
|
|
-c [ --config-file ] arg (=./config/config.json)
|
|
|
|
Config file path.
|
|
|
|
-m [ --monero-log-level ] arg (=1) Monero log level 1-4, default is 1.
|
|
|
|
-l [ --log-file ] arg (=./openmonero.log)
|
|
|
|
Name and path to log file. -l "" to
|
|
|
|
disable log file.
|
|
|
|
```
|
|
|
|
|
|
|
|
Other backend options are in `confing/config.json`.
|
|
|
|
|
|
|
|
Before running `openmonero`:
|
|
|
|
|
|
|
|
- edit `config/config.js` file with your settings. Especially set `frontend-url` and `database`
|
|
|
|
connection details.
|
|
|
|
- set `apiUrl` in `html\js\config.js` and `nettype` option. Last slash `/` in `apiUrl` is important.
|
|
|
|
If running backend for testnet or stagenet networks, frontend `nettype` must be set to
|
|
|
|
1 - TESTNET or 2 - STAGENET. 0 is for MAINNET.
|
|
|
|
- make sure monero daemon is running and fully sync. If using testnet or stagenet networks, use monero daemon
|
|
|
|
with `--testnet` or `--stagenet` flags!
|
|
|
|
|
|
|
|
|
|
|
|
To start for mainnet:
|
|
|
|
```bash
|
|
|
|
./openmonero
|
|
|
|
```
|
|
|
|
|
|
|
|
To start for testnet:
|
|
|
|
```bash
|
|
|
|
./openmonero -t
|
|
|
|
```
|
|
|
|
|
|
|
|
To start for stagenet:
|
|
|
|
```bash
|
|
|
|
./openmonero -s
|
|
|
|
```
|
|
|
|
|
|
|
|
To start for stagenet with non-default location of `config.json` file:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
./openmonero -s -c /path/to/config.json
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## OpenMonero JSON REST API
|
|
|
|
|
|
|
|
Example JSON REST requests and their responses of [OpenMonero](https://github.com/moneroexamples/openmonero) are provided below. The long term goal
|
|
|
|
is to make the api conform to [jsent](https://labs.omniti.com/labs/jsend)
|
|
|
|
specification which describs successful, failed and error responses. At present,
|
|
|
|
the OpenMonero api does not fully conform to that.
|
|
|
|
|
|
|
|
#### get_version
|
|
|
|
|
|
|
|
Get version of the OpenMonero, its API and monero.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/get_version
|
|
|
|
```
|
|
|
|
Example output:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"api": 65536,
|
|
|
|
"blockchain_height": 965507,
|
|
|
|
"git_branch_name": "upgrade_angularjs",
|
|
|
|
"last_git_commit_date": "2017-07-25",
|
|
|
|
"last_git_commit_hash": "456f9d6",
|
|
|
|
"monero_version_full": "0.10.3.1-125f823"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
`api` number is represented as `uint32_t`. In this case, `65536` represents
|
|
|
|
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;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### login
|
|
|
|
|
|
|
|
Login an existing or a new user into OpenMonero.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/login -d '{"address": "A2VTvE8bC9APsWFn3mQzgW8Xfcy2SP2CRUArD6ZtthNaWDuuvyhtBcZ8WDuYMRt1HhcnNQvpXVUavEiZ9waTbyBhP6RM8TV", "view_key": "041a241325326f9d86519b714a9b7f78b29111551757eeb6334d39c21f8b7400", "create_account": true, "generated_locally": true}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Example output:
|
|
|
|
```json
|
|
|
|
{"generated_locally":false,"new_address":true,"start_height":0,"status":"success"}
|
|
|
|
```
|
|
|
|
|
|
|
|
### ping
|
|
|
|
|
|
|
|
Pings a search thread for a given account to extend its life.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/ping -d '{"address": "A2VTvE8bC9APsWFn3mQzgW8Xfcy2SP2CRUArD6ZtthNaWDuuvyhtBcZ8WDuYMRt1HhcnNQvpXVUavEiZ9waTbyBhP6RM8TV", "view_key": "041a241325326f9d86519b714a9b7f78b29111551757eeb6334d39c21f8b7400"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Example output:
|
|
|
|
```json
|
|
|
|
{"generated_locally":false,"new_address":true,"start_height":0,"status":"success"}
|
|
|
|
```
|
|
|
|
#### get_address_txs
|
|
|
|
|
|
|
|
Get the list of all txs for the given user with their possible spendings.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/get_address_txs -d '{"address": "A2VTvE8bC9APsWFn3mQzgW8Xfcy2SP2CRUArD6ZtthNaWDuuvyhtBcZ8WDuYMRt1HhcnNQvpXVUavEiZ9waTbyBhP6RM8TV", "view_key": "041a241325326f9d86519b714a9b7f78b29111551757eeb6334d39c21f8b7400"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Output (only part shown):
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"blockchain_height": 965512,
|
|
|
|
"new_address": false,
|
|
|
|
"scanned_block_height": 961405,
|
|
|
|
"scanned_block_timestamp": 1500969813,
|
|
|
|
"scanned_height": 0,
|
|
|
|
"start_height": 957190,
|
|
|
|
"status": "success",
|
|
|
|
"total_received": 32594830001895764,
|
|
|
|
"total_received_unlocked": 32594830001895764,
|
|
|
|
"transactions": [
|
|
|
|
{
|
|
|
|
"coinbase": false,
|
|
|
|
"hash": "2877c449a7a9f0a507c7a6e4ae17b43d96dc44369092e57adc4e6d9ddcde1a68",
|
|
|
|
"height": 812669,
|
|
|
|
"id": 831631,
|
|
|
|
"mempool": false,
|
|
|
|
"mixin": 4,
|
|
|
|
"payment_id": "",
|
|
|
|
"spent_outputs": [
|
|
|
|
{
|
|
|
|
"amount": 13659082425875,
|
|
|
|
"key_image": "0b6a04e1a1d7f149a8e8aeb91047b8ab4722de50554b88af4ed7646fd1929947",
|
|
|
|
"mixin": 0,
|
|
|
|
"out_index": 0,
|
|
|
|
"tx_pub_key": ""
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"timestamp": 1482567670,
|
|
|
|
"total_received": 0,
|
|
|
|
"total_sent": 13659082425875,
|
|
|
|
"tx_pub_key": "41bd5cb51aa26fb58d41acd25711a7ecc2d19be0c24b296a9e362aebee61d4d0",
|
|
|
|
"unlock_time": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"coinbase": true,
|
|
|
|
"hash": "1f76938b4deceb9e0722f02f4477006d3e96e2331552f726c47f297977434b9c",
|
|
|
|
"height": 818908,
|
|
|
|
"id": 838719,
|
|
|
|
"mempool": false,
|
|
|
|
"mixin": 0,
|
|
|
|
"payment_id": "",
|
|
|
|
"timestamp": 1483311688,
|
|
|
|
"total_received": 13388479628538,
|
|
|
|
"total_sent": 0,
|
|
|
|
"tx_pub_key": "3c71217add3b7882e8370fe6b903bc48059a79580af5e095485afc88b3126d09",
|
|
|
|
"unlock_time": 818968
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"coinbase": false,
|
|
|
|
"hash": "53cb70ded276fbfcc68c98a8d9577b42c543bf1094d6cbb151fa05c9edb457be",
|
|
|
|
"height": 818921,
|
|
|
|
"id": 838735,
|
|
|
|
"mempool": false,
|
|
|
|
"mixin": 5,
|
|
|
|
"payment_id": "",
|
|
|
|
"spent_outputs": [
|
|
|
|
{
|
|
|
|
"amount": 13683584012406,
|
|
|
|
"key_image": "437518836c315bf989c5cc28b935280345ed672d727122f6d6c5c5ff32e98224",
|
|
|
|
"mixin": 0,
|
|
|
|
"out_index": 0,
|
|
|
|
"tx_pub_key": ""
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"timestamp": 1483313063,
|
|
|
|
"total_received": 12648774828503,
|
|
|
|
"total_sent": 13683584012406,
|
|
|
|
"tx_pub_key": "3eac7a5ce7dc0cc78172522cef4591a43b0e9aab643ac3b57554fd0dbc8ba86a",
|
|
|
|
"unlock_time": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### get_address_info
|
|
|
|
|
|
|
|
Get the list of all possible spendings. Used when calcualted the wallet balance.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/get_address_info -d '{"address": "A2VTvE8bC9APsWFn3mQzgW8Xfcy2SP2CRUArD6ZtthNaWDuuvyhtBcZ8WDuYMRt1HhcnNQvpXVUavEiZ9waTbyBhP6RM8TV", "view_key": "041a241325326f9d86519b714a9b7f78b29111551757eeb6334d39c21f8b7400"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Output (only part shown):
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"blockchain_height": 965513,
|
|
|
|
"locked_funds": 0,
|
|
|
|
"new_address": false,
|
|
|
|
"scanned_block_height": 965513,
|
|
|
|
"scanned_block_timestamp": 1501466493,
|
|
|
|
"scanned_height": 0,
|
|
|
|
"spent_outputs": [
|
|
|
|
{
|
|
|
|
"amount": 13683584012406,
|
|
|
|
"key_image": "437518836c315bf989c5cc28b935280345ed672d727122f6d6c5c5ff32e98224",
|
|
|
|
"mixin": 0,
|
|
|
|
"out_index": 0,
|
|
|
|
"tx_pub_key": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"amount": 13683584012406,
|
|
|
|
"key_image": "ac3088ce17cc608bcf86db65e9061fe4b9b02573b997944e4ebf7d8e64e4a3b4",
|
|
|
|
"mixin": 0,
|
|
|
|
"out_index": 0,
|
|
|
|
"tx_pub_key": ""
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"start_height": 855633,
|
|
|
|
"total_received": 13481878608141995,
|
|
|
|
"total_sent": 4699871131811773
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
#### get_tx
|
|
|
|
|
|
|
|
Get details of a single tx.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/get_tx -d '{"tx_hash": "bfbfbb3bfa169731a092891795be1c3c923a018882ac0efc0ed3e79e2d2b2e54"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Output (only part shown):
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"coinbase": false,
|
|
|
|
"error": "",
|
|
|
|
"fee": 22893920000,
|
|
|
|
"mixin_no": 11,
|
|
|
|
"no_confirmations": 2898,
|
|
|
|
"pub_key": "b753c863c64565ae81630bfdbf497f06955b6ce041f656565809d04be6ef9343",
|
|
|
|
"size": 13461,
|
|
|
|
"status": "OK",
|
|
|
|
"tx_hash": "bfbfbb3bfa169731a092891795be1c3c923a018882ac0efc0ed3e79e2d2b2e54",
|
|
|
|
"tx_height": 960491,
|
|
|
|
"xmr_inputs": 0,
|
|
|
|
"xmr_outputs": 0
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### get_unspent_outs
|
|
|
|
|
|
|
|
Get the list of all outputs with key images which could mean that the outouts
|
|
|
|
had already been spent. Thus they can't be used again. It is a job of the frontend
|
|
|
|
to filter out spent outputs based on the key images provided.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/get_unspent_outs -d '{"address": "A2VTvE8bC9APsWFn3mQzgW8Xfcy2SP2CRUArD6ZtthNaWDuuvyhtBcZ8WDuYMRt1HhcnNQvpXVUavEiZ9waTbyBhP6RM8TV", "view_key": "041a241325326f9d86519b714a9b7f78b29111551757eeb6334d39c21f8b7400","amount":"0","mixin":4,"use_dust":false,"dust_threshold":"1000000000"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Output (only part shown):
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"amount": 2746682935584926,
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"amount": 2450000000000,
|
|
|
|
"global_index": 86136,
|
|
|
|
"height": 839599,
|
|
|
|
"index": 0,
|
|
|
|
"public_key": "6f6a4023bfa407ca1ce37f7382d5ea7540a330575bd570094b5add5e8ded2dd9",
|
|
|
|
"rct": "4aca9e9b9a5d63fcf409ac28191696cabb78c0ba14791152509ebe6db7f9311033a1dc75d69a1dad7523f65856d07487aad2bee2098f5566b6d92ec5a5c68f00653d241a9d7f16ff13df87825609e8b2353ec20e50d11f8133d234184d9f8b03",
|
|
|
|
"spend_key_images": [
|
|
|
|
"2818dae0940fb945185c562fcb0a496f3c3b551f33b7ddd7ec1b5ecd856166e6"
|
|
|
|
],
|
|
|
|
"timestamp": "2017-02-01 05:53:28",
|
|
|
|
"tx_hash": "9d17084091beedc55c8a0cd342e441b7c0d89eeca25ac151b4b91fe1e12051e7",
|
|
|
|
"tx_id": 2117,
|
|
|
|
"tx_prefix_hash": "849f11f6b012c1557f87692ca7a67bcb24a5a553078c4faed870b8982821feee",
|
|
|
|
"tx_pub_key": "4219b1004fa64bde0213bf3c59b9e160af8603be03d79e13148c15fd598e3a0e"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"amount": 10000000000,
|
|
|
|
"global_index": 86550,
|
|
|
|
"height": 840011,
|
|
|
|
"index": 0,
|
|
|
|
"public_key": "5506e8786b7634a77487f0938a00d3de6ab005e2f76ffee05fee68d5165382f1",
|
|
|
|
"rct": "6f78720d6bb0287d78c50bfa41332232fbc4bc9b7f04e35681ff926cc156b1fbfb3b84a2dcdc8cb98b33be70b302e380944abc3e7a7cbf3e27614936eccca40203447622e149ba1e09a7062eb8910acf029f561ecdaa5a34e076baff5d63770e",
|
|
|
|
"spend_key_images": [
|
|
|
|
"9c82226bdf165fd2424d9a0ead661682bfab2fe644cd0bcef575ae16595c550c"
|
|
|
|
],
|
|
|
|
"timestamp": "2017-02-02 03:18:18",
|
|
|
|
"tx_hash": "8257367ca6def69dc3d280e8909c3cd01b230fc9922c9a89217db06f3fb41102",
|
|
|
|
"tx_id": 2118,
|
|
|
|
"tx_prefix_hash": "781a0ce699865987ec78ad331e8e89c0d14461f9881dd11a7a4541114b567568",
|
|
|
|
"tx_pub_key": "29ceefd594b856c7c06d2423be17cd674b97d1d8f72907ace8d27f5b6aa9875c"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"per_kb_fee": 2480631964
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### get_random_outs
|
|
|
|
|
|
|
|
Get random outputs from the monero daemon to be used as ring members
|
|
|
|
when making a tx in the frontend.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/get_random_outs -d '{"amounts":["0","0"],"count":5}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Output (only part shown):
|
|
|
|
|
|
|
|
```json
|
|
|
|
"amount_outs": [
|
|
|
|
{
|
|
|
|
"amount": 0,
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"global_index": 48449,
|
|
|
|
"public_key": "637dbadf193fa9fd5c50c96af18f458a9b7d4844fdf7ffdfa3f62d51d6aff835",
|
|
|
|
"rct": "0c908e1969edfe7824560104e44334b46ced17c9462eacb5aaa70e62ea34a394837c07d14bffc5a65e2dd14da395dd135bcc2e5ac70648782d76e4a9920cd007b9ffe319b796c555fb7713a270f21181a5ee5c8b01259becba0dd332b93a6c02"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"global_index": 67558,
|
|
|
|
"public_key": "6ca3a73512dadd669430f73809c949f3edf71728bea5201441c648c2d128c453",
|
|
|
|
"rct": "999312ca1914895cf8a517c91a54a069d8fdc7205d7768173618e77fad2fde5c725604d666b101c9ae19c72e07cf5f821603a7b63efb5dfd8a7c0e36ed0c250fa92929cda49ddd0d34e664e15634ee59e958815764ec979b5ff0a72b3af6af0a"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"global_index": 102186,
|
|
|
|
"public_key": "c29d43f5d7c71a6f1b4f3286da3c296a083cf68728d85c268ee0c964a6c8c00e",
|
|
|
|
"rct": "23aa82efdbd0c6878060496a13f7a707a6f45649b51de12d54d0cad14c5be5bd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"global_index": 96992,
|
|
|
|
"public_key": "fb83d74a42abe65d5b8a6a906791202376b91e3459a31737ac62a401b7b9356c",
|
|
|
|
"rct": "975b42f50cabb801091c90a4227bf7ba024ddacfeda7e5e0383f034b0bc8ba2500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"global_index": 36848,
|
|
|
|
"public_key": "2a8785e42a9446785cf189a40fca8f56a592dab9db1f38f8e8a3d2eb84b680ff",
|
|
|
|
"rct": "a09e27b83917792bc8f6c51b40077aea329bf08b569e63657e2ac3529db5d0aa14f9f9fc45930577b43829119847ac857d69c00d12859a903cfcbf470819dc00b1bfa43aa979e46a0d0476cb36717e8d8374afe9af1fb3715091147cc9587e0e"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
#### submit_raw_tx
|
|
|
|
|
|
|
|
Submit raw tx in hex generated by the fronted to be relayed to monero network.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/submit_raw_tx -d '{"tx":"020001020007bdcc019e8401806af20f8d0dd72cab40d8b798c19cbff78ac28bf6b7a2141e8ddd2af09a669440c4983e2c7bacbd4f240200027d6a157b6d00e3175c604cdd7f9b0d537b1ba4b1c949d60ce68c644a6ab037d50002251f9554df370da5e50900e38f207a43bc0e131f560238a42bf20166b48300f62101a00552a9b0f7b18526965cf510a1531d65439ada0c3c7f32d3f4959cace001f50180d1c2a0e501123ca835307de9442233acb55d346bf36a1d150e34525a8cc7bed0a6a08ccd09f76aadc775cb0dc836a802e81fc5dd1f3d4157f1553a50e7e4e0987b21963900d8607d200a3753897e958caf0b4b3ff281995fc1c37f8334492db83b6cd2c40d16dd2266d741e67d9a672d27a00cac3e028addc19f2e21d37ee9e44c68291300d58fd455e3bf47404453605b410848a8cee68bfe1124dc55126e1dbc4acce3adaca5c9b7a041c708ba1eb6b97d762c28cd8b1619cc6128f0d8ccb91765f3ec93db17778c5f480d5ca3142b91627e3c9016580a7f44ec07ff850dbb4960f63d02696b2a632c54ec7f4493b2f9ea49dae525a2b4335cd8c7770753b10bb740ab0f281040530588a7a6f14b5bb6d763d1434dd4e065142fba2172bcc92cdd1d410487fc9394cfe740452fadd9ce3cb0d7bd5dbd5443ec80d37fae0598d44d270c065ae041f4d3bc657ef3ca2e1b9ef072bfd8ea79e283ef8e2c151c6ba0a0dfbf08b332b8df37d7db48fbdce1bc50ab6d47301f62bdc5c5f7f9bbc8cf9ac4d254075b44d008d30a9539ee288c73d126ab6545c6e5f7d902ce61533445f184bb840db8ef0ebe6a34ad48ae5d60a0d1d542658d5fce93b28bbe2d9c7c330f0b82cf009d5dcbcf19b88a91c7cf82af78591fbde26a2ba9732674393a3e55faac33320d9e67c14f96d75faf24b7fa8e9eb9bfcf69a7157c0578c1b61df912b2aafdbb0a1d75551ae84ac72bad62bb6b8ab9ab1b4528dff0a8d8f30f791c07a8339d1a0993944136122f0afae3dba4b77d75d93d4116258cf2875251522ad3f57d2f01074433ef9a06738e9571c77dba72921a8dc8a313d2a88473d9f117e19535db8a094126cce97c097d0fc344f110ba3b6f31f7f11f8aa3790ac9de80abe9166caa021ef71cd41752d4da91fea2a5b9bb80e1ca11b651dcd5d870da16e383705c510c2beec911c63c2bd60221145d5523d141cdd7f1144b63d8be16b6290f49beaa06d0250071ff9885c2f8ea02a201ec7f42e51fde3bf1ee3dc87caeecf6f8efc70ebf30d7f3914ef26659dcd6d274c1aab82765b76cbefad53b6cfb02622416d9000b55ad09d0d99a00f68136260fe1f1415054d8b7fdab61bd324167d1d327ef08081e2c1e535a8446bff64c618ffc1b343e4f6567efa11ff9f864c550e553c60eb390f2ac408209c1c0e50de3bda3f003dab4b5c50c313058bcdc1eb65d949501762c3675fa5d9bb1e901f3dd82f42dab0ae841f348babe25770b8ecd49edeb095e57f341b898e646ec4486f715d0fbce212aacbef82b0366dbb0b4bf88dc36047b79b3e3bcaaf5e3efb6c5dbbfc3bb0f18be231550a4d0026e095e7db835570a62fb425ac1c933471a60508541b25b7556a3333a9ca6ec4a5d3ecedb00a7c8041612003d2523bf61a02aa633874aced4bae10fcc52fe0ffbde5b2acb21a6590fa1f75bda400d26715a81dcfe2fb150d1e6de07c076e4e5c22e377950405f020a902242dde89c22d7fdfd1fbe0ce4d216d131a1e8af40fc6f4516bbae44102a0bf73d04baecc35bfc83604a86eaff58d8233c9af9a7c31a28842ae7ccfd3036050ec770fad79e0be63e2d2f1a8d7c4f2d62b1ebe1d8ce3cc8514042eebcba320248752e30005f172fed893c9748038506367dcaeaf06c31755ac916864e0fe1048825f236604b116d583651b6779012d165041b36504fb937cecc788f721f860ea53ab41168ac80b6dff2b8007a95e6c8e131c77405c8dd6670b11d32b2a6d00d72d753459a4b636e04da4d9e0fcfc501aa1097c4a7495d6f6ab60cd0c9d3900c6bb1c06e0fa5129f8784631943764a3452f77211d52dec5036bebb5450f1430374f35a1b6399ba72df166bf67e9e4dd198dfa48527fec2f5c6c738e37e24c3044aef06e2bd80e9ede8afb12d8cd2d674c6b9b4c1131b5acc45431b009e468504d9a7b066f008c82dc3081cc7ea333593970d32e893e28de127363ac4f722c00715b9390b7cd7fc0a28a622011428839e49948ac387793135f1b73b9eb7b84e0a82104a47ef231ad4bc164dd40060493d7b1d866a975a3dd98c07678e34a7120edbb305097c1148b2a9baadc7f3874a05c72b97a363cfad232c885eeb6d00be0036df0f06019244264efc4fd63efe0ecf7a3607f6cb07c3c5d0fbbce459c86b0a2202c25cdb9fc211ad458174ee75a392b1cf08193c5534a3644732ad4bfe46035b9126d95db6254cbdc3e78d873ca7ca1e4416761bde4bd8a91be1320a8cf00d6829938d196dfd3a85598faf2f4981884422a387dbfdaf6783b8b89a7318140ed2b8b339b26e7a8ddf0a78b12055db5bc8c2a2465480c3eafd4d01c2f8e754088cd37da11dddf103a58ee2c96994499dd67139a478aa5ffeb39277797761710ffecf3efad111588b9a9dbbf46bc64e504361cc042b98394bbbba394296e75505949ea033ea3358d7fb343eacefdb0557d8058762110b94e8a792ce55adb6ed0b49528b1f2fe5d6f3be2ece6a355dd741d1bf41c80867a0e6738d96b6c127510c6b2790f4a444896c9f176e52b70de4c5a1ee4e6a3e5558a96786957827ff2700a3ef377178ace3d4678ba4f43987bccbdc4dcc07ba93ba0a5f
|
|
|
|
```
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"status": "success"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### import_wallet_request
|
|
|
|
|
|
|
|
Request to import wallet using entire blockchain history. This can be associated
|
|
|
|
with fee to be paid for this service or can be free.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/import_wallet_request -d '{"address":"57GLuXxxxAqdm5wT9sFJ4aDQGo2NkanFJXmDoZZbBeUFZ5b7QQ7pJvYjfkvBe9PsiZ4mGY9h7s2uxEiqS945eR6RL2yWikX", "view_key":"5e05a2aae20eafd68443e4d972ea8400cb7309ed85d339104f9f21542e45c403"'}
|
|
|
|
```
|
|
|
|
|
|
|
|
Output when fee is zero
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"error": "",
|
|
|
|
"import_fee": 0,
|
|
|
|
"new_request": true,
|
|
|
|
"request_fulfilled": true,
|
|
|
|
"status": "Import will start shortly"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Output when fee is not zero:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"error": "",
|
|
|
|
"import_fee": 100000000000,
|
|
|
|
"new_request": true,
|
|
|
|
"payment_address": "5DUWE29P72Eb8inMa41HuNJG4tj9CcaNKGr6EVSbvhWGJdpDQCiNNYBUNF1oDb8BczU5aD68d3HNKXaEsPq8cvbQLGMBjwL4UQtQYJXrbu",
|
|
|
|
"payment_id": "2cf6fef372541dd0",
|
|
|
|
"request_fulfilled": false,
|
|
|
|
"status": "Payment not yet received"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### import_recent_wallet_request
|
|
|
|
|
|
|
|
Free import of wallet based on recent blockchain history (e.g., last 10000 blocks)
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -w "\n" -X POST http://127.0.0.1:1984/import_recent_wallet_request -d '{"address":"55rDoHrJrwMUcdbaLYJk571vLAC5eZ8MaCtuDjcsFV2DTwr7R527qS3X8DxuTPsFacMfj3ESNJ9yybvzQjqSHLqsRShPQnJ", "view_key":"3bcf20ea17f8d1198b731bfaa66f7350e4c632a57289d47544ab5d8be43d940a", "no_blocks_to_import":"10000"'}
|
|
|
|
```
|
|
|
|
|
|
|
|
Example output:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"request_fulfilled": true,
|
|
|
|
"status": "Updating account with for importing recent txs successeful."
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Other examples
|
|
|
|
|
|
|
|
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.
|