HandyOSS / HandyHost

Host DVPN/HNS, Sia and Akash all in one UI.
https://handyhost.computer
GNU Lesser General Public License v2.1
102 stars 16 forks source link

Support for Sia Consensus file #19

Open breezytm opened 2 years ago

breezytm commented 2 years ago

Please add the option to import the Sia consensus file for faster bootstrap. And as a security measure, in HandyhHost documentation, publish a trusted site to download the file from.

alexsmith540 commented 2 years ago

Thanks for the heads up! This is awesome, I had no idea we could do this. Making people wait 24+ hours for the Sia initial sync is such a big friction point. I'll be implementing this in our next build.

timrettop commented 2 years ago

@alexsmith540 I see you've started working on this in commit f73627c746f35dfd1ca6aef6adefe4c8df59a0c4, I assume its still a work in progress?

Just looking at this request, it looks like the consensus file is hosted in 3 locations based on https://siawiki.tech/daemon/bootstrapping_the_blockchain

There are currently three public consensus database downloads available:

Siahub.info: https://consensus.siahub.info/ (Courtesy of Sanasol) SiaSetup.info: https://siasetup.info/consensus (Courtesy of RBZL) SiaStats.info: https://siastats.info/consensus (Courtesy of hakkane)

Seems like a method for checking one of the 3 locations (random selection to reduce load on one host, with a failover in case the host is down) might be a good addition to the code?

What do you think about the suggestion on their site?

You can synchronize even faster by unzipping the hostdb.json file of this link and placing it at the /renter sub-folder of your Sia installation (same location as /consensus sub-folder).

timrettop commented 2 years ago

SiaSetup.info doesn't seem to host the consensus file any longer.

alexsmith540 commented 2 years ago

Correct, I got most of the backend of this finished in 0.5.1. I pushed the UI/workflow of this back to 0.5.2 due to a few other things I wanted to get out the door. RE which file: I think I settled on siastats.info for now mainly because siahub.info sent me on some redirect and freaked me out a bit, lol. I'll look into their setup a bit more in detail so we at least have an alternate. The big thing I have to work thru on the workflow side will be: Since the consensus archive is refreshed on some interval: What happens when I start the download and it gets stopped mid-stream when the new file arrives, and do I make some UI element upfront letting the user know not to waste time (ex: what if they want to start an 18 hour download 16 hours before the refresh occurs and kills their progress...)

alexsmith540 commented 2 years ago

Super excited for this feature though. The initial sync time is such a bummer when you put in the time to build a sweet storage rig and then have to wait 24-36 hours to sync the chain, lol.

timrettop commented 2 years ago

Me too!

I see what you mean about siahub, seems from the redirect header its going to a parking site maybe.

From my perspective, I was initially concerned about sourcing the data, but I agreed with the risk description here: https://siasetup.info/tools/consensus#risk-analysis Maybe it would be good to include, or sometime in the future allow an opt-out or something.

Regarding the concern on workflow, are you saying you're concerned that a midstream download of the db file would be interrupted upstream by them refreshing the file? I see the concern, does it seem like overkill to compare the download rate to the 'next synctime' included on siastats.info ?

alexsmith540 commented 2 years ago

Yeah after thinking on this for a bit, I believe the easy-way might be to have the user download the consensus file themselves vs thru the HandyHost UI. From there HandyHost can pick up the downloaded consensus file and unpack it into the proper place. I've been tied up doing a bunch of Akash fixes the past month but can start to give this some attention now.