<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by bchd on Medium]]></title>
        <description><![CDATA[Stories by bchd on Medium]]></description>
        <link>https://medium.com/@bchd.cash?source=rss-992e6fa001b4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YmZqC6Aof7O0hdn7HShFyw.png</url>
            <title>Stories by bchd on Medium</title>
            <link>https://medium.com/@bchd.cash?source=rss-992e6fa001b4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:50:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bchd.cash/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Good vs Bad APIs: Bitcoin Edition]]></title>
            <link>https://medium.com/@bchd.cash/good-vs-bad-apis-bitcoin-edition-69edfaa1fa5d?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/69edfaa1fa5d</guid>
            <category><![CDATA[bitcoincash]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Tue, 10 Dec 2019 18:27:52 GMT</pubDate>
            <atom:updated>2019-12-10T20:13:24.827Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZjI-zfkvTQkiCAa7bUPlNQ.png" /></figure><p>Part of the reason I started the bchd project (a Bitcoin Cash full node written in Go) is because I’ve had lots of experience using indexing blockchain servers and have intimate knowledge of just how awful most of them are. I wanted to create a server that <em>I</em> wanted use. Hence, bchd was born.</p><p>Recently I’ve had the displeasure of rewriting some of the wallet code for my day job and this created an excellent opportunity for a compare and contrast with bchd.</p><p>The codebase in question is designed to handle wallets for multiple coins. Hence we needed a blockchain server that could handle multiple coins. We ultimately ended up settling on Trezor’s Blockbook server. It’s more or less a Go version of the Insight server with a mostly compatible Insight API. Though it’s not as crappy as Insight (but not substantially better either, unfortunately).</p><p>But while I have no choice but to use Blockbook for BTC, LTC, ZEC, DASH etc, for BCH I’m using the bchd gRPC API which I wrote. Why not right?</p><p>In what follows I hope you’ll get the picture of just how much better bchd is than everything else. It’s almost as if the current offerings were written by people who never wrote anything actually using a blockchain server.</p><p><strong>GetBlockchainInfo</strong></p><p>OK time for API call number one. GetBlockchainInfo is a basic API call which queries the server and tries to get back:<br>1. The best block hash<br>2. The best block height<br>3. The timestamp of the best block<br>4. The hash of the previous block</p><p>In bchd this was dirt simple and took only about 30 seconds. Not only is the <a href="https://github.com/gcash/bchd/blob/master/bchrpc/bchrpc.proto">bchrpc.proto </a>file the canonical API documentation, but simply importing the client libraries into my project allows my IDE to show me exactly what API calls are available and what data they take in and return.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*xNVkIRu3u2fjilGe-vRObQ.png" /></figure><p>With Blockbook I spent about 15 minutes hunting down API documentation which is notoriously poor for Insight. Eventually I gave up and just decided to look directly at the Blockbook server code to figure out what API calls are available and how to craft the request. All told it took around 40 minutes to write the following function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*7SWl6CklnS8vAFmid4y0RQ.png" /></figure><p>Notice not only is this more lines of code, but because the API call to get the previous block’s hash only accepts a height and not a hash, there is a non-zero probability that it will return the wrong previous hash. If a reorg happens between my API calls, the second API call may return the previous hash for a different block. This is rather unlikely but still non-zero and my code has no way of handling it or even knowing this happened. Again, very poor API design.</p><p><strong>IsBlockInMainChain</strong></p><p>I have the wallet(s) persist the height and hash of the tip of the chain to disk. On start up it loads the previously known best hash and checks to see if that block is still in the main chain. If it isn’t it assumes a reorg happened while the app was shut down and does a more thorough rescan of its transactions. This is supposed to be a bandwidth saving measure. If no reorg has happened we only need to download transactions that happened since our last known block. But as we will see, due to poor API design, it doesn’t end up saving us any bandwidth at all.</p><p>Once again, it took only about 30 seconds to write the bchd function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*9lglpWzUIeFplqITvp6NwQ.png" /></figure><p>But with Blockbook I spent about another half hour looking for an API call similar to bchd’s GetBlockInfo. This should just return some block metadata and that’s it.</p><p>But guess what? No such endpoint exists for Blockbook! The closest thing is GetBlock but it returns a full “page” worth of transactions of transactions in addition to the metadata with no option to disable sending transactions. This could be up to 1000 JSON transactions! Did the authors not think a block metadata endpoint would ever be needed?</p><p>Here’s the corresponding Blockbook function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*WRJDg2odLia4YrRggjXw-Q.png" /></figure><p>So my bandwidth saving method ends up taking 4.5kB on each start up!</p><p>Ultimately I was sure there had to be some kind of workaround for this and I spent another hour pouring over the Blockbook code and found a hacky way to accomplish my goal without using 4.5kB of bandwidth.</p><p>But still, great dev experience!</p><p><strong>SubscribeTransactions/Blocks</strong></p><p>With these API calls I need the server to stream blocks and transactions to me as they come in. Again, bchd handles this functionality really well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*UASutszir9FMy7ikVMPrww.png" /></figure><p>Blockbook, no so much. Blockbook/Insight use socket.io, a protocol layer on top of websockets, for pushing data to subscribers.</p><p>The documentation on how to use this is even more poor than the standard REST API. You should be prepared to block out an entire day or longer to figure out how to use this.</p><p>In Go it turns out that the main socket.io library on github only implements a socket.io server and not client functionality. For client functionality I had to use a lesser used, unmaintained library. And even here it took me ungodly long to figure out that the the library doesn’t even support formatting data as an array. So guess what? I had to fork the library to put in my patches and now I’m the maintainer of a socket.io client library. Just what I always wanted!</p><p>Further, I had to write a custom transport implementation for this library to allow me to proxy socket connections over Tor as that behavior was not part of the library.</p><p>So yeah, be prepared to spend <em>days</em> trying to implement streaming blocks and transactions.</p><p>So this is just a taste of what cryptocurrency developers have to deal with when using the current blockchain server offerings. They all appear to be written by people who have never actually had to <em>use</em> a blockchain server before.</p><p>Thankfully the bchd gRPC API <em>is</em> written by people who have had to go through all of this and it will be a major time saver if you’re developing any Bitcoin Cash applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69edfaa1fa5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing the bchd gRPC API]]></title>
            <link>https://medium.com/@bchd.cash/announcing-the-bchd-grpc-api-16b3a833292e?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/16b3a833292e</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[bitcoincash]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Fri, 03 May 2019 11:46:03 GMT</pubDate>
            <atom:updated>2019-05-03T13:36:38.282Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*o1V7l18drCziSbACXrwGUw.png" /></figure><p>The release of bchd 0.14.3 brings with it a long awaited feature, a public API, which makes bchd one of the top indexing blockchain servers in the Bitcoin Cash ecosystem.</p><p>For a little background most full node implementations, such as Bitcoin-Core, Bitcoin-ABC, or Bitcoin-Unlimited, only compute and store the bare minimum data necessary to maintain a local wallet. They typically do not compute and store enough data to serve applications such as wallets, block explorers, or the myriad of other applications built on top of Bitcoin Cash.</p><p>For this functionality developers typically turn to indexing servers, such as Bitpay’s Insight server. These servers are typically extra software that needs to be installed on top of the full node and which connects to it computes the required indexes and serves the data via a public API.</p><p>Developers who have worked with these servers can attest that they often leave much to be desired. They tend to be difficult to install, run, and keep running in a production environment. Further the APIs exposed by these servers are not that great. Insight uses a REST API for some types of data but then requires the use of WebSockets and socket.io for others. Libbitcoin uses ZMQ! Which requires developers to import a large C dependency. Electrum servers use a clunky and cumbersome stratum API. And so on.</p><p>With bchd Bitcoin Cash developers have an out-of-the-box solution that just works. You simply download the <a href="https://github.com/gcash/bchd/releases">binary</a> and run it. That’s it!</p><pre>bchd --txindex --addrindex --grpclisten=0.0.0.0</pre><p>You can checkout the <a href="https://github.com/gcash/bchd/tree/master/bchrpc/documentation">documentation</a> for more advanced usage.</p><p>While prior releases of bchd had indexing ability, the data was not exposed to users in a way that was easily accessible. That has changed with the introduction of the <a href="https://github.com/gcash/bchd/tree/master/bchrpc">gRPC API</a>.</p><p>You may be asking why gRPC? Or maybe even what <em>is</em> gRPC?</p><p>gRPC is a new RPC framework created by Google that offers many advantages over the legacy JSON-RPC used in the our ecosystem as well as over various REST/WebSocket APIs.</p><p>To be brief:</p><ul><li>No more hunting down API documentation or dealing with poorly documented APIs — .<a href="https://github.com/gcash/bchd/blob/master/bchrpc/bchrpc.proto">proto</a> is the canonical format for API contracts.</li><li>No more hand-crafted JSON call objects — all requests and responses are strongly typed and code-generated, with hints available in the IDE.</li><li>No more dealing with methods, headers, body and low level networking — everything is handled by gRPC.</li><li>No more second-guessing the meaning of error codes — <a href="https://godoc.org/google.golang.org/grpc/codes">gRPC status codes</a> are a canonical way of representing issues in APIs.</li><li>No more one-off server-side request handlers to avoid concurrent connections — gRPC is based on HTTP2, with multiplexes multiple streams over the <a href="https://hpbn.co/http2/#streams-messages-and-frames">same connection</a>. So no more head-of-line blocking.</li><li>No more problems streaming data from a server — gRPC supports both <em>1:1</em> RPCs and <em>1:many</em> streaming requests. No more awkward REST/WebSocket combo APIs.</li><li>No more data parse errors when rolling out new binaries — <a href="https://developers.google.com/protocol-buffers/docs/gotutorial#extending-a-protocol-buffer">backwards and forwards-compatibility</a> of requests and responses.</li><li>No need to write ANY client code as the protoc compiler will auto-generate client libraries, including wire serialization and deserialization code, for just about every major language. The compiler writes thousands of lines of code so you don’t have to.</li></ul><p>We currently have a public bchd server running atbchd.greyh.at:8335. Feel free to try it out!</p><p>The following video is a tutorial for how to use the new API and also a general introduction to gRPC for developers.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8oKUQPKCyRg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8oKUQPKCyRg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F8oKUQPKCyRg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/537abb2eebcee02da80c3995b34f02aa/href">https://medium.com/media/537abb2eebcee02da80c3995b34f02aa/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16b3a833292e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bchd 2019 Roadmap]]></title>
            <link>https://medium.com/@bchd.cash/bchd-2019-roadmap-a6f7371fe76f?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6f7371fe76f</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[bitcoincash]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Fri, 04 Jan 2019 00:19:12 GMT</pubDate>
            <atom:updated>2019-01-04T00:19:12.839Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*1_S3I04E2DdoD3Ht.png" /></figure><p>2018 was a productive year for the bchd project. Not only were we able to fork btcd and update it with the entire Bitcoin Cash ruleset, but we were able to make quite a few improvements well above what btcd had to offer and check off a number of items from our wish list in the process.</p><p>In 2019 we plan to build on that progress and make bchd into one of the most feature rich node implementations that Bitcoin Cash has to offer. The following is our plans for both the bchd blockchain server and bchwallet.</p><h3>bchd</h3><p><strong>Remain in Consensus<br></strong>Bitcoin Cash will likely do two hardforks again this year and our number one priority is to implement the rule changes in a timely manner so that everyone has plenty of time to upgrade. For May most of the proposed changes look like they will be fairly trivial to implement with the lone exception of Schnorr signatures which will require a native Go implementation that is going to need lots of thorough review.</p><p><strong>Compact Blocks / Graphene / XThinner<br></strong>One of the remaining issues that we inherited from btcd is that there is no block compression implemented. We’ve made some progress implementing compact blocks already but we hope to be able to have Graphene or XThinner (maybe both) implemented this year as well.</p><p><strong>gRPC API<br></strong>The legacy jsonrpc API is a little crufty and annoying to work with. Our plan is to create a much more modern API based on gRPC. Once this is implemented we believe bchd will be the best backend option for applications which need access to blockchain data. This will include the ability to download SPV proofs so that developers can use it to build server-based SPV wallets.</p><p><strong>Double Spend Proofs<br></strong>Once a specification for double spend proofs is finalized and agreed upon we’ll implement it in bchd. This work will include all the functionality necessary to use the proofs in applications including a streaming API, bloom filtering support and support for neutrino based wallets.</p><p><strong>QUIC<br></strong>QUIC is a new transport protocol created by google to improve on the shortcomings of TCP. Sometime this year we’re going to enable QUIC as a transport option along side TCP and likely make it the default transport used for connecting to other bchd nodes. One of the main benefits to QUIC is we finally get encrypted and authenticated connections using TLS 1.3 so SPV wallets which connect to bchd nodes and use QUIC will receive a nice privacy and security boost.</p><h3>bchwallet</h3><p>The following is on our roadmap for the bchwallet wallet software which can either connect to a bchd full node via the API or operate in neutrino SPV mode.</p><p><strong>BIP70 Support<br></strong>We’re going to add support for both paying BIP70 payment requests as well as creating and serving payment requests to other wallets. The goal here is for bchwallet to eventually be a solid choice as a backend for merchant point-of-sale software.</p><p><strong>Double Spend Detection<br></strong>Making use of the double spend proofs described above, we’re going to make the software detect double spends and notify the user. Again, this is critical functionality for any pure BCH point-of-sale solution.</p><p><strong>Stealth Addresses<br></strong>This feature has been one of the most requested features for quite a while so it makes sense to provide it as an option in bchwallet. We recently changed how bchd builds the GCS filters used by neutrino to be more liberal with OP_RETURN so even neutrino wallets will be able to use this feature.</p><p><strong>Payment Channels</strong><br>In a previous <a href="https://medium.com/@bchd.cash/bitcoin-cash-overlay-network-22160011f7ee">post</a> we alluded to some preliminary work that has been done on payment channels. We’re going to need to wait until after the May hardfork to fix malleability before this code will be usable but the goal here is to provide a bi-directional functionality within the software and the necessary APIs to use it.</p><p>That’s it. If any of these features interests you enough to want to work on them please get in touch. We appreciate all the help we get!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6f7371fe76f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling Neutrino With CTOR]]></title>
            <link>https://medium.com/@bchd.cash/scaling-neutrino-with-ctor-903e96950d56?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/903e96950d56</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[bitcoincash]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Mon, 24 Dec 2018 15:39:00 GMT</pubDate>
            <atom:updated>2018-12-24T19:55:23.913Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kDYFlfwKvmtx_cxsiPqzg.png" /></figure><p>In a previous <a href="https://medium.com/@bchd.cash/announcing-neutrino-wallet-for-bitcoin-cash-eb7a85a49c0e">post</a> we introduced you to the Neutrino wallet, a lightweight SPV wallet with strong network level privacy (which is a port of the excellent work done by BTC devs including roasbeef). Past attempts to build SPV wallets tried to use bloom filters to protect user privacy but it turns out that it’s basically impossible to use bloom filters in such a way that it doesn’t leak most of the information about the addresses in your wallet to the nodes that you connect to.</p><p>Neutrino works similar to a normal SPV wallet in that it downloads the full chain of headers from genesis (or a later checkpoint). But rather than constructing a bloom filter containing all the addresses in the wallet and giving the filter to each node it’s connected to, the nodes are expected to instead construct a GCS (Golomb-Coded Set) filter for each block which serves as compact representation of all of the transactions in the block.</p><p>In addition to downloading the header chain neutrino downloads the filter for each block and tests each address against the filter wallet side to see if there are any matches. If there is a match, the neutrino wallet downloads the corresponding full block and parses it for its transaction(s). By doing the filtering wallet side rather than server (full node) side we can eliminate leaking information about our addresses to our peers and gain a much need privacy boost.</p><h3>Neutrino At Scale</h3><p>The primary downside to this approach is neutrino can be expected to use more bandwidth than a normal SPV because it occasionally downloads a full block. Today the amount of bandwidth neutrino uses is fairly trivial but in the future, when the average block size is much larger, it could be much more substantial. However, even at medium-large block sizes, say 128 MB, you’d be surprised to find that a mobile phone with a typical mobile data plan would likely still have enough bandwidth to run neutrino and have bandwidth left over to browse the internet. And, of course, you could always synchronize your wallet with the network when you’re connected to WiFi so you don’t waste your mobile data.</p><p>But looking past 128 MB we will likely start to have a big problem with bandwidth usage, especially for mobile wallets. Gigabyte blocks would likely be too much for a typical mobile device to process unless mobile bandwidth has increased substantially between now and whenever the network starts processing blocks of that size.</p><p>So does this mean that at some point neutrino is expected to stop working and we have to go back to the old way of doing SPV with poor privacy? Not necessarily.</p><h3>Downloading Partial Blocks</h3><p>Instead of downloading the full block every time we get a filter match we could instead request that our remote peers send us only the transactions in the block with transactions IDs within a given range. For example we could request the range {0x11…, 0x33…} and we would download roughly 12.5% of the block instead of the full block. The remote peer could also give us the SPV proofs for each transaction to prove to us that these transactions are indeed in the block.</p><p>But if this is all we do, we have a problem. The remote peers can more or less lie to us by omitting certain transactions from their response. Today this type of lie-by-omission is not possible in neutrino because we download the full block. Hence we’re guaranteed to see everything. But when downloading a partial block we re-introduce the ability of peers to lie by omission.</p><p>One possible solution is to just download the partial block from as many peers as possible so it is less likely that we’ve missed one of our transactions, however doing so would give right back whatever bandwidth savings we acquired by downloading a partial block in the first place. Not to mention we’d rather the system be based on cryptographic proof rather than trust that our peers are not withholding transactions.</p><p>This is where CTOR comes in. Because the last Bitcoin Cash upgrade now requires transactions in the block to be ordered by transaction ID, it is possible for the remote peer to give us cryptographic proof that no transactions were omitted from the portion of the block that we requested. Thus we don’t have query multiple peers for a partial block and can recognize a significant bandwidth savings.</p><h3>Partial Blocks With Neutrino</h3><p>Because blocks are sorted by transaction ID we’d need to know the IDs of the transactions we’re interested in. For outgoing spends this obviously works since we know the ID of all of the transactions that we personally create (assuming third-party malleability is fixed). But we’d still need to know the ID of our incoming transactions.</p><p>One possibility here is to have senders of transactions push their transaction directly to the recipient the same or similar way to how BIP70 currently works. The downside is doing so introduces additional networking difficulties but the upshot would be we would learn of all of our incoming transaction IDs which we could then use to download partial blocks. Receiving our transactions out of band would also dramatically reduce our bandwidth requirement as well as we would no longer have to listen on the network for unconfirmed transactions.</p><p>An alternative approach is we could have the sender of the transaction brute force the transaction ID to be within a requested range. This simplifies the networking but at the expense of a large increase the bandwidth requirement and it would erode privacy somewhat.</p><h3>Restoring From Seed</h3><p>The main downside to downloading partial blocks by transaction ID is you cannot restore a wallet from seed using this technique.</p><p>This might not be <em>that</em> big of a deal, however, as you could always still restore a wallet from seed by downloading full blocks as this isn’t something that you’d be expected to do very often. The wallet could simply tell you that you need to be connected to WiFi to perform the restore and that it is expected to take a while.</p><p>Alternatively you could use a cloud backup service from your wallet provider or a third party. In such a scenario every time your wallet’s state changes it would encrypt your wallet and upload it to the cloud. The service provider would never see the contents of your wallet, only an encrypted blob. And restoring from seed would only take a fraction of a second.</p><p>If the service provider ever disappears you could always still restore from chain using the bandwidth intensive method described above.</p><h3>Conclusion</h3><p>Neutrino holds great promise to improve privacy for SPV users but it presents unique scaling challenges for wallets as blocks start to get large. Fortunately the activation of CTOR means we can download partial blocks with strong cryptographic proof and recognize a bandwidth savings without sacrificing privacy or security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=903e96950d56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing bchd 0.13.0-beta2 with Fast Sync Mode]]></title>
            <link>https://medium.com/@bchd.cash/announcing-bchd-0-13-0-beta2-with-fast-sync-mode-4d4b741d27c5?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d4b741d27c5</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[bitcoincash]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Wed, 19 Dec 2018 04:32:54 GMT</pubDate>
            <atom:updated>2018-12-22T02:27:31.207Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*YkES0sX_AaL_5_P-" /></figure><p>We are happy to announce the release of our second beta version of <a href="https://bchd.cash/">bchd</a>. This release brings three new RPC calls ― reconsiderblock (zquestz), gettxoutproof (swdee), and verifytxoutproof (swdee) ― as well as the reindexchainstate startup option (cpacia).</p><p>The big new addition, however, is fast sync mode. Bchd is now the first and only implementation (between both Bitcoin Cash and Bitcoin) to offer a fast sync option to users.</p><p>Prior to this release the only way to get a full node running was to download and validate the full 140 GB blockchain from genesis. This process usually takes about a half a day or longer depending on your system.</p><p>With this release you can run bchd using the --fastsync option and it will download only about 3 GB of data and be up and running in a little over an hour.</p><p>The way it works is this:</p><ul><li>Download a snapshotted copy of the UTXO set at block height 556767 from <a href="https://ipfs.io/">IPFS</a>.</li><li>Validate the ECMH hash of the UTXO against a hardcoded checkpoint to ensure validity.</li><li>Then sync full blocks to the tip.</li></ul><p>If you have the IPFS daemon running on localhost, it will download the UTXO set via IPFS (and seed it to other users!). If you don’t have IPFS running locally it will download it from an IPFS gateway.</p><p>We also are releasing a <a href="https://github.com/gcash/bchd/tree/master/cmd/utxotool">utxotool</a> that lets any bchd user with a full node (synced from genesis) independently verify the hash of the UTXO set that we included in the checkpoint is correct.</p><p>Fast sync mode operates like a quasi pruned node in that it does not have a full copy of the blockchain going back to genesis. But unlike pruned mode it will not delete old historical blocks as it goes. If you want that functionality you can run the --prune option in addition to the --fastsync option.</p><p>We’d like to thank the following people who contributed their time and code to this release.</p><p>cpacia, zquestz, tyler-smith, romainPellerin, emergent-reasons, swdee, gubatron and amanusk.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d4b741d27c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bitcoin Cash Overlay Network]]></title>
            <link>https://medium.com/@bchd.cash/bitcoin-cash-overlay-network-22160011f7ee?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/22160011f7ee</guid>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Fri, 14 Dec 2018 16:19:25 GMT</pubDate>
            <atom:updated>2018-12-14T16:48:59.823Z</atom:updated>
            <content:encoded><![CDATA[<p>As part of the bchd project we maintain a wallet library and application called <a href="https://github.com/gcash/bchwallet">bchwallet</a> that is capable of either connecting to your bchd full node or running in SPV mode using neutrino. Our goal with bchwallet is to provide a feature rich wallet backend that developers can use to power their applications.</p><p>A feature that is currently in progress and will hopefully be complete early next year is bi-directional payment channels. We’ll save the blog post about this feature until it’s close to being ready but in this post we want to talk about the technology that powers it.</p><p>In order to make payment channels work two bchwallets need to be able to communicate directly with each other to open channels, make micropayements, and close channels. This requires some kind of protocol for communication. In Bitcoin’s lightning network they rolled their own custom peer-to-peer network for this purpose. For a variety of reasons this is not really the best approach for our payment channel implementation. Instead we created a generic overlay network based on IPFS’s <a href="https://libp2p.io/">libp2p</a>. The implementation can be found <a href="https://github.com/gcash/overlaynetwork">here</a>.</p><p>This overlay network is a peer-to-peer network of connected applications. We say it’s “generic” because the goal is not just to connect bchwallets together for the purpose of payment channels, but to be used by <em>any</em> Bitcoin Cash application that needs access to a high performance, feature rich peer-to-peer network.</p><p>Out of the box you instantly get:</p><ul><li>Extensible peer identities</li><li>Encrypted and authenticated connections</li><li>Protocol multiplexing</li><li>Stream multiplexing</li><li>Multi-transport</li><li>Tor integration</li><li>DHT — Key/Value store</li><li>DHT — Peer routing</li><li>DHT — Content routing</li><li>Pubsub</li></ul><p>Using the overlay network library is really dirt simple:</p><pre>privKey, _, _ := crypto.GenerateEd25519Key(rand.Reader)<br><br>cfg := overlaynetwork.NodeConfig{<br>    PrivateKey: privKey,<br>    Params: &amp;chaincfg.MainnetParams,<br>    Port: uint16(4007),<br>    DataDir: path.Join(os.TempDir(), &quot;overlaynetwork&quot;),<br>}<br><br>node, _ := overlaynetwork.NewOverlayNode(&amp;cfg)<br>node.StartOnlineServices()</pre><p>You can take a look at the <a href="https://github.com/gcash/overlaynetwork/tree/master/examples">examples</a> to see how to register a custom protocol, store and retrieve data from the DHT, and publish data over pubsub.</p><p>There is also a compatible javascript version of libp2p that can run entirely in the browser. Making a javascript version of the overlay network should be really easy as the entirety of the library is only 614 lines of code.</p><p>So what can you build with the overlay network?</p><p>Payment channels obviously. But you could also use it for coin mixing protocols, p2p order books, p2p gambling apps, atomic swap apps, etc.</p><p>At the end of the day there’s really nothing stopping all Bitcoin Cash apps from being interconnected and having the ability to communicate with each other.</p><p>If this interests you and you have any questions feel free to reach out to us!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22160011f7ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Neutrino Wallet for Bitcoin Cash]]></title>
            <link>https://medium.com/@bchd.cash/announcing-neutrino-wallet-for-bitcoin-cash-eb7a85a49c0e?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb7a85a49c0e</guid>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Mon, 19 Nov 2018 15:57:52 GMT</pubDate>
            <atom:updated>2018-11-19T15:57:52.630Z</atom:updated>
            <content:encoded><![CDATA[<p>As we mentioned in our earlier post announcing bchd beta, we have also ported the <a href="https://github.com/gcash/neutrino">neutrino</a> wallet backend to our bchwallet codebase. This means that for the first time in the history of Bitcoin Cash users have access to a lightweight SPV wallet with strong network level privacy.</p><h4>A Privacy Primer</h4><p>When you think of privacy in cryptocurrencies most people tend to focus on blockchain privacy ― the degree to which people can trace your transactions through the public ledger. And rightfully so, the blockchain is an important component, but it’s not the only aspect of privacy. Network privacy refers to your privacy vis-a-vis the peers or server that your wallet connects to. Prior to neutrino there was not a single lightweight wallet available on the market that does not disclose all the addresses in your wallet and your entire transaction history to a third party.</p><p>While it’s true that you can use Tor to try to prevent your wallet’s transaction history from being associated with your IP address, it tends to be difficult to impossible to prevent your trading partners (who necessarily know the address your paid from or which they paid) from learning your real identity. Thus even when using Tor there are people who can link your identity to an address and still more people who can link that address to all the transactions in your wallet.</p><h4>Client Side Filtering</h4><p>The concept of client side filtering has been around for a long time but it wasn’t until BTC developers Roasbeef and Jim Posen and others took the initiative to create a specification for it (bips 157/158) and wrote the code that it came into being. Roasbeef in particular did an enormous amount of heavy lifting writing both the neutrino wallet code and making the modifications to btcd(which we ported to bchd). Technically they use neutrino as an SPV option as part of their Lightning Network implementation (<a href="https://github.com/lightningnetwork/lnd">lnd</a>), but we just use it as a normal wallet unrelated to lightning.</p><p>The way it works is full nodes create a filter for each block in the chain. You can think of a filter as an ultra compact representation of all of the transactions in the block. The nodes store these filters on disk along with the block.</p><p>SPV wallets using neutrino sync the full chain of headers like a normal SPV wallets, but they also download the filter for each block. Once they receive the filter they can test all the transactions in their wallet against the filter to see if there are any matches. If there is a match, they download the full block and parse it for their transactions. Using this approach wallets avoid disclosing to the peers they connect to which addresses are in their wallet (note that Tor would still be recommended to remain private when making spends).</p><h4>Stronger Security</h4><p>Old style SPV wallets were not capable of doing any block validation and thus would follow the longest (most work) chain regardless of whether that chain is valid or not. As an example, if a current SPV wallet connects to a BSV node, it has no idea that it’s being fed an invalid chain.</p><p>While neutrino isn’t capable of doing full validation, it can at least perform sanity checks on the blocks that it downloads. For example, neutrino will validate that blocks follow canonical transaction ordering and do not contain any invalid opcodes.</p><p>Thus neutrino would not sync onto the BSV network even if BSV were to create a chain with more work than the Bitcoin Cash chain.</p><p>Finally traditional SPV wallets have the problem where the peers or server they connect to can lie by omission and make the wallet believe it did not receive a transaction or that a transaction didn’t confirm. This is not possible with neutrino as attempts to bamboozle the wallet can be detected and the peer will be banned.</p><h4>Unconfirmed Transactions</h4><p>When we ported neutrino over to BCH it did not have any ability to discover unconfirmed transactions. The reason for this is pretty simple ― any attempt to filter transactions in the mempool would blow the privacy you gained by using neutrino. So it was programmed to only notify you of a transaction when it received its first confirmed.</p><p>This is one of the things we’ve changed. By default neutrino will listen on the network for <em>all</em> unconfirmed transactions (no filtering) so that it can detect if you receive a payment. This functionality can be turned off with a config setting.</p><p>At first glance this seems like users will be slammed with bandwidth usage, but when you crunch the numbers it’s really not that bad. Most SPV users don’t keep their wallet running 24/7. Typical usage amounts to opening the wallet for a few minutes here and there. If you have the wallet open for 10 minutes in a day, say, then that’s only the equivalent of downloading one block. Even at very large block sizes (say 100MB) data usage is still likely to be within the range of a typical mobile data plan (and of course wallets can be programmed to only sync or download unconfirmed transactions on WiFi).</p><h4>Using Neutrino</h4><p>Right now neutrino is command line only software. To use it you need to download the bchwallet binary from our <a href="https://bchd.cash/">website</a>.</p><p>To run it you must first create a new wallet:</p><pre>bchwallet --create</pre><p>Follow the prompts and write down your seed. Then you can start it with:</p><pre>bchwallet --usespv -u username -P password</pre><p>It uses the bchctl CLI interface to control it the same way bchd does.</p><pre>bchctl --wallet -u username -P password getnewaddress</pre><h4>A Call for UI developers</h4><p>If you’re a good UI designer/developer please get in touch (or not as this is free software :P). We’d love to see someone build a nice front end for it. Preferably for mobile but an electron desktop UI would be nice too.</p><p>There is a gomobile compiler which will easily compile the wallet binary to run on IOS or Android. And the wallet comes with a modern gRPC <a href="https://github.com/gcash/bchwallet/blob/master/rpc/api.proto">API</a> which you can use to control it. If there are any API calls that you need that are not implemented let us know and we’ll get them in there.</p><p>All that is needed is YOU to build the UI.</p><h4>To Full Node Users</h4><p>bchd is the only full node implementation currently capable of supporting neutrino SPV wallets. If you run a full node or are considering doing so, please consider running a bchd node as you will help enable neutrino wallets and provide much needed privacy to Bitcoin Cash users.</p><h4>Beta Warning</h4><p>Finally this is all beta software. If you’re using it on mainnet please only use it with a small amount of funds. Take note of any bugs you find and report them to us on github.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J7jyXozX7JBbFXEM.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb7a85a49c0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BCHD Beta Release]]></title>
            <link>https://medium.com/@bchd.cash/bchd-beta-release-46f89c677c47?source=rss-992e6fa001b4------2</link>
            <guid isPermaLink="false">https://medium.com/p/46f89c677c47</guid>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[bchd]]></dc:creator>
            <pubDate>Sun, 18 Nov 2018 14:31:58 GMT</pubDate>
            <atom:updated>2018-11-18T18:30:13.903Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YkES0sX_AaL_5_P-" /></figure><p>We’d like to announce the first beta release of the <a href="https://bchd.cash/">bchd</a> Bitcoin Cash full node implementation. It has been a little over two months since bchd was forked from btcd and in that time it’s undergone a large amount of development.</p><p>We’ve implemented all four of the Bitcoin Cash hardforks and removed a major softfork (segwit) from the codebase. This release contains a number features and improvements over btcd including a utxo memory cache, prune mode, and bip159 NODE_NETWORK_LIMITED to allow pruned nodes to offer blockchain services to the network.</p><p>We were waiting until after the hardfork to release this beta version because we wanted to make sure there were no issues transitioning to the new consensus rules, but we had no issues at all as bchd operated incredibly smooth right through the fork.</p><p>Bchd is currently the only full node implementation running on the network that supports bip157/158 NODE_CF in which the node maintains a compact filter index to serve to lite clients. This allows developers to build a new type of P2P SPV wallet that uses client side filtering to provide SPV users with unmatched privacy.</p><p>To that end we’ve also ported the Neutrino wallet backend to BCH so we actually have an SPV wallet that makes use of this functionality. At present it’s the most private SPV codebase on the market. There really isn’t a close second in terms of privacy. We’ll have more information about neutrino in an upcoming blog post.</p><h4>What’s in the box</h4><p>The release consists of three separate software programs:</p><p><strong>bchd<br></strong>bchd is the blockchain server. It connects to the peer network and handles all of the blockchain processing. It offers an optional transaction index and address index that give access to additional RPC calls when turned on. It’s also the only full node that automatically sets up SSL for the RPC connection to allow you to easily run it on a remote machine.</p><p><strong>bchwallet</strong><br>By itself bchd has no wallet. This is different from the c++ implementations which bundle the wallet together with the node software. By decoupling the two we create a much easier to manage codebase. bchwallet is wallet software that connects to your running instance of bchdto scan for relevant transactions. This software also allows you to switch to the neutrino backend (mentioned above) if you want to run in SPV mode.</p><p><strong>bchctl<br></strong>bchctl is the command line interface for controlling both bchd and bchwallet. If you connect it to the bchwallet you will not only have access to the wallet RPCs, but it will proxy the blockchain RPCs from bchd.</p><p>There are binaries available for a wide variety of operating systems including BSD*, Plan 9, and Solaris.</p><p><strong>You can download these binaries from our </strong><a href="https://bchd.cash/"><strong>website</strong></a><strong> or from </strong><a href="https://github.com/gcash"><strong>github</strong></a><strong>.</strong></p><p>Please keep in mind this is beta software and probably not ready for production usage, though it is in pretty good shape right now. Please help us test it out by downloading it and taking it for a test drive. You can report issues and bugs to us on github.</p><p>We’d like to thank the following people who contributed their time and code to making bchd happen.</p><p>cpacia, zquestz, tyler-smith, romainPellerin, emergent-reasons, swdee, Shanon Denize, nhandl3, DYDYSY, and all of the btcd contributors who created the codebase we forked from.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46f89c677c47" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>