Commit graph

685 commits

Author SHA1 Message Date
moneromooo-monero
a4dc575ccb
rpc: add a flush_cache RPC
This allows flushing internal caches (for now, the bad tx cache,
which will allow debugging a stuck monerod after it has failed to
verify a transaction in a block, since it would otherwise not try
again, making subsequent log changes pointless)
2019-10-25 18:41:54 +00:00
moneromooo-monero
ffa46026b5
simplewallet: add public_nodes command
Lists nodes exposing their RPC port for public use
2019-10-25 09:34:41 +00:00
moneromooo-monero
2899379791
daemon, wallet: new pay for RPC use system
Daemons intended for public use can be set up to require payment
in the form of hashes in exchange for RPC service. This enables
public daemons to receive payment for their work over a large
number of calls. This system behaves similarly to a pool, so
payment takes the form of valid blocks every so often, yielding
a large one off payment, rather than constant micropayments.

This system can also be used by third parties as a "paywall"
layer, where users of a service can pay for use by mining Monero
to the service provider's address. An example of this for web
site access is Primo, a Monero mining based website "paywall":
https://github.com/selene-kovri/primo

This has some advantages:
 - incentive to run a node providing RPC services, thereby promoting the availability of third party nodes for those who can't run their own
 - incentive to run your own node instead of using a third party's, thereby promoting decentralization
 - decentralized: payment is done between a client and server, with no third party needed
 - private: since the system is "pay as you go", you don't need to identify yourself to claim a long lived balance
 - no payment occurs on the blockchain, so there is no extra transactional load
 - one may mine with a beefy server, and use those credits from a phone, by reusing the client ID (at the cost of some privacy)
 - no barrier to entry: anyone may run a RPC node, and your expected revenue depends on how much work you do
 - Sybil resistant: if you run 1000 idle RPC nodes, you don't magically get more revenue
 - no large credit balance maintained on servers, so they have no incentive to exit scam
 - you can use any/many node(s), since there's little cost in switching servers
 - market based prices: competition between servers to lower costs
 - incentive for a distributed third party node system: if some public nodes are overused/slow, traffic can move to others
 - increases network security
 - helps counteract mining pools' share of the network hash rate
 - zero incentive for a payer to "double spend" since a reorg does not give any money back to the miner

And some disadvantages:
 - low power clients will have difficulty mining (but one can optionally mine in advance and/or with a faster machine)
 - payment is "random", so a server might go a long time without a block before getting one
 - a public node's overall expected payment may be small

Public nodes are expected to compete to find a suitable level for
cost of service.

The daemon can be set up this way to require payment for RPC services:

  monerod --rpc-payment-address 4xxxxxx \
    --rpc-payment-credits 250 --rpc-payment-difficulty 1000

These values are an example only.

The --rpc-payment-difficulty switch selects how hard each "share" should
be, similar to a mining pool. The higher the difficulty, the fewer
shares a client will find.
The --rpc-payment-credits switch selects how many credits are awarded
for each share a client finds.
Considering both options, clients will be awarded credits/difficulty
credits for every hash they calculate. For example, in the command line
above, 0.25 credits per hash. A client mining at 100 H/s will therefore
get an average of 25 credits per second.
For reference, in the current implementation, a credit is enough to
sync 20 blocks, so a 100 H/s client that's just starting to use Monero
and uses this daemon will be able to sync 500 blocks per second.

The wallet can be set to automatically mine if connected to a daemon
which requires payment for RPC usage. It will try to keep a balance
of 50000 credits, stopping mining when it's at this level, and starting
again as credits are spent. With the example above, a new client will
mine this much credits in about half an hour, and this target is enough
to sync 500000 blocks (currently about a third of the monero blockchain).

There are three new settings in the wallet:

 - credits-target: this is the amount of credits a wallet will try to
reach before stopping mining. The default of 0 means 50000 credits.

 - auto-mine-for-rpc-payment-threshold: this controls the minimum
credit rate which the wallet considers worth mining for. If the
daemon credits less than this ratio, the wallet will consider mining
to be not worth it. In the example above, the rate is 0.25

 - persistent-rpc-client-id: if set, this allows the wallet to reuse
a client id across runs. This means a public node can tell a wallet
that's connecting is the same as one that connected previously, but
allows a wallet to keep their credit balance from one run to the
other. Since the wallet only mines to keep a small credit balance,
this is not normally worth doing. However, someone may want to mine
on a fast server, and use that credit balance on a low power device
such as a phone. If left unset, a new client ID is generated at
each wallet start, for privacy reasons.

To mine and use a credit balance on two different devices, you can
use the --rpc-client-secret-key switch. A wallet's client secret key
can be found using the new rpc_payments command in the wallet.
Note: anyone knowing your RPC client secret key is able to use your
credit balance.

The wallet has a few new commands too:

 - start_mining_for_rpc: start mining to acquire more credits,
regardless of the auto mining settings
 - stop_mining_for_rpc: stop mining to acquire more credits
 - rpc_payments: display information about current credits with
the currently selected daemon

The node has an extra command:

 - rpc_payments: display information about clients and their
balances

The node will forget about any balance for clients which have
been inactive for 6 months. Balances carry over on node restart.
2019-10-25 09:34:38 +00:00
Nathan Dorfman
57346864a3 rpc: Include tag in get_info version string 2019-10-24 13:48:35 -06:00
moneromooo-monero
b3a9a4d99d
add a quick early out to get_blocks.bin when up to date 2019-10-24 11:30:54 +00:00
luigi1111
c81884f088
Merge pull request #5964
fd48461 Print cdifficulty and don't serialize miner tx hash twice (Doy-lee)
2019-10-22 10:07:17 -05:00
luigi1111
fcb4c72bb5
Merge pull request #5943
d4d2b5c p2p+rpc: don't skip p2p or rpc port bind failure by default (xiphon)
2019-10-14 20:05:25 -05:00
luigi1111
dc48cdc998
Merge pull request #5933
3455efa ban peers sending bad pow outright (moneromooo-monero)
2019-10-14 18:07:54 -05:00
xiphon
d4d2b5c79a p2p+rpc: don't skip p2p or rpc port bind failure by default 2019-10-13 13:27:46 +00:00
luigi1111
bf525793c7
Merge pull request #5915
8330e77 monerod can now sync from pruned blocks (moneromooo-monero)
2019-10-08 15:55:03 -05:00
Doyle
fd4846134d Print cdifficulty and don't serialize miner tx hash twice 2019-10-07 12:50:05 +11:00
luigi1111
c6430f9dd0
Merge pull request #5893
Coverity fixes [3a81639, 1bd962d, 2825f07, d099658, d46f701, cd57a10] (anonimal)
2019-09-30 18:43:48 -05:00
moneromooo-monero
8330e772f1
monerod can now sync from pruned blocks
If the peer (whether pruned or not itself) supports sending pruned blocks
to syncing nodes, the pruned version will be sent along with the hash
of the pruned data and the block weight. The original tx hashes can be
reconstructed from the pruned txes and theur prunable data hash. Those
hashes and the block weights are hashes and checked against the set of
precompiled hashes, ensuring the data we received is the original data.
It is currently not possible to use this system when not using the set
of precompiled hashes, since block weights can not otherwise be checked
for validity.

This is off by default for now, and is enabled by --sync-pruned-blocks
2019-09-27 00:10:37 +00:00
Howard Chu
81c2ad6d5b
RandomX integration
Support RandomX PoW algorithm
2019-09-25 21:29:42 +01:00
moneromooo-monero
3455efafa8
ban peers sending bad pow outright
PoW is expensive to verify, so be strict
2019-09-25 16:00:43 +00:00
luigi1111
3f6096867d
Merge pull request #5916
7b076d5 p2p: fix bans taking port into account (moneromooo-monero)
2019-09-24 10:42:29 -05:00
luigi1111
ee6e849627
Merge pull request #5877
2cd4fd8 Changed the use of boost:value_initialized for C++ list initializer (JesusRami)
4ad191f Removed unused boost/value_init header (whyamiroot)
928f4be Make null hash constants constexpr (whyamiroot)
2019-09-24 10:08:44 -05:00
moneromooo-monero
d53a55204f
functional_tests: add get_transaction_pool_stats
Also fix part of the RPC results being returned as binary.
This makes the RPC backward incompatible.
2019-09-17 11:38:29 +00:00
moneromooo-monero
7b076d5170
p2p: fix bans taking port into account 2019-09-16 22:45:45 +00:00
luigi1111
d663e1e3db
Merge pull request #5818
f91a06c Dropping cppzmq dependency; adding some zmq utils (vtnerd)
2019-09-14 13:25:14 -05:00
luigi1111
85962ee8e2
Merge pull request #5872
495a7e5 rpc: don't include an address in mining_status when not mining (moneromooo-monero)
2019-09-14 13:16:45 -05:00
luigi1111
6e1257cfbd
Merge pull request #5866
21f6c80 rpc: move a leftover light wallet RPC out of daemon RPC (moneromooo-monero)
2019-09-14 13:09:32 -05:00
luigi1111
253786c8ea
Merge pull request #5833
289d215 rpc: fix unitialized 'core_rpc_server::m_was_bootstrap_ever_used' (xiphon)
2019-09-08 19:41:27 -05:00
anonimal
d099658522
bootstrap_daemon: resolve CID 203915 (UNCAUGHT_EXCEPT)
The issue is triggered by the captured `this` in RPC server, which
passes reference to throwable `core_rpc_server`:

`core_rpc_server.cpp:164: m_bootstrap_daemon.reset(new bootstrap_daemon([this]{ return get_random_public_node(); }));`

The solution is to simply remove noexcept from the remaining `bootstrap_daemon`
constructors because noexcept is false in this context.

>"An exception of type "boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::asio::invalid_service_owner>>" is thrown but the throw list "noexcept" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate()."
2019-09-07 00:29:09 +00:00
luigi1111
0198b76217
Merge pull request #5799
082730b daemon: automatic public nodes discovering and bootstrap daemon switching (xiphon)
2019-09-04 09:27:02 -05:00
Jesus Ramirez
2cd4fd8972 Changed the use of boost:value_initialized for C++ list initializer 2019-09-02 14:16:29 +02:00
moneromooo-monero
495a7e5b97
rpc: don't include an address in mining_status when not mining
Best case is an address mined previously and it'll get returned,
worst case it was never initialized in the first place
2019-08-28 16:02:37 +00:00
moneromooo-monero
21f6c80fcd
rpc: move a leftover light wallet RPC out of daemon RPC 2019-08-28 15:51:28 +00:00
xiphon
082730b6e5 daemon: automatic public nodes discovering and bootstrap daemon switching 2019-08-27 12:01:49 +00:00
moneromooo-monero
33e91e1a1e
wallet, rpc: add a release field to get_version
It does not leak much since you can make a fair guess by RPC
version already, and some people want to avoid non release
clients when using third parties' nodes (because they'd never
lie about it)
2019-08-26 19:28:25 +00:00
xiphon
289d21500c rpc: fix unitialized 'core_rpc_server::m_was_bootstrap_ever_used' 2019-08-20 15:08:48 +00:00
luigi1111
c9df9d683a
Merge pull request #5696
fd60d05 daemon: fix print_pl only printing public zone peers (moneromooo-monero)
2019-08-20 01:50:10 -05:00
moneromooo-monero
fd60d05d5d
daemon: fix print_pl only printing public zone peers 2019-08-19 23:39:51 +00:00
luigi1111
4947f3bdba
Merge pull request #5636
b712ae0 rpc: work around a GCC 7.4.0 (at least) bug (moneromooo-monero)
2019-08-19 17:37:37 -05:00
luigi1111
56b98c7003
Merge pull request #5728
6560bfa rpc: get_block_template add optional extra_nonce (jtgrassie)
2019-08-19 17:33:08 -05:00
luigi1111
4baec08d5c
Merge pull request #5725
dc8b7a8 zmq: MacPorts latest fix (jtgrassie)
2019-08-19 17:29:38 -05:00
luigi1111
399a847cfc
Merge pull request #5689
1db5357 rpc headers fix (malbit)
2019-08-15 17:29:34 -05:00
luigi1111
df064eaa36
Merge pull request #5649
a182df2 Bans for RPC connections (hyc)
2019-08-15 17:10:49 -05:00
luigi1111
0ba675622f
Merge pull request #5634
1488109 rpc: fix get_transactions getting v1 txes from the txpool (moneromooo-monero)
2019-08-14 15:35:24 -05:00
luigi1111
0e986a86d5
Merge pull request #5607
52cd2fa rpc: implement get_public_nodes command (xiphon)
2019-08-14 15:34:14 -05:00
luigi1111
564bb1da3a
Merge pull request #5525
0605406 daemon: sort alt chains by height (moneromooo-monero)
4228ee0  daemon: add optional arguments to alt_chain_info (moneromooo-monero)
880ebfd daemon: add more chain specific info in alt_chain_info (moneromooo-monero)
2019-08-14 15:31:52 -05:00
luigi1111
2258551ef9
Merge pull request #5487
df83ed7 consensus: from v12, enforce >= 2 outputs (moneromooo-monero)
2019-08-14 15:26:55 -05:00
Thomas Winget
155475d971
Add IPv6 support
new cli options (RPC ones also apply to wallet):
  --p2p-bind-ipv6-address (default = "::")
  --p2p-bind-port-ipv6    (default same as ipv4 port for given nettype)
  --rpc-bind-ipv6-address (default = "::1")

  --p2p-use-ipv6          (default false)
  --rpc-use-ipv6          (default false)

  --p2p-require-ipv4      (default true, if ipv4 bind fails and this is
                           true, will not continue even if ipv6 bind
                           successful)
  --rpc-require-ipv4      (default true, description as above)

ipv6 addresses are to be specified as "[xx:xx:xx::xx:xx]:port" except
in the cases of the cli args for bind address.  For those the square
braces can be omitted.
2019-07-31 20:04:57 -04:00
xiphon
52cd2fa0af rpc: implement get_public_nodes command 2019-07-29 10:51:15 +00:00
luigi1111
d4d5a4433d
Merge pull request #5623
b8cfa92 rpc: implement set_bootstrap_daemon method (xiphon)
2019-07-24 14:38:15 -05:00
luigi1111
e05873d873
Merge pull request #5606
cf8cb68 rpc: use ip address string representation for peer::host field (xiphon)
2019-07-24 14:31:59 -05:00
luigi1111
e241a6280d
Merge pull request #5582
fcfcc3a rpc: in/out peers can now return the setting's value (moneromooo-monero)
2019-07-24 14:18:09 -05:00
luigi1111
e579fe4ae0
Merge pull request #5530
6abaaaa remove obsolete save_graph skeleton code (moneromooo-monero)
2019-07-24 14:07:29 -05:00
luigi1111
e3de4aa68b
Merge pull request #5502
25a7cfd add a few checks where it seems appropriate (moneromooo-monero)
1a66a86 remove unused code (moneromooo-monero)
2019-07-24 13:57:06 -05:00
Lee Clagett
f91a06c6d7 Dropping cppzmq dependency; adding some zmq utils 2019-07-22 06:37:16 +00:00
moneromooo-monero
65c4004963
allow blocking whole subnets 2019-07-16 11:35:53 +00:00
moneromooo-monero
515ac2951d
p2p: store network address directly in blocked host list
rather than their string representation
2019-07-16 11:35:52 +00:00
Jethro Grassie
6560bfa64c
rpc: get_block_template add optional extra_nonce
Circumvents the need to create a new blockhashing blob when you already
know the data you want to set in the extra_nonce (so use this instead of
reserve_size).
2019-07-03 07:57:36 -04:00
Jethro Grassie
dc8b7a88bd
zmq: MacPorts latest fix 2019-07-01 23:13:55 -04:00
Michal vel m@lbit
1db5357c7b rpc headers fix 2019-06-25 01:49:04 +01:00
stoffu
15c699f0a6
rpc: set sanity_check_failed to false when successful 2019-06-20 14:32:49 +09:00
Howard Chu
a182df21d0
Bans for RPC connections
Make bans control RPC sessions too. And auto-ban some bad requests.
Drops HTTP connections whenever response code is 500.
2019-06-16 11:38:08 +01:00
moneromooo-monero
2eef90d6ef
rpc: restrict the recent cutoff size in restricted RPC mode 2019-06-14 08:47:33 +00:00
moneromooo-monero
b712ae0af2
rpc: work around a GCC 7.4.0 (at least) bug
In static member function ‘static boost::optional<cryptonote::rpc::output_distribution_data> cryptonote::rpc::RpcHandler::get_output_distribution(const std::function<bool(long unsigned int, long unsigned int, long unsigned int, long unsigned int&, std::vector<long unsigned int>&, long unsigned int&)>&, uint64_t, uint64_t, uint64_t, const std::function<crypto::hash(long unsigned int)>&, bool, uint64_t)’:
cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551536 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
2019-06-12 22:27:07 +00:00
moneromooo-monero
14881094af
rpc: fix get_transactions getting v1 txes from the txpool
It would try to get their prunable hash, but v1 txes don't have one
2019-06-12 11:59:13 +00:00
xiphon
b8cfa92b7e rpc: implement set_bootstrap_daemon method 2019-06-10 21:10:08 +00:00
ston1th
f2f207d635 miner: fix double free of thread attributes
issue: #5568
2019-06-09 10:51:18 +02:00
xiphon
cf8cb6873a rpc: use ip address string representation for peer::host field 2019-06-04 19:33:35 +00:00
moneromooo-monero
880ebfdeea
daemon: add more chain specific info in alt_chain_info 2019-06-01 15:43:52 +00:00
moneromooo-monero
fcfcc3ac86
rpc: in/out peers can now return the setting's value 2019-05-30 12:13:31 +00:00
Lee Clagett
3544596f9f Add ssl_options support to monerod's rpc mode. 2019-05-22 00:09:11 -04:00
moneromooo-monero
6abaaaa994
remove obsolete save_graph skeleton code 2019-05-10 14:17:18 +00:00
moneromooo-monero
1e8f3f66bf
rpc: fail update RPC when running offline 2019-05-09 19:14:49 +00:00
moneromooo-monero
0605406714
daemon: sort alt chains by height 2019-05-09 09:12:49 +00:00
Riccardo Spagni
f64f59627d
Merge pull request #5510
e9809382 fix wide difficulty conversion with some versions of boost (moneromooo-monero)
2019-05-07 17:36:27 +02:00
Riccardo Spagni
9d91301faa
Merge pull request #5496
0eb0d6b8 rpc: improve get_output_distribution (moneromooo-monero)
2019-05-07 17:30:27 +02:00
moneromooo-monero
e980938210
fix wide difficulty conversion with some versions of boost 2019-05-01 19:58:09 +00:00
moneromooo-monero
25a7cfdb4a
add a few checks where it seems appropriate 2019-04-29 20:52:40 +00:00
moneromooo-monero
5e0da6fb68
change SSL certificate fingerprint whitelisting from SHA1 to SHA-256
SHA1 is too close to bruteforceable
2019-04-26 11:37:15 +00:00
moneromooo-monero
0eb0d6b802
rpc: improve get_output_distribution
It can now handle small reorgs without having to rescan the
whole blockchain.

Also add a test for it.
2019-04-25 16:49:29 +00:00
moneromooo-monero
df83ed74e4
consensus: from v12, enforce >= 2 outputs 2019-04-23 22:09:35 +00:00
Riccardo Spagni
1b092f3a44
Merge pull request #5452
c30d93fc rpc: add a pruned bool to the prune_blockchain call (moneromooo-monero)
2019-04-16 22:48:50 +02:00
Riccardo Spagni
68d131615e
Merge pull request #5448
d009f6dd rpc: fix get_block_hashes.bin from wallet on pruned blockchain (moneromooo-monero)
bb0ef5b1 blockchain: lock the blockchain while pruning (moneromooo-monero)
2019-04-16 22:47:36 +02:00
Riccardo Spagni
f376cd5605
Merge pull request #5446
7d79222f daemon: remove debug info (moneromooo-monero)
8fec0f98 functional_tests: add sweep_single test (moneromooo-monero)
9880d61b wallet_rpc_server: remove unused code (moneromooo-monero)
8a61b33d rpc: omit irrelevant fields for pool txes in gettransactions (moneromooo-monero)
56508524 rpc: add relayed in get_transaction output (moneromooo-monero)
82e510f1 rpc: set default log category in core_rpc_server.h (moneromooo-monero)
2019-04-16 22:46:29 +02:00
Riccardo Spagni
8af1a89e4c
Merge pull request #5441
b3648232 daemon: fix ratio not being floating point (moneromooo-monero)
e1b097b9 core_rpc_server: remove dummy assigning int to bool (moneromooo-monero)
2019-04-16 22:44:41 +02:00
Riccardo Spagni
1f01070a0c
Merge pull request #5434
ccb996af rpc: new sanity check on relayed transactions (moneromooo-monero)
2019-04-16 22:41:40 +02:00
Riccardo Spagni
45e1f7c292
Merge pull request #5428
f3425f8d rpc.getblocktemplate: set reserved_offset to zero when reserve_size==0 (stoffu)
2019-04-16 22:39:18 +02:00
moneromooo-monero
c30d93fcd9
rpc: add a pruned bool to the prune_blockchain call 2019-04-16 15:15:14 +00:00
moneromooo-monero
d009f6dd61
rpc: fix get_block_hashes.bin from wallet on pruned blockchain
We want to get all blocks here, even pruned ones
2019-04-15 22:27:15 +00:00
moneromooo-monero
8a61b33d8e
rpc: omit irrelevant fields for pool txes in gettransactions 2019-04-15 09:11:54 +00:00
moneromooo-monero
565085245a
rpc: add relayed in get_transaction output 2019-04-15 09:11:50 +00:00
moneromooo-monero
82e510f15e
rpc: set default log category in core_rpc_server.h 2019-04-15 09:10:29 +00:00
Riccardo Spagni
e89aa2ec56
Merge pull request #5421
e78cea74 rpc: fix off by one in get_height (moneromooo-monero)
2019-04-15 09:22:50 +02:00
Riccardo Spagni
9bd0983d5e
Merge pull request #5402
cbf32241 rpc: make wide_difficulty hexadecimal (moneromooo-monero)
2019-04-15 09:18:10 +02:00
moneromooo-monero
e1b097b99b
core_rpc_server: remove dummy assigning int to bool
Coverity 197653
2019-04-14 09:26:12 +00:00
moneromooo-monero
ccb996afc6
rpc: new sanity check on relayed transactions
This will weed out some transactions with silly rings
2019-04-12 20:22:09 +00:00
stoffu
f3425f8d32
rpc.getblocktemplate: set reserved_offset to zero when reserve_size==0 2019-04-12 18:55:38 +09:00
moneromooo-monero
e78cea74bd
rpc: fix off by one in get_height 2019-04-11 17:24:02 +00:00
moneromooo-monero
064ab12340
functional_tests: add more blockchain related tests
Related to emission, reorgs, getting tx data back, output
distribution and histogram
2019-04-11 11:07:58 +00:00
Riccardo Spagni
4a2cc76c84
Merge pull request #5376
c746f45d Add hash of top block to /getheight RPC (Howard Chu)
2019-04-11 13:01:54 +02:00
Riccardo Spagni
3a4008f0fc
Merge pull request #5374
a2561653 wallet: new option to start background mining (moneromooo-monero)
2019-04-11 13:01:30 +02:00
Lee Clagett
21eb1b0725 Pass SSL arguments via one class and use shared_ptr instead of reference 2019-04-07 00:44:37 -04:00
Lee Clagett
1f5ed328aa Change default SSL to "enabled" if user specifies fingerprint/certificate
Currently if a user specifies a ca file or fingerprint to verify peer,
the default behavior is SSL autodetect which allows for mitm downgrade
attacks. It should be investigated whether a manual override should be
allowed - the configuration is likely always invalid.
2019-04-06 23:47:07 -04:00
Lee Clagett
a3b0284837 Change SSL certificate file list to OpenSSL builtin load_verify_location
Specifying SSL certificates for peer verification does an exact match,
making it a not-so-obvious alias for the fingerprints option. This
changes the checks to OpenSSL which loads concatenated certificate(s)
from a single file and does a certificate-authority (chain of trust)
check instead. There is no drop in security - a compromised exact match
fingerprint has the same worse case failure. There is increased security
in allowing separate long-term CA key and short-term SSL server keys.

This also removes loading of the system-default CA files if a custom
CA file or certificate fingerprint is specified.
2019-04-06 23:47:06 -04:00
moneromooo-monero
e8cf7dcc2b
rpc: merge the two get_info implementations 2019-04-06 14:04:24 +00:00
moneromooo-monero
cbf3224180
rpc: make wide_difficulty hexadecimal
This should be friendlier for clients which don't have bignum support
2019-04-05 16:30:16 +00:00
moneromooo-monero
a2561653cb
wallet: new option to start background mining
The setup-background-mining option can be used to select
background mining when a wallet loads. The user will be asked
the first time the wallet is created.
2019-04-04 18:10:45 +00:00
stoffu
a299dc96f7
rpc.gettransactions: fill as_json with partial tx in pruned mode 2019-04-04 18:08:01 +09:00
Riccardo Spagni
1ed6441925
Merge pull request #5327
c23ea796 New interactive daemon command 'print_net_stats': Global traffic stats (rbrunner7)
2019-04-01 17:32:01 +02:00
Riccardo Spagni
a69b71dc41
Merge pull request #5326
dc20d774 rpc: add miner tx hash to block header response (moneromooo-monero)
2019-04-01 17:31:36 +02:00
Riccardo Spagni
97831e5f8b
Merge pull request #5308
a7211793 rpc: quantize db size up to 5 GB in restricted mode (moneromooo-monero)
2019-04-01 17:27:56 +02:00
Riccardo Spagni
4a06b3ee62
Merge pull request #5298
8fd7452b wallet: move light wallet RPC out of core RPC (moneromooo-monero)
2019-04-01 17:24:13 +02:00
Howard Chu
c746f45d3e
Add hash of top block to /getheight RPC 2019-04-01 01:02:58 +01:00
moneromooo-monero
91f4c7f45f
Make difficulty 128 bit instead of 64 bit
Based on Boolberry work by:
  jahrsg <jahr@jahr.me>
  cr.zoidberg <crypto.zoidberg@gmail.com>
2019-03-24 21:03:19 +00:00
Riccardo Spagni
0920ac7642
Merge pull request #5207
be6f426a rpc: Allow submitting tx as hex blob over ZMQ (Nathan Dorfman)
2019-03-24 19:33:36 +02:00
rbrunner7
c23ea7962d New interactive daemon command 'print_net_stats': Global traffic stats 2019-03-24 16:58:57 +01:00
Riccardo Spagni
df50181ab2
Merge pull request #5237
3907588b rpc: make fill_pow restricted (moneromooo-monero)
2019-03-21 14:46:20 +02:00
moneromooo-monero
dc20d77459
rpc: add miner tx hash to block header response 2019-03-21 00:24:12 +00:00
moneromooo-monero
a7211793ba
rpc: quantize db size up to 5 GB in restricted mode 2019-03-17 21:27:52 +00:00
Riccardo Spagni
848591c4d8
Merge pull request #5190
551104fb daemon: add --public-node mode, RPC port propagation over P2P (xiphon)
2019-03-17 17:56:04 +02:00
Riccardo Spagni
429930534d
Merge pull request #5185
59478c80 daemon: new mining_status command (moneromooo-monero)
2019-03-17 17:55:32 +02:00
Riccardo Spagni
fd231226b9
Merge pull request #5177
bb2aed8e rpc: quantize db size up to 5 GB in restricted mode (moneromooo-monero)
2019-03-17 17:52:56 +02:00
moneromooo-monero
8fd7452b6e
wallet: move light wallet RPC out of core RPC
It's not nothing to do with it
2019-03-15 13:34:08 +00:00
moneromooo-monero
59478c80dd
daemon: new mining_status command 2019-03-09 20:51:53 +00:00
moneromooo-monero
3907588bf6
rpc: make fill_pow restricted
It's slow work, so let's not expose it
2019-03-06 00:05:41 +00:00
binaryFate
1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
Martijn Otto
057c279cb4
epee: add SSL support
RPC connections now have optional tranparent SSL.

An optional private key and certificate file can be passed,
using the --{rpc,daemon}-ssl-private-key and
--{rpc,daemon}-ssl-certificate options. Those have as
argument a path to a PEM format private private key and
certificate, respectively.
If not given, a temporary self signed certificate will be used.

SSL can be enabled or disabled using --{rpc}-ssl, which
accepts autodetect (default), disabled or enabled.

Access can be restricted to particular certificates using the
--rpc-ssl-allowed-certificates, which takes a list of
paths to PEM encoded certificates. This can allow a wallet to
connect to only the daemon they think they're connected to,
by forcing SSL and listing the paths to the known good
certificates.

To generate long term certificates:

openssl genrsa -out /tmp/KEY 4096
openssl req -new -key /tmp/KEY -out /tmp/REQ
openssl x509 -req -days 999999 -sha256 -in /tmp/REQ -signkey /tmp/KEY -out /tmp/CERT

/tmp/KEY is the private key, and /tmp/CERT is the certificate,
both in PEM format. /tmp/REQ can be removed. Adjust the last
command to set expiration date, etc, as needed. It doesn't
make a whole lot of sense for monero anyway, since most servers
will run with one time temporary self signed certificates anyway.

SSL support is transparent, so all communication is done on the
existing ports, with SSL autodetection. This means you can start
using an SSL daemon now, but you should not enforce SSL yet or
nothing will talk to you.
2019-03-05 14:16:08 +01:00
moneromooo-monero
e396146aee
default initialize rpc structures 2019-03-04 22:38:03 +00:00
Riccardo Spagni
46fd181cca
Merge pull request #4054
24569454 epee: add SSL support (moneromooo-monero)
2019-03-04 21:17:21 +02:00
moneromooo-monero
b8787f4302
ArticMine's new block weight algorithm
This curbs runaway growth while still allowing substantial
spikes in block weight

Original specification from ArticMine:

here is the scaling proposal
Define: LongTermBlockWeight
Before fork:
LongTermBlockWeight = BlockWeight
At or after fork:
LongTermBlockWeight = min(BlockWeight, 1.4*LongTermEffectiveMedianBlockWeight)
Note: To avoid possible consensus issues over rounding the LongTermBlockWeight for a given block should be calculated to the nearest byte, and stored as a integer in the block itself. The stored LongTermBlockWeight is then used for future calculations of the LongTermEffectiveMedianBlockWeight and not recalculated each time.
Define:   LongTermEffectiveMedianBlockWeight
LongTermEffectiveMedianBlockWeight = max(300000, MedianOverPrevious100000Blocks(LongTermBlockWeight))
Change Definition of EffectiveMedianBlockWeight
From (current definition)
EffectiveMedianBlockWeight  = max(300000, MedianOverPrevious100Blocks(BlockWeight))
To (proposed definition)
EffectiveMedianBlockWeight  = min(max(300000, MedianOverPrevious100Blocks(BlockWeight)), 50*LongTermEffectiveMedianBlockWeight)
Notes:
1) There are no other changes to the existing penalty formula, median calculation, fees etc.
2) There is the requirement to store the LongTermBlockWeight of a block unencrypted in the block itself. This  is to avoid possible consensus issues over rounding and also to prevent the calculations from becoming unwieldy as we move away from the fork.
3) When the  EffectiveMedianBlockWeight cap is reached it is still possible to mine blocks up to 2x the EffectiveMedianBlockWeight by paying the corresponding penalty.

Note: the long term block weight is stored in the database, but not in the actual block itself,
since it requires recalculating anyway for verification.
2019-03-04 09:33:58 +00:00
Nathan Dorfman
be6f426a3f rpc: Allow submitting tx as hex blob over ZMQ 2019-02-27 16:55:04 -07:00
xiphon
551104fbf1 daemon: add --public-node mode, RPC port propagation over P2P 2019-02-25 02:40:23 +03:00
moneromooo-monero
bb2aed8e4d
rpc: quantize db size up to 5 GB in restricted mode 2019-02-21 23:49:53 +00:00
moneromooo-monero
2456945408
epee: add SSL support
RPC connections now have optional tranparent SSL.

An optional private key and certificate file can be passed,
using the --{rpc,daemon}-ssl-private-key and
--{rpc,daemon}-ssl-certificate options. Those have as
argument a path to a PEM format private private key and
certificate, respectively.
If not given, a temporary self signed certificate will be used.

SSL can be enabled or disabled using --{rpc}-ssl, which
accepts autodetect (default), disabled or enabled.

Access can be restricted to particular certificates using the
--rpc-ssl-allowed-certificates, which takes a list of
paths to PEM encoded certificates. This can allow a wallet to
connect to only the daemon they think they're connected to,
by forcing SSL and listing the paths to the known good
certificates.

To generate long term certificates:

openssl genrsa -out /tmp/KEY 4096
openssl req -new -key /tmp/KEY -out /tmp/REQ
openssl x509 -req -days 999999 -sha256 -in /tmp/REQ -signkey /tmp/KEY -out /tmp/CERT

/tmp/KEY is the private key, and /tmp/CERT is the certificate,
both in PEM format. /tmp/REQ can be removed. Adjust the last
command to set expiration date, etc, as needed. It doesn't
make a whole lot of sense for monero anyway, since most servers
will run with one time temporary self signed certificates anyway.

SSL support is transparent, so all communication is done on the
existing ports, with SSL autodetection. This means you can start
using an SSL daemon now, but you should not enforce SSL yet or
nothing will talk to you.
2019-02-02 20:05:33 +00:00
Lee Clagett
973403bc9f Adding initial support for broadcasting transactions over Tor
- Support for ".onion" in --add-exclusive-node and --add-peer
  - Add --anonymizing-proxy for outbound Tor connections
  - Add --anonymous-inbounds for inbound Tor connections
  - Support for sharing ".onion" addresses over Tor connections
  - Support for broadcasting transactions received over RPC exclusively
    over Tor (else broadcast over public IP when Tor not enabled).
2019-01-28 23:56:33 +00:00
moneromooo-monero
acfff8d0ce
rpc: fix internal daemon calls in restricted rpc getting partial data 2019-01-28 19:35:20 +00:00
moneromooo-monero
b750fb27b0
Pruning
The blockchain prunes seven eighths of prunable tx data.
This saves about two thirds of the blockchain size, while
keeping the node useful as a sync source for an eighth
of the blockchain.

No other data is currently pruned.

There are three ways to prune a blockchain:

- run monerod with --prune-blockchain
- run "prune_blockchain" in the monerod console
- run the monero-blockchain-prune utility

The first two will prune in place. Due to how LMDB works, this
will not reduce the blockchain size on disk. Instead, it will
mark parts of the file as free, so that future data will use
that free space, causing the file to not grow until free space
grows scarce.

The third way will create a second database, a pruned copy of
the original one. Since this is a new file, this one will be
smaller than the original one.

Once the database is pruned, it will stay pruned as it syncs.
That is, there is no need to use --prune-blockchain again, etc.
2019-01-22 20:30:51 +00:00
Riccardo Spagni
3eb96fa512
Merge pull request #5027
9092fc4b wallet: do not display daemon controlled text if untrusted (moneromooo-monero)
2019-01-16 21:38:15 +02:00
Riccardo Spagni
9d57ee9ff6
Merge pull request #4984
008647d7 blockchain_db: speedup tx output gathering (moneromooo-monero)
2019-01-16 19:06:07 +02:00
Riccardo Spagni
577a8f5c84
Merge pull request #4952
570dd369 p2p: use vector instead of list for peer lists (moneromooo-monero)
2019-01-06 20:39:07 +02:00
moneromooo-monero
9092fc4bfd
wallet: do not display daemon controlled text if untrusted 2018-12-30 01:32:57 +00:00
moneromooo-monero
008647d7eb
blockchain_db: speedup tx output gathering
We know all the data we'll want for getblocks.bin is contiguous
2018-12-18 11:55:21 +00:00
Riccardo Spagni
4556f0e2b8
Merge pull request #4908
5ca4994c rpc: speed up the common get_output_distribution case while syncing (moneromooo-monero)
2018-12-12 11:59:04 +02:00
Riccardo Spagni
0fccc78e39
Merge pull request #4903
dc1c1252 add command pop_blocks (Jason Wong)
2018-12-12 11:58:37 +02:00
moneromooo-monero
570dd3690e
p2p: use vector instead of list for peer lists 2018-12-07 13:20:34 +00:00
Riccardo Spagni
7e957c162a
Merge pull request #4879
243f010e rpc: mask values that are nobody else's business in restricted RPC (moneromooo-monero)
2018-12-04 17:34:57 +02:00
Riccardo Spagni
81418cb281
Merge pull request #4894
aee7a4e3 wallet_rpc_server: do not use RPC data if the call failed (moneromooo-monero)
1a0733e5 windows_service: fix memory leak (moneromooo-monero)
0dac3c64 unit_tests: do not rethrow a copy of an exception (moneromooo-monero)
5d9915ab cryptonote: fix get_unit for non default settings (moneromooo-monero)
d4f50cb1 remove some unused code (moneromooo-monero)
61163971 a few minor (but easy) performance tweaks (moneromooo-monero)
30023074 tests: slow_memmem now returns size_t (moneromooo-monero)
2018-12-04 17:33:19 +02:00
moneromooo-monero
243f010edc
rpc: mask values that are nobody else's business in restricted RPC 2018-12-04 15:32:21 +00:00
Riccardo Spagni
e282e9fa40
Merge pull request #4878
517f25ef rpc: add version to get_info (Jethro Grassie)
2018-12-04 17:28:24 +02:00
Riccardo Spagni
e7d30780de
Merge pull request #4869
60f36386 Avoid unnecessary temp block and copy ctor (moneromooo-monero)
2018-12-04 17:12:47 +02:00
Riccardo Spagni
11d86f6008
Merge pull request #4859
6f2497bc Don't cache nettype in core_rpc_server use m_core (doy-lee)
2018-12-04 17:09:21 +02:00
Riccardo Spagni
c00ac446fd
Merge pull request #4854
bd98e99c Removed a lot of unnecessary includes (Martijn Otto)
2018-12-04 17:08:42 +02:00
Jason Wong
dc1c12528d add command pop_blocks
add new public method to Blockchain and update according to code review

update after review: better lock/unlock, try catch and coding style
2018-11-28 12:20:28 +01:00
moneromooo-monero
5ca4994c9c
rpc: speed up the common get_output_distribution case while syncing 2018-11-27 14:01:40 +00:00
Riccardo Spagni
58ce16d4d9
Merge pull request #4821
fc98f7a0 rpc: speedup get_outs.bin (moneromooo-monero)
2018-11-26 21:51:27 +02:00
moneromooo-monero
fc98f7a0a1
rpc: speedup get_outs.bin 2018-11-26 18:56:23 +00:00
moneromooo-monero
d4f50cb109
remove some unused code
Found by codacy.com
2018-11-23 15:37:36 +00:00
moneromooo-monero
3002307418
tests: slow_memmem now returns size_t
Makes more sense than uint64_t for an offset, and agrees with
the %zu used to print results.

Found by codacy.com
2018-11-23 15:36:48 +00:00
Jethro Grassie
517f25efd1
rpc: add version to get_info 2018-11-21 12:56:34 -05:00
moneromooo-monero
b9b307d11a
rpc: speedup get_output_distribution
and decrease the amount of data carried around
2018-11-20 10:11:25 +00:00
moneromooo-monero
60f36386e4
Avoid unnecessary temp block and copy ctor
block already has a default ctor, and the extra object
churn due to its innards (vectors, etc) is pointless.
2018-11-19 17:57:17 +00:00
moneromooo-monero
31d80027b5
tests: add unit tests for get_output_distribution 2018-11-16 19:21:45 +00:00
doy-lee
6f2497bc7a Don't cache nettype in core_rpc_server use m_core
This can go out of sync with m_core's nettype if you run in fakechain
mode since entering fakechain mode is done through code not the command
line and core_rpc_server only looks at the command line to figure out
the nettype.
2018-11-16 15:32:05 +11:00
Martijn Otto
bd98e99c80
Removed a lot of unnecessary includes 2018-11-15 17:29:34 +01:00
Riccardo Spagni
23fc891555
Merge pull request #4750
e61062b6 use current height - 1 for top block height in err msgs (cryptochangements34)
2018-11-14 21:32:21 +02:00
Riccardo Spagni
ff347c98a1
Merge pull request #4747
dad5bbfd return message in stop_mining if mining never started (cryptochangements34)
2018-11-14 21:32:10 +02:00
Riccardo Spagni
299d75b209
Merge pull request #4735
73e504c1 rpc: adjust ring size error message now that too high is also possible (moneromooo-monero)
a5ca7f4f core: fix unmixable special case allowing ring size below 11 (moneromooo-monero)
2018-11-06 21:31:14 +02:00
Dusan Klinec
e178bf234a
rpc: fix linking error of 6097472a, get_output_distribution
Undefined symbols for architecture x86_64:
  "cryptonote::core::get_output_distribution(unsigned long long, unsigned long long, unsigned long long, unsigned long long&, std::__1::vector<unsigned long long, std::__1::allocator<unsigned long long> >&, unsigned long long&) const", referenced from:
      cryptonote::rpc::RpcHandler::get_output_distribution(cryptonote::core&, unsigned long long, unsigned long long, unsigned long long, bool) in rpc_handler.cpp.o
2018-11-04 23:38:52 +01:00
Riccardo Spagni
0c7086bf7f
Merge pull request #4687
6097472a Update ZMQ fee estimate and add ZMQ output distribution (Lee Clagett)
2018-11-04 20:44:49 +02:00
cryptochangements34
e61062b6f2 use current height - 1 for top block height in err msgs 2018-11-02 19:31:31 -04:00
cryptochangements34
dad5bbfdf9
return message in stop_mining if mining never started 2018-10-28 09:50:33 -04:00
moneromooo-monero
73e504c139
rpc: adjust ring size error message now that too high is also possible 2018-10-27 11:16:28 +00:00
Riccardo Spagni
00a7d441d6
Merge pull request #4719
0aff4987 rpc: fix build with older compilers (moneromooo-monero)
2018-10-26 22:41:43 +02:00
Riccardo Spagni
fc06c5daf8
Merge pull request #4617
3ffbec15 rpc: init m_rpc_version in Message ctor (moneromooo-monero)
bfa2dce1 rpc: remove unused ctors (moneromooo-monero)
7cc39845 account: init creation timestamp to 0 (moneromooo-monero)
32123789 wallet2: initialize some scalar fields in ctor where appropriate (moneromooo-monero)
4eca42b2 blockchain_db: initialize m_hardfork in ctor just in case (moneromooo-monero)
2018-10-26 22:39:00 +02:00
moneromooo-monero
0aff49873c
rpc: fix build with older compilers 2018-10-24 20:36:58 +00:00
Lee Clagett
6097472a19 Update ZMQ fee estimate and add ZMQ output distribution 2018-10-23 23:46:31 -04:00
stoffu
e51c978770
rpc: fix wrongly formatted JSON for pruned tx
Fix for #4399.
Also unifies code for serializing pruned tx to binary/json into one.
2018-10-22 10:52:40 +09:00
Riccardo Spagni
2287fb9fb4
Merge pull request #4524
f5f7c2ac rpc: blanket initialize 0MQ request and response structures (moneromooo-monero)
2018-10-20 20:40:56 +02:00
Riccardo Spagni
9f34a3a29a
Merge pull request #4659
b916ca63 rpc: fix output distribution caching ignoring chain changes (moneromooo-monero)
2018-10-20 20:37:54 +02:00
moneromooo-monero
b916ca63a8
rpc: fix output distribution caching ignoring chain changes
0 is placeholder for whole chain, so we should compare chain
height changes rather than chain-height-or-zero. Even this isn't
totally foolproof if a blocks are popped and the same number
added again, but it is much better as it prevents the data from
slowly going out of sync.
2018-10-19 09:22:35 +00:00
stoffu
776aefdac1
tx_pool: revert #4592 and move bin2hex conversion to on_get_transaction_pool 2018-10-18 08:01:56 +09:00
moneromooo-monero
3ffbec1556
rpc: init m_rpc_version in Message ctor
Coverity 182501
2018-10-16 11:58:54 +00:00
moneromooo-monero
bfa2dce171
rpc: remove unused ctors
Also prevents coverity from moaning about them not initializing fields
2018-10-16 11:58:52 +00:00
moneromooo-monero
f5f7c2ac24
rpc: blanket initialize 0MQ request and response structures 2018-10-12 09:57:41 +00:00
AnythingTechPro
9a85669724
rpc: fixed typo in JSON command error response message 2018-10-04 22:12:53 -04:00
Riccardo Spagni
fd74815f65
Merge pull request #4399
f77ce675 rpc: allow pruning of json encoded txs (cryptochangements34)
2018-09-21 20:46:00 +02:00
Riccardo Spagni
0645dcdbdb
Merge pull request #4378
ac934663 rpc: add a "is an update available" flag in get_info (moneromooo-monero)
2018-09-21 20:41:53 +02:00
Riccardo Spagni
629db71593
Merge pull request #4373
4f81cd3a rpc: add cumulative difficulty in block header data (moneromooo-monero)
2018-09-21 20:40:23 +02:00
Riccardo Spagni
9d0565615c
Merge pull request #4354
03c07b16 rpc: return "already mining" in start_mining if already mining (moneromooo-monero)
2018-09-18 17:56:51 +02:00
Riccardo Spagni
0ff0850545
Merge pull request #4344
cd647612 rpc: don't include start time if restricted (moneromooo-monero)
2018-09-18 17:54:25 +02:00
Riccardo Spagni
3cfa45cc7d
Merge pull request #4317
76f95f05 rpc: allow to pass RPC login via RPC_LOGIN env var (Dusan Klinec)
2018-09-18 17:36:43 +02:00
cryptochangements34
f77ce675cb rpc: allow pruning of json encoded txs 2018-09-17 20:38:40 -04:00
moneromooo-monero
be001326d1
remove obsolete daemon selection of fake outs and old tx construction 2018-09-14 10:51:45 +00:00
moneromooo-monero
ac9346637a
rpc: add a "is an update available" flag in get_info
Make it easier for a user to be told when to update
2018-09-14 09:28:03 +00:00
moneromooo-monero
4f81cd3a3c
rpc: add cumulative difficulty in block header data 2018-09-13 12:41:59 +00:00
moneromooo-monero
5ffb2ff9b7
v8: per byte fee, pad bulletproofs, fixed 11 ring size 2018-09-11 13:38:07 +00:00
moneromooo-monero
03c07b167d
rpc: return "already mining" in start_mining if already mining 2018-09-09 15:27:30 +00:00
moneromooo-monero
cd647612b0
rpc: don't include start time if restricted 2018-09-07 13:28:40 +00:00
Dusan Klinec
76f95f052e
rpc: allow to pass RPC login via RPC_LOGIN env var
- passing by parameter is insecure as it is shown in the process list
2018-08-31 15:51:59 +02:00
Lee Clagett
4616cf2641 Fixed ZMQ-RPC for transactions and GET_BLOCKS_FAST 2018-08-02 07:30:20 +00:00
luigi1111
f6d7e87b67
Merge pull request #4075
438d52d remove epee from link lines where it's redundant (moneromooo-monero)
2018-07-19 14:10:20 -05:00
luigi1111
9315e12d34
Merge pull request #4033
3e46db9 rpc: add a non binary get_transaction_pool_hashes RPC (moneromooo-monero)
2018-07-19 13:55:37 -05:00
luigi1111
3e026ff6ed
Merge pull request #4013
e5592c4 rpc: add blockchain disk size to getinfo (moneromooo-monero)
2018-07-19 13:40:42 -05:00
luigi1111
21afa71ba6
Merge pull request #3981
45e419b db: store cumulative rct output distribution in the db for speed (moneromooo-monero)
2018-07-19 13:39:24 -05:00
luigi1111
d518dae4bf
Merge pull request #3973
50af357 alt_chain_info can now give more info about a particular alt chain (moneromooo-monero)
2018-07-19 13:37:10 -05:00