added programmatically accepting Monero section, tweaks to CLI samples, enabled tooltips

This commit is contained in:
Riccardo Spagni 2015-02-18 23:35:30 +02:00
parent b0080ba3b7
commit 1b0a750c7b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
5 changed files with 86 additions and 15 deletions

View file

@ -7,6 +7,11 @@ url: "https://getmonero.org"
markdown: kramdown markdown: kramdown
# Kramdown was using smart quotes, which messes up CLI examples
# TODO: smart quotes are actually quite pretty, so this is perhaps better handled via a plugin that reverts them for CLI blocks
kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]
exclude: ["README.md"] exclude: ["README.md"]
paginate: 10 paginate: 10

View file

@ -16,3 +16,8 @@
<!-- JS --> <!-- JS -->
<script src="//static.monero.cc/js/jquery.min.js"></script> <script src="//static.monero.cc/js/jquery.min.js"></script>
<script src="//static.monero.cc/js/bootstrap.min.js"></script> <script src="//static.monero.cc/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>

View file

@ -9,4 +9,65 @@ icon: "icon_accepting"
attribution: "<!-- Icon is based on work by Icons8 (http://www.icons8.com) and is licensed under Creative Commons BY 3.0 -->" attribution: "<!-- Icon is based on work by Icons8 (http://www.icons8.com) and is licensed under Creative Commons BY 3.0 -->"
--- ---
### Work in Progress ### The Basics
Monero works a little differently to what you may have become accustomed to from other cryptocurrencies. In the case of a digital currency like Bitcoin and its many derivatives merchant payment systems will usually create a new recipient address for each payment or user.
However, because Monero has stealth addresses there is no need to have separate recipient addresses for each payment or user, and a single wallet address can be published. Instead, when receiving payments a merchant will provide the person paying with a "payment ID".
A payment ID is a hexadecimal string that is 64 characters long, and is normally randomly created by the merchant. An example of a payment ID is: <span style="word-break: break-all; word-wrap: break-word;">666c75666679706f6e7920697320746865206265737420706f6e792065766572</span>
### Checking for a Payment in simplewallet
If you want to check for a payment using simplewallet you can use the "payments" command followed by the payment ID or payment IDs you want to check. For example:
{:.cli-code}
<span style="color: yellow;">[wallet 49VNLa]:</span> payments 666c75666679706f6e7920697320746865206265737420706f6e792065766572
payment transaction height amount unlock time
<span style="color: lime;"><666c75666679706f6e79206973207> <7ba4cd810c9b4096869849458181e98e> 441942 30.00000 0</span>
<span style="color: yellow;">[wallet 49VNLa]:</span> <span style="color: gray;"></span><br><br><br><br><br><br>
If you need to check for payments programmatically, then details follow the next section.
### Receiving a Payment Step-by-Step
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Generate a random 64 character hexadecimal string for the payment
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Communicate the payment ID and Monero address to the individual who is making payment
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Check for the payment using the "payments" command in simplewallet
### Checking for a Payment Programatically
In order to check for a payment programatically you can use the get_payments or get_bulk_payments JSON RPC API calls.
*get_payments*: this requires a payment_id parameter with a single payment ID.
*get_bulk_payments*: this is the preferred method, and requires two parameters, payment_ids - a JSON array of payment IDs - and an optional min_block_height - the block height to scan from.
An example of returned data is as follows:
{:.cli-code}
<span style="color: cyan;">[ monero->~ ]$</span> curl -X POST http://127.0.0.1:18500/json_rpc -d '{"jsonrpc":"2.0","method":"get_bulk_payments","id":"test", "params":{"payment_ids": ["666c75666679706f6e7920697320746865206265737420706f6e792065766572"]}}' -H "Content-Type: application/json"
{
"id": "test",
"jsonrpc": "2.0",
"result": {
"payments": [{
"amount": 30000000000000,
"block_height": 441942,
"payment_id": "666c75666679706f6e7920697320746865206265737420706f6e792065766572",
"tx_hash": "7ba4cd810c9b4096869849458181e98e18b6474ab66415de0f4ccf7ab1162fdf",
"unlock_time": 0
}]
}
}
It is important to note that the amounts returned are in base Monero units and not in the display units normally used in end-user applications. Also, since a transaction will typically have multiple outputs that add up to the total required for the payment, the amounts should be grouped by the tx_hash or the payment_id and added together. Additionally, as multiple outputs can have the same amount, it is imperative not to try and filter out the returned data from a single get_bulk_payments call.
Before scanning for payments it is useful to check against the daemon RPC API (the get_info RPC call) to see if additional blocks have been received. Typically you would want to then scan only from that received block on by specifying it as the min_block_height to get_bulk_payments.
### Programatically Scanning for Payments
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Get the current block height from the daemon, only proceed if it has increased since our last scan
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Call the get_bulk_payments RPC API call with our last scanned height and the list of all payment IDs in our system
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Store the current block height as our last scanned height
<i class="fa fa-level-up fa-rotate-90 fa-lg instruction-list"></i> Remove duplicates based on transaction hashes we have already received and processed

View file

@ -34,18 +34,18 @@ Once you have the files downloaded and unpacked you don't need to do anything be
When starting Monero for the first time you will see something similar to this screen: When starting Monero for the first time you will see something similar to this screen:
{:.cli-code} {:.cli-code}
2015-Feb-18 00:09:45.699104 Core initialized OK 2015-Feb-18 00:09:45.699104 Core initialized OK
2015-Feb-18 00:09:45.700143 Starting core RPC server\.\.\. 2015-Feb-18 00:09:45.700143 Starting core RPC server\.\.\.
2015-Feb-18 00:09:45.700229 Run net_service loop( 2 threads)\.\.\. 2015-Feb-18 00:09:45.700229 Run net_service loop( 2 threads)\.\.\.
2015-Feb-18 00:09:45.700472 [SRV_MAIN]Core RPC server started ok 2015-Feb-18 00:09:45.700472 [SRV_MAIN]Core RPC server started ok
2015-Feb-18 00:09:45.700543 [SRV_MAIN]Starting P2P net loop\.\.\. 2015-Feb-18 00:09:45.700543 [SRV_MAIN]Starting P2P net loop\.\.\.
2015-Feb-18 00:09:45.701066 [SRV_MAIN]Run net_service loop( 10 threads)\.\.\. 2015-Feb-18 00:09:45.701066 [SRV_MAIN]Run net_service loop( 10 threads)\.\.\.
2015-Feb-18 00:09:46.702787 [P2P1] 2015-Feb-18 00:09:46.702787 [P2P1]
<span style="color: yellow;">2015-Feb-18 00:09:54.923018 [P2P6][5.9.25.103:28080 OUT]Sync data returned unknown top block: 228593 -> 228609 [16 blocks (0 days) behind]<br> <span style="color: yellow;">2015-Feb-18 00:09:54.923018 [P2P6][5.9.25.103:28080 OUT]Sync data returned unknown top block: 228593 -> 228609 [16 blocks (0 days) behind]
SYNCHRONIZATION started<br> SYNCHRONIZATION started
2015-Feb-18 00:09:57.803744 [P2P1][197.242.158.240:28080 OUT]Sync data returned unknown top block: 228593 -> 228609 [16 blocks (0 days) behind]<br> 2015-Feb-18 00:09:57.803744 [P2P1][197.242.158.240:28080 OUT]Sync data returned unknown top block: 228593 -> 228609 [16 blocks (0 days) behind]
SYNCHRONIZATION started</span><br> SYNCHRONIZATION started</span>
<span style="color: lime;">2015-Feb-18 00:10:01.719800 [P2P4][197.242.158.240:28080 OUT] SYNCHRONIZED OK</span><br> <span style="color: lime;">2015-Feb-18 00:10:01.719800 [P2P4][197.242.158.240:28080 OUT] SYNCHRONIZED OK</span>
The yellow text indicates it is receiving blocks as it synchronises up with the rest of the Monero network. The green "synchronized ok" text will appear once it has correctly synched up. Once you see this there's nothing further you need to do, you are now running a Monero node! The yellow text indicates it is receiving blocks as it synchronises up with the rest of the Monero network. The green "synchronized ok" text will appear once it has correctly synched up. Once you see this there's nothing further you need to do, you are now running a Monero node!

View file

@ -1,9 +1,9 @@
--- ---
layout: static_page layout: static_page
title: "The OpenAlias Standard" title: "The OpenAlias Project"
title-pre-kick: "The " title-pre-kick: "The "
title-kick: "OpenAlias " title-kick: "OpenAlias "
title-post-kick: "Standard" title-post-kick: "Project"
kick-class: "oa-kicks" kick-class: "oa-kicks"
icon: "icon_openalias" icon: "icon_openalias"
attribution: "<!-- Icon is based on work by Freepik (http://www.freepik.com) and is licensed under Creative Commons BY 3.0 -->" attribution: "<!-- Icon is based on work by Freepik (http://www.freepik.com) and is licensed under Creative Commons BY 3.0 -->"