aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_peerlist.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-05-06Update copyright year to 2020SomaticFanatic1-1/+1
Update copyright year to 2020
2020-03-27Merge pull request #6295Alexander Blair1-4/+4
bcae95a2 p2p: do not add recently failed addresses to the peerlist (moneromooo-monero)
2020-03-20p2p: remove old debug commandsAaron Hook1-0/+1
2020-03-20p2p: do not add recently failed addresses to the peerlistmoneromooo-monero1-4/+4
2020-01-29p2p: avoid sending the same peer list over and overmoneromooo-monero1-3/+3
Nodes remember which connections have been sent which peer addresses and won't send it again. This causes more addresses to be sent as the connection lifetime grows, since there is no duplication anymore, which increases the diffusion speed of peer addresses. The whole white list is now considered for sending, not just the most recent seen peers. This further hardens against topology discovery, though it will more readily send peers that have been last seen earlier than it otherwise would. While this does save a fair amount of net bandwidth, it makes heavy use of std::set lookups, which does bring network_address::less up the profile, though not too aggressively.
2019-10-25daemon, wallet: new pay for RPC use systemmoneromooo-monero1-2/+3
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-08-19Merge pull request #5727luigi11111-1/+1
7b9a420 Replace std::random_shuffle with std::shuffle (tomsmeding)
2019-08-15Merge pull request #5682luigi11111-0/+3
3768db2 p2p: add a reference to Cao, Tong et al. for the last_seen changes (moneromooo-monero)
2019-08-15Replace std::random_shuffle with std::shuffleTom Smeding1-1/+1
According to [1], std::random_shuffle is deprecated in C++14 and removed in C++17. Since std::shuffle is available since C++11 as a replacement and monero already requires C++11, this is a good replacement. A cryptographically secure random number generator is used in all cases to prevent people from perhaps copying an insecure std::shuffle call over to a place where a secure one would be warranted. A form of defense-in-depth. [1]: https://en.cppreference.com/w/cpp/algorithm/random_shuffle
2019-06-26p2p: don't forget pruning seed or public RPC port when updating peersmoneromooo-monero1-4/+16
Older nodes don't pass that information around
2019-06-21p2p: add a reference to Cao, Tong et al. for the last_seen changesmoneromooo-monero1-0/+3
"Exploring the Monero Peer-to-Peer Network". https://eprint.iacr.org/2019/411
2019-04-24p2p: do not send last_seen timestamp to peersmoneromooo-monero1-8/+25
This can be used for fingerprinting and working out the network topology. Instead of sending the first N (which are sorted by last seen time), we sent a random subset of the first N+N/5, which ensures reasonably recent peers are used, while preventing repeated calls from deducing new entries are peers the target node just connected to. The list is also randomly shuffled so the original set of timestamps cannot be approximated.
2019-04-04crypto: replace rand<T>()%N idiom with unbiased rand_idx(N)stoffu1-1/+1
2019-03-17Merge pull request #5190Riccardo Spagni1-2/+3
551104fb daemon: add --public-node mode, RPC port propagation over P2P (xiphon)
2019-03-05Update 2019 copyrightbinaryFate1-1/+1
2019-02-25daemon: add --public-node mode, RPC port propagation over P2Pxiphon1-2/+3
2019-01-28Adding initial support for broadcasting transactions over TorLee Clagett1-125/+49
- 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-22Pruningmoneromooo-monero1-2/+34
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.
2018-12-07p2p: use vector instead of list for peer listsmoneromooo-monero1-6/+9
2018-01-26Update 2018 copyrightxmr-eric1-1/+1
2017-12-16cryptonote_core does not depend on p2p anymoremoneromooo-monero1-2/+0
As a followon side effect, this makes a lot of inline code included only in particular cpp files (and instanciated when necessary.
2017-09-25net_peerlist: remove dead codemoneromooo-monero1-20/+1
CID 175290
2017-05-27abstracted nework addressesmoneromooo-monero1-24/+54
All code which was using ip and port now uses a new IPv4 object, subclass of a new network_address class. This will allow easy addition of I2P addresses later (and also IPv6, etc). Both old style and new style peer lists are now sent in the P2P protocol, which is inefficient but allows peers using both codebases to talk to each other. This will be removed in the future. No other subclasses than IPv4 exist yet.
2017-05-05Merge pull request #1701Riccardo Spagni1-3/+80
8277e67f Add anchor connections (Miguel Herranz)
2017-02-27Make get_random_gray_peer distribution uniformMiguel Herranz1-5/+2
get_random_gray_peer is used to implement feeler connections, described in: https://eprint.iacr.org/2015/263.pdf 2. Random selection
2017-02-21update copyright year, fix occasional lack of newline at line endRiccardo Spagni1-1/+1
2017-02-10Add anchor connectionsMiguel Herranz1-3/+80
Based on https://eprint.iacr.org/2015/263.pdf 4. Anchor connections. Peer list serialisation version bumped to 5.
2017-02-02Merge pull request #1617Riccardo Spagni1-5/+5
0644eed7 Remove boost/foreach.cpp includes (Miguel Herranz) 36dd3e23 Replace BOOST_REVERSE_FOREACH with ranged for (Miguel Herranz) 629e3101 Replace BOOST_FOREACH with C++11 ranged for (Miguel Herranz)
2017-01-23Remove unreachable returnsMiguel Herranz1-3/+0
CATCH_ENTRY_L0 already returns the second value.
2017-01-22Remove boost/foreach.cpp includesMiguel Herranz1-1/+0
2017-01-22Replace BOOST_REVERSE_FOREACH with ranged forMiguel Herranz1-3/+4
2017-01-22Replace BOOST_FOREACH with C++11 ranged forMiguel Herranz1-1/+1
2017-01-21Rename method to get_random_gray_peerMiguel Herranz1-3/+3
2017-01-21Add gray peer list housekeeping systemMiguel Herranz1-0/+46
A random peer from the gray peer list is selected and a connection is made to check if the peer is alive. If the connection and handshake are successful the peer is promoted to the white peer list, in case of failure the peer is evicted from the gray peer list. The connection is closed after the check in either case.
2017-01-18Honor depth in get_peerlist_head methodMiguel Herranz1-2/+4
The method returned depth + 2 because: - push_back was executed before the condition. - > instead of >= causing one more iteration.
2016-12-20also use portable serializer for boost_serialization_helper.h and ↵kenshi841-1/+2
net_node.inl, completely adandon boost/archive/binary_oarchive.hpp
2015-12-31updated copyright yearRiccardo Spagni1-1/+1
2015-12-30net_peerlist: move a couple functions from public to privatemoneromooo-monero1-2/+2
They do not take the object lock, and are meant to be used only internally, called from a function which does take the lock.
2015-11-23Add IP blocking for misbehaving nodes (adapted from Boolberry)Javier Smooth1-1/+2
With minor cleanup and fixes (spelling, indent) by moneromooo
2015-05-28net_peerlist: fix grayt/white naming mismatchmoneromooo-monero1-2/+2
Looking at how these are called confirms this must have been a mistake
2015-01-02year updated in licenseRiccardo Spagni1-1/+1
2014-09-15Fix time_t serialization issueZachary Michaels1-2/+2
On 32-bit MinGW-w64, time_t is int32_t. The existing code was serializing time_t directly and implicitly assuming that time_t is int64_t. This commit formalizes that assumption by serializing int64_t directly and casting to time_t where appropriate. Thanks go to greatwolf for reporting this issue. monero-project/bitmonero#88
2014-07-23License updated to BSD 3-clausefluffypony1-3/+29
2014-03-20some fixesAntonio Juarez1-6/+2
2014-03-03moved all stuff to githubAntonio Juarez1-0/+375