Hedgehog Ethereum wallet: Build DApps like apps, without centralized keys
hedgehog.audius.co
hedgehog.audius.co
Hedgehog lives in your front end Javascript code. A user enters a username (or email) and password, which is used to secure a set of encrypted auth artifacts that are generated client-side and stored in the browser’s localStorage / on your (the application developer's) server. In this way, the encrypted auth artifacts can be retrieved and consumed on secondary devices without centralizing custody and control of the private key.
If the centralized server hosting the keys goes down, users can continue to access their wallet on the devices they already have. If the centralized server is compromised or operated by bad actors, the resources required to decrypt a stored auth artifact would be immense. However - this is why we recommend using Hedgehog only in low-to-no financial value use cases.
This approach is not without tradeoffs - but for the right use-cases we believe this will provide a needed alternative.
Happy to answer any questions you all have!
Assuming you've seen that project, how does Hedgehog compare?
Do you have recommendations on handling the initial funding of a wallet, especially for your target market of non-technical users? (after they have the wallet, how do they obtain ETH or other tokens to get started?)
The approach we've taken at Audius on initial funding is to avoid funding the wallet entirely - we use EIP-712 signatures combined with a trustless transaction relay service that pays gas / submits EIP-712 signed transactions on-chain on behalf of users. In this way, the user wallet never holds any tokens but is still used to secure access to their account. We'll be open-sourcing our contracts and infrastructure code soon, but here's a good public example of this model in action: https://github.com/hellobloom/core/tree/master/contracts
That said, other folks may decide to use Hedgehog differently - perhaps you integrate with something like Wyre (https://www.sendwyre.com/) to help users fund their wallet client-side without knowing that crypto is there.
Where do you usually hang out? I would like to learn more about building crypto stuff and would like to participate in a community. Can you point me in the right direction?
Thank you!
PS: I have completely no idea what Audius is about, but it sounds cool. Good luck!
There are tons of helpful resources online though, as lots of folks write tutorials and other things. Googling most problems you face will yield good results.
Maybe I haven't tried hard enough finding the builders.
Thank you Roneil, and good luck on your endeavors!
Good luck!
Thanks for the suggestion!
How do you handle the "Forgot Password" problem?
Say, if a user clears out local storage and forgets their password. Is there a way to recover it from what's stored on the server?
It looks very cool. Just skimming the documentation, there isn't anything on how to perform actual wallet functions, or whether encrypt/decrypt data using public/private keys is available (which is something I'd find super useful!). Am I missing it, or is it just a matter of looking through the code?
Thanks for making something as cool as this open source!
This was documented only indirectly - we should add a specific note / example for this. The model here is that the ethereumjs-wallet object returned by Hedgehog (eg. by getWallet https://audiusproject.github.io/hedgehog-docs/#getwallet ) follows this API https://github.com/ethereumjs/ethereumjs-wallet which, when used in tandem with this package https://github.com/ethereumjs/ethereumjs-tx can do everything a normal Ethereum wallet would.
We are also thinking about offline ways to share the key such that the centralized side is not required - eg. a QR code displayed on one device and scanned by another to propagate the wallet. This creates a problem if a user loses all of their devices though.
I'm part of the team that develops the Embark Framework and it would be awesome to rehash our decentralized Reddit tutorial using a fully decentralized Hedgehog.
https://embark.status.im/news/2019/02/04/building-a-decentra...
As for the QR code getting lost, that's a good point, but the user could always be encouraged to make a physical copy and keep it in a desk drawer, and/or store it electronically somewhere else (e.g. Dropbox or 1Password) "just in case".
We did not want to require use of Keybase to use our dapp Audius, though I could see it making a lot of sense to offer a keybase integration as a potential option.
FWIW, Audius still supports Metamask too - web3 is all about giving users choice from our perspective.
Here's the key section of code that makes this Ethereum-specific: https://github.com/AudiusProject/hedgehog/blob/master/src/au...
You could replace the use of 'ethereumjs-wallet/hdkey' with any other chain wallet library if it is compatible with the BIP-39 style HDWallet structure. Bitcoin and many other blockchains have compatible libraries that could be substituted easily!
There is not - this is the biggest deficiency of Hedgehog today. Without centralized custody of keys, it's not possible to have someone prove their ownership of a given key to a centralized party in order to unlock it. The key is encrypted, so the application provider nor anyone else can decrypt it without the user's username/password combination. This tradeoff is both a good thing and a bad thing in our view.
That said, there is a mechanism for changing your password if you are already signed in.
We are considering some mechanisms for fallbacks, eg using a threshold cryptosystem with multiple private keys and a 1 or 2 of n requirement, such that if a user forgets the way to generate one of the n keys they may still remember a way to generate the other(s). If you're curious, more on these schemes here: https://en.wikipedia.org/wiki/Threshold_cryptosystem
We feel these tradeoffs make sense to enable more mainstream adoption of cryptocurrencies, but they are tradeoffs; for certain types of applications the cost of losing control of an account is too high for this approach to make sense.
This is why FinneyFor uses an iFrame to keep the private key safe in localStorage only accessible from JS running on the same domain. FinneyFor uses postMessage to communicate between the parent frame when payment is processed, so you get the benefits of creating transactions in any kind of browser, but none of the risks as the parent rightfully points out.
This is why we recommend that you audit all 3rd-party Javascript in your app for accesses to localstorage, and avoid sourcing 3rd-party javascript from uncontrolled origins (the code could be switched out from under you if it is not baked into your application)
The post message model is an interesting one - we looked into designing Hedgehog in that way, but decided it ultimately did not help solve this issue and created unnecessary complexity. If you include Javascript from libraries or other origins on your page, eg. Google Analytics, that Javascript could still post-message into your iframe.
Perhaps we are wrong here though! Is FinneyFor open-source? Would love to see how this is implemented.
Auditing the source code of all libraries is a tall order. And, even if you don't find a bug, there still might be some that someone else could exploit with bugs in your code and the js libraries.
Finney For is not open source.
As a blockchain game developer, I have talked ad nauseum (https://steemit.com/marketing/@steem.marketing/cache-the-gam...) about reasons why we switched away from Ethereum for most transactions (but not all).
The UX of the wallet being one difficulty for adoption. There are other even bigger reasons (in my opinion) - variable mining fees per transaction being a large one.
https://ethereum-magicians.org/t/eip-1559-fee-market-change-...
Apps will be slow to respond and take minutes or hours between updates.
Is this accepted as you wait for a new solution to the byzantine generals problem?
FWIW, Hedgehog works with any web3-compliant API, in our case core.poa.network but could be any other one of developer's choosing eg. Infura
https://medium.com/loom-network/everything-you-need-to-know-...
Ethereum 2.0 will have sharding. That should speed up transactions but sidechains will probably always be cheaper and sometimes no fee.
Will give this a try on our Dapp.
In the case of a compromised password the entire wallet should be abandoned.