1

Looking for a way for a dapp to buy tzBTC automatically after receiving tez from a baker.

0

If you mean "dapp" as in "front-end dapp", it is technically possible but highly dangerous and cumbersome: the exchange between XTZ and tzBTC requires signing a transaction so you would have to store a private key into the interface and keep it open at all time (suffice to say, you shouldn't do it).

What is possible is to do it server-side with a script that listens to changes of balance for a certain address or runs at fixed intervals and when a credit of XTZ is detected, the script can use a private key that is securely stored to sign a transaction and buy tzBTC from Dexter.

2
  • Thank you for the information. I was thinking if it is possible for a "back-end" dapp ie the dapp sends tez (via entry point )to dexter and dexter simply sends back tzBTC. Since signing is required i dont think my idea will work.
    – Alvin
    Nov 11 '20 at 14:40
  • 1
    There are different solutions you can use if you want to sign transactions from the back-end, for example, the @taquito/signer package has a function called InMemorySigner that you can set up with a private key and that will be used in all the subsequent operations :) Nov 11 '20 at 15:58

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.