I am trying to create a htlc smart contract manually by writing a script and finding the hex using the btcc compiler. Now node A has to create a transaction using that hex and lock money in that p2sh address for upto 150 blocks. If node B can provide the secret value before 150 blocks then he can claim the coins and if not the it will go back to node A. I am new to this concept and where ever i read about creating transactions they are explaining in a theoretical way and I could not understand what to do the redeem script hex and how to lock money and how will node B claim it before 150 blocks and how will the raw transaction created by node A will be accessible to node B. Can you please give a reference or steps to follow to understand and implement it?

Which documentation should i refer for doing it and what commands should be used and how it should be used?

How to create the p2sh address. And another problem i am facing is that i am getting different hash160 everytime in different website. Not sure which one is accurate. Please guide me.

P.S: I am running bitcoin in regtest mode.

  • Are you looking for a script that you can use or Bitcoin-core commands to create such a transaction?
    – Ugam Kamat
    Jun 28 '19 at 9:12
  • commands to create such transaction
    – prajna
    Jun 28 '19 at 9:22
  • I have created the redeem script hex , now i don't know what to do with that.
    – prajna
    Jun 28 '19 at 9:27
  • Check @pieterwuille answer over here: bitcoin.stackexchange.com/questions/80902/…. Bitcoin Core by default does not support signing transactions with CLTV scripts
    – Ugam Kamat
    Jun 28 '19 at 9:38
  • I want to know how to create a transaction and how to sign, send and claim it step by step and what are the required fields for doing that. And which privkey should be used and which address should be used. later when the recipient has to claim, then where should he produce the preimage to claim the money.
    – prajna
    Jun 28 '19 at 10:53

Your Answer

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

Browse other questions tagged or ask your own question.