Advanced Bitcoin Scripting (P2SH - Discussion

Holy crap just a comma :slight_smile: Thanks it’s working now :slight_smile:

1 Like

Yess thanks, I came on Bcoin as well after following this course: Will finish this course later, but learned me to use JQ and other things, thanks for your error noticed, let’s finish this course further first :slight_smile:

1 Like


Not sure if I understand the process completely. Let’s say, I need to create a P2SH transaction. I create a redeem script and then hash it. To whom do I send the hash? Sorry, might seem a dumb question.

This is the address of the script. You send it to someone that you want to send funds there :slight_smile:

1 Like
  1. The address is the script … ‘hashed’. The hashed script contains conditions for which it can be unlocked.
  2. Then whoever provide the ‘full script’ AND the necessary SIGNATURES can spend that UTXO.
    @filip please correct me if I’m wrong
1 Like

For those who had trouble to understand the different types of scripts, this video really helped me !



Filip is going great so far. i try to summarise this section for my understanding and the same is posting here for others to read and correction if needed.

Pay to Script Hash (P2SH)

This method came into existence for joint accounts, when UTXOs are expected to be redeemed by two or more signatures (joint account) than using pay to public key hash method is not ideal. code becomes messy and over complicated because sender needs to write multiple public keys in the address of transection. Similar verification processes also become complicated. It’s like doing extra work on both sender and receiver end. So the Pay to hash key method simplifies the transaction process. It also eases the data entry for the sender and puts all the burden on receivers who need funds in a joint account.

How does it work?
1. Redeem Script is generated by the receiver.
“Redeem Script is piece of code that explain how many public keys need to check out of total public keys against their signatures to use those funds (UTXOs)”
I.e at least 2 public keys need to be verified against their signatures out of 3 to use the UTXOs.
2. Receiver “Hash the Redeem Script” The whole code is then hashed to keep things secure and simple.

3. Receiver Send the “hash of the Redeem Script” to Sender

4. Sender User the “Redeem Script Hash” to Lock the Transaction within the locking script. Apparently it works as the address of the receiver of funds.

5. Funds Redeem by the Receiver: Unlocking Script
To redeem the funds, the receiver needs to prove the ownership of the funds to the network. For that receiver to create an unlocking script and that consists of two things.

Solution to Redeem Script (Signatures of the participants)
Full Redeem Script created in the first step. 

6. Combining both Unlocking and Locking Script this step will open the lock on funds if verified. Technically this step is done in two steps.
Step 1: Keep the copy of unlocking script to be used in step 2
Verify the script hash in locking script with Full Redeem Script in Unlocking Script
Step 2: Use copy of Unlocking Script that created in First step
Verify the Signatures against Full Redeem Script (Public Keys)


Hello all ! Can some of you send me some suggestions on videos to watch about bitcoin transactions as some complement to this course, i’m doing my best to understand but i think i need more work haha !