Commit Graph

541 Commits

Author SHA1 Message Date
moneromooo-monero d660f22ed1
protocol: drop origin IP if a block fails to verify in sync mode
It would otherwise be possible for a peer to send bad blocks,
then disconnect and reconnect again, escaping bans
2020-12-10 21:59:18 +00:00
moneromooo-monero 47590fc80b
rpc: report target height as 0 when synced
since it only makes sense when syncing, and it confuses people
2020-12-10 17:05:34 +00:00
Alexander Blair ce564e7ebf
Merge pull request #7030
0363476ee rpc: get_info - add 'synchronized' field (xiphon)
2020-12-04 13:21:36 -08:00
Alexander Blair 976fcb5985
Merge pull request #7024
aaf837cf5 rpc: skip non-synced bootstrap daemons in --no-sync mode too (xiphon)
2020-12-01 14:23:21 -08:00
Alexander Blair 7cd0c64210
Merge pull request #6948
65903d2cf Add rpc-restricted-bind-ip option (Howard Chu)
2020-12-01 14:21:19 -08:00
luigi1111 9945ca7a62
Merge pull request #6960
5569a8e rpc: on_send_raw_tx (bootstrap) - send to bootstrap daemon and P2P (xiphon)
2020-11-29 01:53:12 -06:00
luigi1111 bb56248acd
Merge pull request #6949
aad780b Fix CLI and unrestricted RPC relay_tx with stempool (Lee Clagett)
2020-11-29 01:52:23 -06:00
luigi1111 7539d4ac74
Merge pull request #6895
b49f489 fix next_seed_height regression in getblocktemplate rpc (xnbya)
2020-11-29 00:41:42 -06:00
luigi1111 678237835f
Merge pull request #6892
ad7ea2c core_rpc_server: on_send_raw_tx - fix bootstrap daemon mode check (xiphon)
2020-11-29 00:40:03 -06:00
xiphon 0363476ee3 rpc: get_info - add 'synchronized' field 2020-11-19 12:51:31 +00:00
xiphon aaf837cf5f rpc: skip non-synced bootstrap daemons in --no-sync mode too 2020-11-17 23:15:36 +00:00
xiphon 5569a8e426 rpc: on_send_raw_tx (bootstrap) - send to bootstrap daemon and P2P 2020-11-15 03:13:07 +00:00
Lee Clagett aad780bcfa Fix CLI and unrestricted RPC relay_tx with stempool 2020-10-29 00:17:55 -04:00
Howard Chu 65903d2cfc
Add rpc-restricted-bind-ip option
Fixes #6369
2020-10-29 00:22:18 +00:00
Alexis Enston b49f48962b fix next_seed_height regression in getblocktemplate rpc 2020-10-13 11:07:59 +01:00
xiphon 4cf3545a31 core_rpc_server: on_get_blocks - forward bootstrap daemon error 2020-10-13 00:44:59 +00:00
xiphon ad7ea2c60c core_rpc_server: on_send_raw_tx - fix bootstrap daemon mode check 2020-10-12 23:49:37 +00:00
TheCharlatan 80e535c95a
wallet2: adapt to deterministic unlock time 2020-09-15 11:40:31 +00:00
moneromooo-monero 5498142e8f
rpc: assume randomx from v13 onwards 2020-09-07 01:13:06 +00:00
Riccardo Spagni aefa7740c3
Merge pull request #6111
d20ff4f64 functional_tests: add a large (many randomx epochs) p2p reorg test (moneromooo-monero)
6a0b3b1f8 functional_tests: add randomx tests (moneromooo-monero)
9d42649d5 core: fix mining from a block that's not the current top (moneromooo-monero)
2020-09-06 15:49:37 +02:00
moneromooo-monero 9d42649d58
core: fix mining from a block that's not the current top 2020-08-27 15:13:00 +00:00
moneromooo-monero 82ee01699c
Integrate CLSAGs into monero
They are allowed from v12, and MLSAGs are rejected from v13.
2020-08-27 12:44:04 +00:00
Alexander Blair 27b49033fd
Merge pull request #6763
728ba38b1 rpc: always send raw txes through P2P (don't use bootstrap daemon) (xiphon)
2020-08-27 03:02:30 -07:00
Alexander Blair d73b1b6560
Merge pull request #6727
13eee1d6a rpc: reject wrong sized txid (moneromooo-monero)
92e6b7df2 easylogging++: fix crash with reentrant logging (moneromooo-monero)
6dd95d530 epee: guard against exceptions in RPC handlers (moneromooo-monero)
90016ad74 blockchain: guard against exceptions in add_new_block/children (moneromooo-monero)
2020-08-16 12:55:25 -07:00
xiphon 728ba38b11 rpc: always send raw txes through P2P (don't use bootstrap daemon)
It turns out that some remote (bootstrap) nodes silently drop /
don't broadcast client's transactions.
2020-08-16 17:34:28 +00:00
moneromooo-monero 13eee1d6ab
rpc: reject wrong sized txid
Reporter requested credit to be given to Decred
2020-07-30 22:52:14 +00:00
moneromooo-monero c1b03fb1a6
rpc: return empty txid get_outs rather than 00..00 when not requested
It's more obvious there's no txid, and it saves space
2020-07-25 17:01:21 +00:00
Alexander Blair a0d179e528
Merge pull request #6512
5ef0607da Update copyright year to 2020 (SomaticFanatic)
2020-07-19 03:32:59 -07:00
luigi1111 3057f52f89
Merge pull request #6599
6e4a55b rpc: fix relay_tx error return mixup (moneromooo-monero)
9b86e14 functional_tests: add simple relay_tx test (moneromooo-monero)
2020-07-08 17:20:29 -05:00
luigi1111 be170c485c
Merge pull request #6584
78d435a rpc: don't display invalid json errors on default log level (moneromooo-monero)
2020-07-08 17:12:43 -05:00
moneromooo-monero 6e4a55ba7e
rpc: fix relay_tx error return mixup 2020-05-28 11:33:27 +00:00
moneromooo-monero 78d435a5fa
rpc: don't display invalid json errors on default log level
It's not something the user needs to know, and will display
attacker controlled data
2020-05-23 12:26:49 +00:00
moneromooo-monero 4d3c2d0b7b
rpc: add a sanity limit to a few RPC in restricted mode 2020-05-20 19:17:49 +00:00
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
luigi1111 de025281dc
Merge pull request #6481
119f706 rpc: fix 'use_bootstrap_daemon_if_necessary' return value (xiphon)
2020-05-06 00:29:49 -05:00
luigi1111 ec90f9a54b
Merge pull request #6453
d2d3a81 bootstrap_daemon: fix missing virtual destructor and lambda capture (clang warning) (xiphon)
2020-05-01 15:47:47 -05:00
xiphon 119f706921 rpc: fix 'use_bootstrap_daemon_if_necessary' return value 2020-04-27 10:32:33 +00:00
xiphon d2d3a81d0e bootstrap_daemon: fix missing virtual destructor and lambda capture (clang warning) 2020-04-15 21:22:55 +00:00
luigi1111 0150a480fd
Merge pull request #6357
42a7a4d daemon: auto public nodes - cache and prioritize most stable nodes (xiphon)
2020-04-04 12:59:23 -05:00
xiphon 6d6af701ec cryptonote_basic: drop unused verification_context::m_not_rct field 2020-03-31 21:58:25 +00:00
luigi1111 94f44d4ee3
Merge pull request #6325
3627e53 rpc: fix print_pool_sh not finding local txes (moneromooo-monero)
2020-03-31 15:13:51 -05:00
luigi1111 ccc3726d86
Merge pull request #6260
320bc84 rpc: add --rpc-payment-allow-free-loopback (moneromooo-monero)
2020-03-31 13:35:16 -05:00
Lee Clagett babf25d2ec Allow unrestricted rpc calls to get full txpool info 2020-03-30 17:52:42 +00:00
Alexander Blair 8cb005b39c
Merge pull request #6289
ffe7165e wallet: reroll fake outs selection on local tx_sanity_check failure (xiphon)
2020-03-27 12:28:29 -07:00
Lee Clagett 02d887c2e5 Adding Dandelion++ support to public networks:
- New flag in NOTIFY_NEW_TRANSACTION to indicate stem mode
  - Stem loops detected in tx_pool.cpp
  - Embargo timeout for a blackhole attack during stem phase
2020-03-26 15:01:30 +00:00
moneromooo-monero 320bc845b3
rpc: add --rpc-payment-allow-free-loopback
This allows RPC coming from the loopback interface to not have
to pay for service. This makes it possible to run an externally
accessible RPC server for payment while also having a local RPC
server that can be run unrestricted and payment free.
2020-03-12 11:27:34 +00:00
Alexander Blair f3fddd935f
Merge pull request #6259
69336931 rpc: fill miner_tx_hash again (moneromooo-monero)
2020-02-28 19:51:15 -08:00
Alexander Blair 9ea7df3b31
Merge pull request #6242
716012ca rpc: drop the obsolete and wrong "unpruned size" log (moneromooo-monero)
2020-02-28 19:50:02 -08:00
Alexander Blair 4371ac4265
Merge pull request #6225
987c3139 print_coinbase_tx_sum now supports 128 bits sums (moneromooo-monero)
2020-02-28 19:48:11 -08:00
Alexander Blair e22655a187
Merge pull request #6215
a2578892 --disable-ban-rpc option to prevent RPC users from banning (naughtyfox)
2020-02-28 19:43:06 -08:00
Alexander Blair 4da37daf67
Merge pull request #6211
5985c5af rpc: add bad-blocks to flush_cache RPC (moneromooo-monero)
2020-02-28 19:36:16 -08:00
xiphon 42a7a4dd32 daemon: auto public nodes - cache and prioritize most stable nodes 2020-02-28 08:06:43 +00:00
luigi1111 39e1890276
Merge pull request #6198
5f2a32c daemon: run with -rpc-payment-address and --rpc-restricted-bind-port (moneromooo-monero)
2020-02-19 22:25:44 -05:00
moneromooo-monero 3627e53aab
rpc: fix print_pool_sh not finding local txes 2020-02-08 12:56:00 +00:00
Alexander Blair 25c1bd4714
Merge pull request #6035
b90c4bc3 rpc: error out from get_info if the proxied call errors out (moneromooo-monero)
fa16df99 make_test_signature: exit nicely on top level exception (moneromooo-monero)
054b2621 node_rpc_proxy: init some new rpc payment fields in invalidate (moneromooo-monero)
d0faae2a rpc: init a few missing client_info members (moneromooo-monero)
d56a483a rpc: do not propagate exceptions out of a dtor (moneromooo-monero)
3c849188 rpc: always set the update field in update on sucess (moneromooo-monero)
2020-02-06 00:26:13 -08:00
Alexander Blair e8f94e7f1d
Merge pull request #6173
8231c7cd rpc: fix bootstrap RPC payment RPC being made in raw JSON, not JSON RPC (moneromooo-monero)
81c26589 rpc: don't auto fail RPC needing payment in bootstrap mode (moneromooo-monero)
2020-01-24 20:19:41 -08:00
Alexander Blair 93d49c1a54
Merge pull request #6172
d7cf8727 rpc: add received_timestamp for pool txes in gettransactions (moneromooo-monero)
2020-01-24 20:17:39 -08:00
xiphon ffe7165ebf wallet: reroll fake outs selection on local tx_sanity_check failure 2020-01-14 22:56:23 +00:00
moneromooo-monero 6933693179
rpc: fill miner_tx_hash again
It was removed to save duplicated generation time, but it can
be copied from another instance instead
2019-12-20 14:16:31 +00:00
moneromooo-monero 716012ca3a
rpc: drop the obsolete and wrong "unpruned size" log
Since we now get pruned data in the first place, the "unpruned" data
size will in fact be the pruned data size, leading to confusion
2019-12-16 14:50:07 +00:00
moneromooo-monero 987c3139dc
print_coinbase_tx_sum now supports 128 bits sums
The tail emission will bring the total above 64 bits
2019-12-12 01:56:59 +00:00
naughtyfox a2578892c0 --disable-ban-rpc option to prevent RPC users from banning 2019-12-04 17:45:27 +03:00
moneromooo-monero 5985c5afe8
rpc: add bad-blocks to flush_cache RPC
Flushes m_invalid_blocks in Blockchain.
2019-12-02 18:53:30 +00:00
moneromooo-monero 5f2a32c15a
daemon: run with -rpc-payment-address and --rpc-restricted-bind-port 2019-11-29 20:07:01 +00:00
moneromooo-monero b90c4bc39e
rpc: error out from get_info if the proxied call errors out
Coverity 205410
2019-11-27 19:52:39 +00:00
moneromooo-monero d56a483abe
rpc: do not propagate exceptions out of a dtor
Coverity 205415
2019-11-27 19:52:36 +00:00
moneromooo-monero 3c849188ab
rpc: always set the update field in update on sucess
Coverity 205416
2019-11-27 19:52:33 +00:00
moneromooo-monero 8231c7cd04
rpc: fix bootstrap RPC payment RPC being made in raw JSON, not JSON RPC 2019-11-25 19:28:43 +00:00
moneromooo-monero 81c2658989
rpc: don't auto fail RPC needing payment in bootstrap mode 2019-11-22 18:12:29 +00:00
moneromooo-monero d7cf872767
rpc: add received_timestamp for pool txes in gettransactions 2019-11-22 15:53:40 +00:00
Lee Clagett 5d7ae2d279 Adding support for hidden (anonymity) txpool 2019-11-02 20:36:03 +00:00
Riccardo Spagni da31077bed
Merge pull request #6047
ebc6ce44f cryptonote: untangle dependency from miner to blockchain (moneromooo-monero)
2019-11-02 17:30:09 +02:00
moneromooo-monero ebc6ce44f4
cryptonote: untangle dependency from miner to blockchain
It causes link errors at least on mac
2019-10-31 01:06:42 +00:00
xiphon 2e2bf8a207 daemon: always use bootstrap daemon (if set) in '--no-sync' mode 2019-10-28 21:52:19 +00:00
luigi1111 ef8b3a15b4
Merge pull request #6017
5734686 rpc: Include tag in get_info version string (ndorf)
2019-10-25 20:48:04 -05:00
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 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 dc48cdc998
Merge pull request #5933
3455efa ban peers sending bad pow outright (moneromooo-monero)
2019-10-14 18:07:54 -05: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
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 7b076d5170
p2p: fix bans taking port into account 2019-09-16 22:45:45 +00: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 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
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
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 56b98c7003
Merge pull request #5728
6560bfa rpc: get_block_template add optional extra_nonce (jtgrassie)
2019-08-19 17:33:08 -05:00