A few weeks ago while reading the flyclient paper, i came up with the idea for nSPV. Rapidly, i modified komodod to have a -nSPV=1 mode to implement the superlite functionality.
since then i got most of the CC transactions being able to be created from the nSPV=1 client and the fullnode side protocol seems to be getting pretty stable. probably, i should add a protocol versioning to allow seamless updating of the p2p messages for future additions.
last week, i discovered a very cool library called libbtc. it implement all the things needed for a headers only SPV client for BTC, in C. with libevent being the only external dependency.
well, i couldnt resist…
so i ported the nSPV code into libbtc, but it bypasses all the headers only SPV handling as the nSPV handling doesnt require any local data on disk. that means it can run in a stateless mode very efficiently. a depedency for libsodium had to be added to support the signing of sapling tx.
also the libbtc didnt have any api handling, so i ripped out the iguana rpc handling and put it into libnspv. it is a single threaded model where you make requests to a port, but it can now handle http://127.0.0.1:port GET requests, curl POST request and it handles json params array or json with all the fields
basically a mini coindaemon, that has an executable size of about 300kb and a RAM usage of about 3MB. it is able to use the enhanced version of the coins file from my coins repo to get the parameters for all the komodo ecosystem coins.
i guess i can also add support for using the headers only SPV for non-ecosystem coins, but the big problem is that they wont have the fullnode support to answer the addressindex queries. that is another underrated benefit of the komodod, where any node can get explorer level data just by adding -addressindex=1 to the command line.
where does nSPV go from here?
i have a couple of devs already up to speed so more and more CC will be supported via nSPV=1 mode and really documenting the libnspv and making easy to use wallets based on this new tech.
scaling to millions of users is now practical!
https://docs.komodoplatform.com/nSPV has some preliminary docs