<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-16&#xA;📝 Original message:You&#39;d want to create and get merged patches in the following order:&#xA;&#xA;1) Be able to store just block headers in the blkXXXX.dat files instead of&#xA;full block contents. At this point you are still *downloading* full blocks,&#xA;but they are not being stored. The contents are still sent to the wallet&#xA;for extracting relevant transactions though (see SyncWithWallets).  You&#xA;also need to disable listening and addr announcements to the P2P network at&#xA;this point. You need to be able to re-org and do all the usual things&#xA;without storing block contents. You also need to short-circuit the leveldbs&#xA;so they aren&#39;t created or used. All that needs to be unit tested. You need&#xA;to also rewrite the mempool logic so it throws out irrelevant transactions.&#xA;The RPC interface needs to adjust itself so you can&#39;t try to start mining,&#xA;query the utxo set, etc.&#xA;&#xA;At this point you have an SPV node, albeit one that still downloads the&#xA;entire block chain. However total disk storage used will be much lower.&#xA;Getting this written and reviewed is a big chunk of work but is the hardest&#xA;part. Once it&#39;s done you can breath easy.&#xA;&#xA;2) Next step, use getheaders to catch up with the chain until the&#xA;min(wallet birthdays) is reached. You can see in Satoshi&#39;s patch where he&#xA;adds support for receiving &#34;headers&#34; messages. Because key times are&#xA;recorded as dates and you don&#39;t know the dates of blocks in advance, you&#xA;need to download headers until you see one that goes past the key birthday&#xA;minus some slack period, then throw out the headers you downloaded and&#xA;switch to downloading full blocks again from that point onwards.&#xA;&#xA;3) Next step, implement client side support for Bloom filtering. Switch&#xA;from downloading full blocks to filteredblocks, verify the Merkle branches&#xA;then apply them to the wallet. Watch out for accidental re-orderings of&#xA;transactions here from block order (e.g. if you accidentally insert them&#xA;into a std::map or other unordered collection it can lead to bugs). Come up&#xA;with some way to decide on a FP rate. Probably you want a fairly high FP&#xA;rate for desktop wallets.&#xA;&#xA;4) Next step (optional), implement monitoring of broadcast propagation for&#xA;transactions that are received. SPV clients cannot verify unconfirmed&#xA;transactions so you can either just give up entirely and accept any old&#xA;garbage, or assume a non-MITMd internet connection and use network&#xA;propagation as a rough proxy for &#34;likely to be valid and mined upon&#34;.&#xA;&#xA;4) Optimize!&#xA;&#xA;How much you need to optimize really depends on a lot of things. I found&#xA;that to be competitive with Electrum/blockchain.info I had to do a ton of&#xA;optimizations including very aggressive checkpointing so new users don&#39;t&#xA;have to download more than a month or twos worth of headers, as downloading&#xA;all the headers was becoming a bottleneck. You&#39;d need to download about&#xA;16mb+ of data at the moment to grab all the headers and on a weakass mobile&#xA;phone with a weak Dalvik VM and 3G internet this was way too much. I also&#xA;had to spend some time profiling to ensure we weren&#39;t accidentally&#xA;thrashing the UI due to too-fast updates, we weren&#39;t bottlenecking on&#xA;updating last seen block data in the wallet, we weren&#39;t accidentally&#xA;de/reserializing messages redundantly etc.&#xA;&#xA;After about 3-4 evenings of non-stop profiling and optimising I ended up&#xA;with a relatively flat profile whilst doing initial catchup and chain sync.&#xA;On a desktop I bet you can get away with much less optimisation because&#xA;your CPUs, network and disk tend to be much stronger.&#xA;&#xA;&#xA;&#xA;On Tue, Jul 16, 2013 at 4:16 PM, Wendell &lt;w at grabhive.com&gt; wrote:&#xA;&#xA;&gt; Hello everyone,&#xA;&gt;&#xA;&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;&#xA;&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; -wendell&#xA;&gt;&#xA;&gt; grabhive.com | twitter.com/grabhive&#xA;&gt;&#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;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20130716/0e2c8341/attachment.html&gt;</html></oembed>