Skip to main content
5 votes
Accepted

How does this simple script use the OP_CHECKSIG opcode?

Let's run through the program. The stack starts as <A sig> <A pubkey>. You run OP_DUP. The stack is now <A sig> <A pubkey> <A pubkey>. You run OP_HASH160. The stack is ...
Pieter Wuille's user avatar
3 votes

Is SIGHASH_NONE encompassing of other signature types?

SIGHASH_NONE implies that Input 2 will only spend if Input 1 is included in the transaction. This is false. Input 2 is essentially a blank check. SIGHASH_NONE signs none of the outputs (I don't care ...
Raghav Sood's user avatar
  • 17.3k
3 votes

Quadratic hashing problem: Why not just create new OP code "CHECKSIG2" to fix?

Note: As of 2020 this answer is obsolete, as BIP143 / SegWit has been in use for years which fixes this concern. You can fix it this way, and someone is in the process of doing so. The problem with ...
Nick ODell's user avatar
  • 29.5k
3 votes
Accepted

(CHECKSIG) Why is the ScriptPubKey from tx-inputs part of the signature?

AFAIK this was a design choice by Satoshi originally that is unnecessary for the reasons stated in the OP. There is a comment about this in bitcoinj // Set the input to the script of its output. ...
Chris Stewart's user avatar
3 votes
Accepted

Validation of segwit v0-v1 tx automatically adds OP_CHECKSIG?

In the original design of Bitcoin, the conditions for spending an output would be explicitly defined in the output script (scriptPubKey). P2PK, P2PKH and bare multisig are examples of this. However, ...
Vojtěch Strnad's user avatar
2 votes

Can't Make Sense of Why OP_CHECKSIG Fails Here

OP_CHECKSIG needs to have the whole transaction to hash and to verify the tx. Btcdeb has the feature of allowing the tx as an argument however the website you linked doesn't hence this opcode is ...
MCCCS's user avatar
  • 10.2k
2 votes
Accepted

What is type 'pubkey' in a scriptpubkey output from getrawtransaction?

The script for an output describes the condition that must be satisfied for the money to move. It means that the public key is contained in the scriptPubKey. Usually, the scriptPubKey only contains a ...
Nick ODell's user avatar
  • 29.5k
2 votes
Accepted

Signature verification in python

The way that VerifyingKey works is that it will actually hash the message before it verifies. The default hashing algorithm is sha1, so you will need to specify it to be sha256 as that is what Bitcoin ...
Ava Chow's user avatar
  • 72.2k
2 votes
Accepted

Bitcoin P2PKH transaction - two questions

The signature is mathematically generated using the private key and the message, but is not the message itself (it uses the hash of the message during the signing process, the message is not ...
meshcollider's user avatar
  • 11.9k
2 votes
Accepted

How is subscript computed for OP_CHECKMULTISIG?

The main confusion here comes from this : First, generate the script by concatenating [sigScript][OP_CODESEPARATOR][pubkeyScript] Then you add : I understand that script execution has evolved ...
arubi's user avatar
  • 1,864
2 votes

"mandatory-script-verify-flag-failed (signature must be zero for failed check(multi)sig operation)"

After some additional research and helpful information found here, I was able to conclude the following: Transactions encoded on 0.12.X bitcoin and then broadcast on 0.15 bitcoin may encounter "...
xagau's user avatar
  • 51
1 vote
Accepted

Why do we need public key as part of Witness in P2WPKH transactions?

This was discussed today on the #bitcoin-wizards IRC channel. The reasons offered by Andrew Poelstra (andytoshi) were: "Segwit had enough scope already." That is, it was already a large change that ...
David A. Harding's user avatar
1 vote
Accepted

How do people know how to construct the OPCodes?

Bitcoin Script is a programming language. As such, it is similar to other languages - You need to know what you are trying to achieve to be able to write in it. The script you've presented is a P2PKH ...
Raghav Sood's user avatar
  • 17.3k
1 vote
Accepted

funding and spending a "no-multisig/no segwit" P2SH tx

Now I understand, why there was no answer - it gets really long :-) So I answer it by myself. I am with bitcoin core (getinfo) version 150100, on OpenBSD (ksh) and OSX (bash v3): I solved it on ...
pebwindkraft's user avatar
  • 5,116

Only top scored, non community-wiki answers of a minimum length are eligible