About
This adds a cryptography system to check for newer versions of Bitcoin Core. It will never update binaries itself.
It adds a new RPC command called check-update
and displays a message in the GUI if a new version is available.
How does this work
There is a list of sources where a file is hosted which says the newest version + a digital signature of it. When checking for a new version it does the following steps:
- Checks if the client is a release and not a dirty build (disabled right now for testing purpose)
- It will choose a random source from where to get the versions file
- It will try to download the versions file, if it fails it will select a new source. If no source is found, it will fail
- It will parse the downloaded file
- It will verify if the signature matches one of the hard coded public keys
- It will check if the version is newer than the current one (disabled because of testing)
- It will check if the new version string only contains numbers, dots and ‘v’
Q&A
Q: Alert Key system remastered? A: No, the alert key system was a bitcoin specific thing which happened over the protocol, this happens over HTTP and is only related to Bitcoin Core and will only give a new version (or anything that can be done with just numbers and dots) Q: What happens if someone gets a public version signing key? A: Nothing. Unless he does not control a source, he can’t do anything with it. If he controls a source he could give a message with just numbers, dots and ‘v’ and it would be only visible to these peers who randomly select his source Q: What happens when an attacker gets the control over a source? A: Nothing, as long as he doesn’t have the private key of a version signing address. He could just remove the version or install an older Q: Is it centralization? A: Well yes, but Bitcoin Core is a centralized project (it has maintainers, governance, etc.). Like I said, the system has nothing to do with Bitcoin directly
Version Signing Address
A Version Signing Address needs to be legacy to create and verify signatures
Source
The source is just a txt file hosted on a web server. It needs to be exactly two lines long. The first line contains the text and the second one the message. Example:
0v0.99.0
1IEHPu8Bc609G9wxc0TPOfGlnSbtEcvoZA68e/pi5pEZqeqegvovwqcNtXfU50ju+hD5OIJWsuOTjHISLV+KprVs=
Testing
Because it uses libcurl and I am a complete disaster when it comes to build systems it only works with libcurl installed and I only tested it on (g++ (Debian 8.3.0-6) 8.3.0)
First install libcurl On Debian 10
0apt install libcurl4-openssl
When you build this PR and run check-update you will get
0v0.99.0
When you run bitcoin-qt you will get It will use a source on my webserver with a public key that only I have (The server might be down around 4am german time every day)
Testing with own source or address
Source
- Setup a web server
- Copy a valid source file (you can use mine) to the webserver
- Add the URL of the file to the class constructor with adding the function
addSource("http://yourhost");
Address
- Create a new legacy address (can be done over getnewaddress)
- Copy this address to the class contructor with
addKey("YOURADDRESS");
- Create a source file with signing the version text from line 1
To-Do before merging
- Get address from laanwj and others (just as backups)
- Integrate libcurl better to the build system and if it’s not available disable this feature.
- Setup multiple sources for the case that one is down and to add decentralization.
- Add options to the RPC call to use a custom source and address (for testing)
Because this PR uses new dependencies a compilation might not work Contact me whenever you have questions or problems of any kind