0

I found that ShapeShift generates new address for each transaction. How do they do that? Is it possible to exchange the coins in the same manner as ShapeShift do, but without the creation of new address?

1

This is called Hierarchical Deterministic key derivation.

New public keys, and by extension Bitcoin addresses, can be generated from a set of parent public keys. This way, the front-end of Shape-shift never needs to communicate with a "hot wallet" and can generate a new set of addresses for every user transaction.

To spend from these addresses, Shapeshift simply derives the corresponding private key (server-side) from its parent private keys.

Child private and public keys can be derived in parallel (front/back-ends), maintaining a fire-wall between them.

Intro to HD Wallets

For details on HD key derivation works, check a recent talk of mine at Scaling Bitcoin: https://youtu.be/OVvue2dXkJo Slides here: https://teachbitcoin.github.io/wallets.html#/5

0

I am not aware on the way how shapeshift has implemented their solution, maybe a developer from this company reads this forum and can provide an answer.

Generally there are two approaches for different addresses on a webpage:

1.) the background is running a bitcoin core node (or any other wallet software which fits their needs), and everytime a user visits the webpage, the server asks the node for "getnewaddress", and displays this to the browser. There might then be some logic in their back office app, to convert/move values to the correct "other chain".

2.) usage of HD keys. HD keys come with xpriv and xpub, which can generate a set of 2^31 keys from a single privkey. There is a slight problem with this, these HD keys cannot be handed out easily to the customer, cause they are derived from a single privkey. But for the shape shift service it is more than sufficient, cause they use "one-time" addresses...

  • And how could I generate HD keys? Do I need a full cryptocurrency node for this? – marc Mar 15 '18 at 11:44
  • not sure about your question... generally you don't need a full node. It depends what you have. You can code your own library (assuming there is some programming experience), you could use libraries (need to do a search, they are available for many programming languages), you can use ready made tools (another search in the forum) or at the end even use Electrum wallet, and type the key's letters and numbers by hand ... well, not really... I recommend to read Andreas' book "Mastering Bitcoin", chapter 5 on wallets, which helps to understand how these keys are generated. – pebwindkraft Mar 15 '18 at 11:50
  • Yes, I could generate an HD wallet with Electrum, or Trezor and many other hot/cold wallets. But I need to create the addresses on a server and be able to perform transactions. So these wallets are not suitable for this case. – marc Mar 15 '18 at 11:58
  • They do not necessarily need to use an HD wallet nor do they need to use Bitcoin Core. They can just be generating random private keys as is the traditional way to generate private keys using any software that they want. – Andrew Chow May 17 '18 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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