<oembed><type>rich</type><version>1.0</version><author_name>npub17ty4mumkv43w8wtt0xsz2jypck0gvw0j8xrcg6tpea25z2nh7meqf4qgyd</author_name><author_url>https://nostr.ae/npub17ty4mumkv43w8wtt0xsz2jypck0gvw0j8xrcg6tpea25z2nh7meqf4qgyd</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2013-07-17&#xA;📝 Original message:Partial UTXO sets is a neat idea. Unfortunately my intuition is that many&#xA;SPV wallets only remain open for &lt;1 minute at a time because the user wants&#xA;to see they received money, or to send it. It&#39;d be neat to get some&#xA;telemetry from the Android wallet for this - I will ask Andreas to let&#xA;users opt in to usage statistics.&#xA;&#xA;So for anti-DoS I think smart prioritisation heuristics are the way to go&#xA;again. Perhaps by letting clients have an &#34;identity&#34; that they provide to a&#xA;node when it&#39;s load shedding. Clients that have been seen before, have a&#xA;track record of not being abusive etc get priority and new clients that&#xA;were never seen before get dropped. Coming up with a way to do that whilst&#xA;preserving privacy sounds like an interesting cryptographic challenge.&#xA;&#xA;&#xA;On Wed, Jul 17, 2013 at 12:58 PM, Peter Todd &lt;pete at petertodd.org&gt; wrote:&#xA;&#xA;&gt; On Tue, Jul 16, 2013 at 04:16:23PM +0200, Wendell wrote:&#xA;&gt; &gt; Hello everyone,&#xA;&gt; &gt;&#xA;&gt; &gt; In the previous thread, I expressed interest in seeing an SPV bitcoind,&#xA;&gt; further stating that I would fund such work. Mike Hearn followed up with&#xA;&gt; some of Satoshi&#39;s old code for this, which is now quite broken. The offer&#xA;&gt; and interest on my side still stand, as more diversity in SPV options seems&#xA;&gt; like the right way to go.&#xA;&gt; &gt;&#xA;&gt; &gt; Time-permitting, I would really appreciate feedback from knowledgable&#xA;&gt; parties about the possible approaches to an SPV bitcoind. We at Hive&#xA;&gt; ideally want to see something that could one be merge into master, rather&#xA;&gt; than a fork.&#xA;&gt;&#xA;&gt; Keep in mind that SPV mode is newer than many realize: bloom filters are&#xA;&gt; a 0.8 feature, itself released only last Febuary. As John Dillon posted&#xA;&gt; earlier this week in &#34;Protecting Bitcoin against network-wide DoS&#xA;&gt; attack&#34; the Bitcoin codebase will have to implement much better anti-DoS&#xA;&gt; attack defences soon, and in a decentralized system there aren&#39;t any&#xA;&gt; options other than requiring peers to either do work (useful or not) or&#xA;&gt; sacrifice something of value. SPV peers can&#39;t do useful work, leaving&#xA;&gt; only sacrifice - to what extent and how much is unknown. In addition SPV&#xA;&gt; nodes have serious privacy issues because their peers know that any&#xA;&gt; transaction sent to them by the SPV node is guaranteed to be from the&#xA;&gt; node rather than relayed; bloom filters are only really helpful with&#xA;&gt; payment protocols that don&#39;t exist yet and don&#39;t apply to merchants.&#xA;&gt; Then you have MITM problems, vulnerability to fake blocks etc.&#xA;&gt;&#xA;&gt; It&#39;ll be awhile before we know how serious these issues are in practice,&#xA;&gt; and we&#39;re likely to find new issues we didn&#39;t think of too. In any case&#xA;&gt; Bitcoin is far better off if we make it easy to run a full node,&#xA;&gt; donating whatever resources you can. Fortunately there&#39;s a whole&#xA;&gt; continuum between SPV and full nodes.&#xA;&gt;&#xA;&gt; The way you do this is by maintaining partial UTXO sets. The trick is&#xA;&gt; that if you have verified every block in some range i to j, every time&#xA;&gt; you see a txout created by a transaction, and not subsequently spent,&#xA;&gt; you can be sure that at height j the txout existed. If height j is the&#xA;&gt; current block, you can be sure the txout exists provided that the chain&#xA;&gt; itself is valid. Any transaction that only spends txouts in this partial&#xA;&gt; set is a transaction you can fully verify and safely relay; for other&#xA;&gt; transactions you just don&#39;t know and have to wait until you see them in&#xA;&gt; a block.&#xA;&gt;&#xA;&gt; So what&#39;s useful about that? Basically it means your node starts with&#xA;&gt; the same security level, and usefulness to the network, as a SPV node.&#xA;&gt; But over time you keep downloading blocks as they are created, and with&#xA;&gt; whatever bandwidth you have left (out of some user-configurable&#xA;&gt; allocation) you download additional blocks going further and further&#xA;&gt; back in time. Gradually your UTXO set becomes more complete, and over&#xA;&gt; time you can verify a higher and higher % of all valid transactions.&#xA;&gt; Eventually your node becomes a full node, but in the meantime it was&#xA;&gt; still useful for the user, and still contributed to the network by&#xA;&gt; relaying blocks and an increasingly large subset of all transactions.&#xA;&gt; (optionally you can store a subset of the chain history too for other&#xA;&gt; nodes to bootstrap from) You&#39;ve also got better security because you&#xA;&gt; *are* validating blocks, starting off incompletely, and increasingly&#xA;&gt; completely until your finally validating fully. Privacy is improved, for&#xA;&gt; both you and others, by mixing your transactions with others and adding&#xA;&gt; to the overall anonymity set.&#xA;&gt;&#xA;&gt; In the future we&#39;ll have miners commit a hash of the UTXO set, and that&#xA;&gt; gives us even more options to, for instance, have relayed transactions&#xA;&gt; include proof that their inputs were valid, allowing all nodes to relay&#xA;&gt; them safely.&#xA;&gt;&#xA;&gt;&#xA;&gt; As for specifics, you need to maintain a UTXO set, and in addition a set&#xA;&gt; of spent txouts (the STXO set) for which you haven&#39;t seen the&#xA;&gt; transaction that created the txout. As download newer blocks you update&#xA;&gt; the UTXO set; as you download older blocks you update the UTXO set and&#xA;&gt; STXO set.&#xA;&gt;&#xA;&gt; Nodes now advertise this new variable to their peers:&#xA;&gt;&#xA;&gt; nOldestBlock - The oldest block that we&#39;ve validated. (and all&#xA;&gt; subsequent blocks)&#xA;&gt;&#xA;&gt; We&#39;ll also want the ability to advertise what sub-ranges of the&#xA;&gt; blockchain data we have on hand:&#xA;&gt;&#xA;&gt; listArchivedBlockRanges - lists of (begin, end pairs)&#xA;&gt;&#xA;&gt; Nodes should drop all but the largest n pairs, say 5 or something. The&#xA;&gt; index -1 is reserved to indicate the last block to make it easy to&#xA;&gt; advertise that you have every block starting at some height to the most&#xA;&gt; recent. (reserving -n with n as the last block might be a better choice&#xA;&gt; to show intent, but still allow for specific proofs when we get node&#xA;&gt; identities)&#xA;&gt;&#xA;&gt; We probably want to define a NODE_PARTIAL service bit or something; I&#39;ll&#xA;&gt; have to re-read Pieter Wuille&#39;s proposal and think about it. Nodes&#xA;&gt; should NOT advertize NODE_NETWORK unless they have the full chain and&#xA;&gt; have verified it.&#xA;&gt;&#xA;&gt; Nodes with partial peers should only relay transactions to those peers&#xA;&gt; if the transactions spend inputs the peers know about - remember how&#xA;&gt; even an SPV node has that information if it&#39;s not spending unconfirmed&#xA;&gt; inputs it didn&#39;t create. Nodes will have to update their peers&#xA;&gt; periodically as nOldestBlock changes. That said it may also be&#xA;&gt; worthwhile to simply relay all transactions in some cases too - a&#xA;&gt; reasonable way to approach this might be to set a bloom filter for tx&#39;s&#xA;&gt; that you *definitely* want, and if you are interested in everything,&#xA;&gt; just set the filter to all 1&#39;s. If someone comes up with a reasonable&#xA;&gt; micropayment or proof-of-work system even relaying txs that you haven&#39;t&#xA;&gt; validated is fine - the proof-of-work and prioritization will prevent&#xA;&gt; DoS attacks just fine.&#xA;&gt;&#xA;&gt; Remember that if you&#39;re running a partial node, it can get new blocks&#xA;&gt; from any partial node, and it can retrieve historic blockchain data from&#xA;&gt; any partial node that has archived the sequence of blocks you need next.&#xA;&gt; On a large scale this is similar to how in BitTorrent you can serve data&#xA;&gt; to your peers the moment you get it - a significant scalability&#xA;&gt; improvement for the network as a whole. Even if a large % of the network&#xA;&gt; was partial nodes running for just a few hours a day the whole system&#xA;&gt; would work fine due to how partial nodes can serve each other the data&#xA;&gt; they need.&#xA;&gt;&#xA;&gt; On startup you can act as a SPV node temporarily, grabbing asking for&#xA;&gt; filtered blocks matching your wallet, and then go back and get the full&#xA;&gt; blocks, or just download the full blocks right away. That&#39;s a tradeoff&#xA;&gt; on how long the node has been off.&#xA;&gt;&#xA;&gt; Anyway, it&#39;s a bit more code compared to pure-SPV, but it results in a&#xA;&gt; much more scalable Bitcoin, and if you can spare the modest bandwidth&#xA;&gt; requirements to keep up with the blockchain it&#39;ll result in much better&#xA;&gt; robustness against DoS attacks for you and Bitcoin in general.&#xA;&gt;&#xA;&gt; --&#xA;&gt; &#39;peter&#39;[:-1]@petertodd.org&#xA;&gt;&#xA;&gt;&#xA;&gt; ------------------------------------------------------------------------------&#xA;&gt; See everything from the browser to the database with AppDynamics&#xA;&gt; Get end-to-end visibility with application monitoring from AppDynamics&#xA;&gt; Isolate bottlenecks and diagnose root cause in seconds.&#xA;&gt; Start your free trial of AppDynamics Pro today!&#xA;&gt; http://pubads.g.doubleclick.net/gampad/clk?id=48808831&amp;iu=/4140/ostg.clktrk&#xA;&gt; _______________________________________________&#xA;&gt; Bitcoin-development mailing list&#xA;&gt; Bitcoin-development at lists.sourceforge.net&#xA;&gt; https://lists.sourceforge.net/lists/listinfo/bitcoin-development&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20130717/98b856c4/attachment.html&gt;</html></oembed>