I don’t always ruin my crypto wallets, but when I do…
So I had a little bit of a screw up last night that almost cost me several hundred dollars in $BEAM. I was working on my automated exchanger program, and wanted to set up the BEAM wallet-api. It wasn’t included as a release like the CLI node and wallet programs, so I had to compile from source.
I cloned the git repo and tried to compile, but I had older versions of Boost and CMake that needed updating first. This wasn’t much of a problem, but after I got things compiled I actually wound up with executables ending with
-masternet. I thought this was slightly unusual, but I threw them in with my node and wallet database files and ran them. I didn’t know it, but I had already made two mistakes.
The BEAM developers took the unusual step of using the Git master branch for their development branch. I had missed it in the build docs. So when I ran
wallet-api the first time it actually upgraded my DB to this development version. Of course there was a mismatch with the node, which I caught, so I ran the updated node software as well. I still didn’t realize that I was running on testnet, and of course the node blockchain wasn’t valid. I was stuck.
I’m not sure how I finally made the connection, it might have been another read of the build docs, but I eventually realized that I needed to checkout the
mainnet branch and build from there. Once I did that, I was still stuck, as the node and wallet DBs were already upgraded past the current version. So I had to download the entire blockchain before I could try to check my wallet. Oops.
That was done when I woke up this morning, but I still had several problems before I could fully recover my funds. The wallet DB was no good, and my first attempts recovering the wallet failed. “Invalid seed phrase,” it said, although I was one hundred percent sure I had saved the original phrase correctly. I eventually found a github issue that indicated the proper CLI input for the seed phrase, and was able to recover the wallet.
Unfortunately there were no funds in it. Due to the way privacy and anonymity is implemented in BEAM, the UTXOs belonging to the wallet can only be rescanned from a node running with the owner key active. This is usually used to collect mining rewards from multiple nodes running the same wallet, so I had to restart my node with this key, allow it to rescan the entire blockchain, and then run my wallet with the rescan option. Then I was finally able to see my funds in the wallet.
Obviously the main lesson here is that I should make backups of my DB files before updating anything relating to nodes or wallets. I should know better, honestly. Still, it serves as a bit of a reminder just how complicated cryptocurrency and blockchains are. We are still early.
Still, there’s a lot that can be improved by the Beam team to make things a bit more user friendly. Obviously GUI users take precedence for the teams, but a couple minor changes could go a long way. Keeping your development branch in
master just seems… strange to me. And a bit of clarification in the CLI
--help option would go a long way for the recovery process.
And when I’m ready to start back up work on the wallet-cli application this weekend, you can bet I’m going to do it with a testnet implementation.
After recovering my wallet and funds, I found that exchange payouts from my mining pool were not occuring. Turns out that the wallet address created by the wallet software are somewhat non-deterministic, and will not be restored on import. I was facing the prospect of having to contact the exchange and asking them to payout funds to another address, which I was sure would be a hassle.
Instead I decided to recompile the masternet branch of the wallet software, and managed to run the
export data command (against a wallet backup!) to get all of my addresses and other data as JSON. I was able to import this into my live wallet, and verified that the address was restored.
After a few hours I checked, and verified that the pool had paid out.