9

I'd like to build a web wallet that let's people make transactions. I'm best at python so right now I ask for the secret key in a form with the other transaction information, send it to my server, build the transaction, sign it, and send it to the Stellar network.

I am not a security expert, but I am fairly confident that sending the secret key to my server is a potential attack area.

I do not want to rebuild my entire codebase in javascript and keep everything in the client.

Is there a good way to deal with this? My two thoughts are:

  1. Build the entire transaction on the server but somehow send it to the client to be signed and sent to the stellar network.

  2. Build a downloadable exe file that has all of the code to build the transaction that the user can download, sign and hit run.

Both of these options would require a significant amount of work I'd rather avoid, but I'll do what's necessary to protect my future users. Any advice is appreciated. Thanks!

2 Answers 2

9

You are right, the scheme you described is far from being secure. User should sign the transaction on the client-side.

I can see three options for your case:

  1. Build and sign the transaction in the browser (that's what the most wallets doing). You can check the source code of existing web wallets for reference, most of them are open-source.
  2. Prepare a transaction and let the user sign it externally (using hardware wallet, Stellar Laboratory, etc). This option provides the highest security.
  3. Contribute to the existing wallet. Seriously, there is more than a dozen of them already. Improve the existing wallet and you will be able to qualify for Stellar Build Challenge rewards.
5
  • These are great points. Regarding the users signing externally, this is the ideal which is also used on other digital currencies, like Ethereum. For example, Metamask, which is a common browser interface for Ethereum, stores the users private key, so all transactions are handled directly by Metamask. The user never gives the private key to a end website/client. Commented Jan 24, 2018 at 21:55
  • How could I use something like metamask or interface with the hardware wallets? For Stellar Laboratory you mean link to a pre-populated transaction in the laboratory for the user to sign? One more question, what if I changed my architecture to serverless (AWS kinesis), would this make the key transmission much safer since there isn't an always on server to hack? Jw. Thanks for the feedback!
    – AGitzes
    Commented Jan 24, 2018 at 23:47
  • Ledger Nano S is supported by the account viewer and stellarport.io. In case of the Stellar Laboratory, users can sign the transaction passed in XDR format (see stellar.org/laboratory/#txsigner?network=test), so you can just generate transaction envelope, serialize it into XDR and let the user it externally. It also supports query parameters, therefore you can generate a link that sends user to the Laboratory with pre-populated transaction envelope.
    – Orbit Lens
    Commented Jan 25, 2018 at 0:07
  • Ok. Sending a transaction to the stellar laboratory is surprisingly easy and also described by @OrbitLens as providing the highest security. I will probably launch this as the first option. Hopefully I can build as a second more convenient, but only slightly less secure option a way to send the envelope to the browser to be signed and sent in the client. This way I can keep 99% of my code base which would be great.
    – AGitzes
    Commented Jan 25, 2018 at 2:14
  • @AGitzes regarding the server-less applications, watch out. Previous hacks that happened were based on either hacking the DNS (blackwallet) or hacking the HTML and running JavaScript that processed a wallet transfer. When it comes to this stuff, you can never be too secure. Commented Jan 25, 2018 at 20:49
0

I'm building a solution specifically for those cases. This allow any service to handle transaction validation without having to mess with secret keys and security.

The key concept is sharing transaction over URL, as a query string. You can check for some examples here : https://galactictalk.org/d/1267-cosmic-link-alpha-release

The solution is made of two tools:

  • Cosmic.Link website, whoses aim is to dispatch transactions request to the right wallet/authenticator
  • Stellar Authenticator, which's the first authenticator to support the protocol.

As soon as wallets start to support the recent standard for web+stellar URIs I'll be able to add them as valid authenticators for cosmic links.

You can give it a try in a few clicks on the testnet using Stellar Authenticator demo version:

https://cosmic.link/?payment&destination=tips*cosmic.link&amount=10&network=test&memo=text:Hi!

I'm going toward the beta release and I'm looking for partner wallets. Stellar Authenticator sole purpose is to be a secure interface for storing secret keys and signing transactions. So compatible wallets and exchange are much needed.

If you're interested I'm available on Slack for further information.

Edit: Fix the memo field of the link (0.0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.