Skip to main content

Questions tagged [signature]

A digital signature proves that the owner of a private key produced or endorsed a given message. These are used in transactions to prove that an output can be spent in a transaction.

Filter by
Sorted by
Tagged with
1 vote
0 answers
17 views

Trying to find Elegant solution to PSBT Multi-sig Signing

I am trying to sign an incoming PSBT in custom software I'm building and I'm having trouble understanding how the signing process of a PSBT actually works. I have a Trezor where the xPub I used in the ...
Myles Sherman's user avatar
0 votes
3 answers
43 views

Multi-Sig Transaction not broadcasting error - Script evaluated without error but finished with a false/empty top stack element

Trying to produce a multi-sig transaction. I have this so far. Sent funds to : 2NDiRgpVVQ3CtYMi962myja69pFW8VSJ9Yp https://mempool.space/testnet4/address/2NDiRgpVVQ3CtYMi962myja69pFW8VSJ9Yp I guess ...
mathis1337's user avatar
1 vote
1 answer
35 views

Trying to figure out non-canonical DER signature error for a specific tx

I have two transactions, they produce the same hash. But the first one throws Non-canonical DER signature error and the second one doesn't. This is a standard 2/3 multi-sig transaction. Tx 1: ...
Ravi Ojha's user avatar
  • 193
0 votes
0 answers
30 views

Error: Cannot sign for this input with the key in BitcoinJS transaction

I'm trying to create and sign a Bitcoin transaction using BitcoinJS on the testnet. However, I'm encountering an error when trying to sign the transaction: Error: Can not sign for this input with the ...
Dobrovolsky Maxim's user avatar
1 vote
2 answers
79 views

Presign transaction with unconfirmed outputs

I am wondering whether the following scenario is possible. Any help is very appreciated. Alice and Bob are creating a (taproot) 2-of-2 multisig together. They do not trust each other. They intend to ...
Neo's user avatar
  • 53
1 vote
1 answer
77 views

Is it possible to combine two PSBTs while retaining the existing signatures?

What if I want to combine two PSBTs: one is signed by Alice’s private key, another one is unsigned. I want to take the input and output from the signed one, and combine them with the unsigned PSBT, ...
Jack Tsia's user avatar
0 votes
0 answers
25 views

Bitcoin message signing and other functions coded in C (not C++). Is there a good library that takes care of it all?

After searching for libraries that could do this, and/or code that could do this, all around the internet, and also AI code assistants failing me, I have managed to write C code (not C++, simple C) ...
capodieci's user avatar
1 vote
2 answers
132 views

Security of spending

New to Bitcoin. Looking at a tx structure, the input is signed to "unlock" it. What prevents an attacker from taking this and then spending as they wish? That is, Alice wants to send 1 BTC ...
IttayD's user avatar
  • 113
0 votes
2 answers
33 views

hashTypeCode/sighash flag example byte arrays for each type

Say I have this (randomly selected) transaction confirmed: txprev.txid: 64891cd6a9771adf75b343367850198633d2865df516533f523ce33fdf8c55c2 txprev.version : 01000000 txprev.input count : 01 ...
Lee's user avatar
  • 958
0 votes
1 answer
55 views

What is the hashTypeCode?

After a transaction is serialised ready for signature or signature verification, a 4 byte hashTypeCode must be added (step 9 here). As it's derived from a single byte, it has 256 possible values. What ...
Lee's user avatar
  • 958
0 votes
1 answer
130 views

Verifying the address and the message using the public key, address, and signature!

I'm trying to verify ownership of a Bitcoin address using the public key, signature, and the address (P2PKH, P2SH, P2WPKH, P2WSH, P2TR) as input. However, the code below does not work for Bech32 ...
0xB17C014's user avatar
1 vote
0 answers
49 views

Why does OP_CHECKSIG/OP_CHECKMULTISIG remove the signature from the subscript?

When OP_CHECKSIG is used, all instances of the signature are removed from the subScript before it's included in a transaction template to be verified. See also step 3 in this excellent diagram. The ...
Lee's user avatar
  • 958
-1 votes
1 answer
70 views

How does one verify signature in a P2WPKH transaction?

(Assume there's no OP_CODESEPERATOR) For standard P2PKH, the signature digest is generated this way: NewTransaction settle the TxOuts well set all TxIn scripts to empty insert the Previous Locking ...
Archit Dabral's user avatar
0 votes
1 answer
124 views

How to convert signature to DER encoded format in python

vk = ecdsa.VerifyingKey.from_string(bytes.fromhex(pubKey),curve=ecdsa.SECP256k1) if vk.verify(bytes.fromhex(signature), bytes.fromhex(sha256_hash), hashlib.sha256, sigdecode=sigdecode_der) == True: # ...
aaravm's user avatar
  • 1
3 votes
1 answer
63 views

Understanding the common input ownership heuristic

I understand that the common input ownership heuristic states that in a transaction all inputs are deemed to be controlled by the same person. But given that a signature must be provided for each ...
user2334659's user avatar
2 votes
1 answer
64 views

Low vs High R value signatures

I have a conceptual understanding of the R value in so far as it can fall either above or below the X axis in the elliptical curve and that positive R values use an extra byte in the signature to ...
user2334659's user avatar
1 vote
0 answers
128 views

Issue with constructing a correct Schnorr Signature for a Taproot transaction

I'm experimenting with creating and sending Taproot transactions programmatically and encountered an issue with the Schnorr signature. I'm trying to send simple transaction with one V1_P2TR input and ...
Skwern's user avatar
  • 13
3 votes
1 answer
76 views

Creating a raw Segwit transaction from scratch and getting Signature must be zero for failed CHECK(MULTI)SIG operation

I am trying to create a Segwit transaction on TESTNET from scratch while referencing an online guide: https://medium.com/coinmonks/creating-and-signing-a-segwit-transaction-from-scratch-ec98577b526a ...
thotheolh's user avatar
  • 207
0 votes
1 answer
99 views

I Get "Non-canonical DER signature" Error

it was asked few times in BSE and they were pointing the problem to the sighash which was not appended to the transaction but i did it and still have problem. i had a problem with amount of fee and ...
user avatar
2 votes
1 answer
128 views

Which private key is used in Taproot transactions?

The transaction only has one input, where its scriptPubKey is --> Op_1 Q , where Q is the tweaked public key. Let p = private key, P = Public key, q = p + tweak, Q = tweaked Public key To create ...
J S's user avatar
  • 35
1 vote
1 answer
88 views

Nonstandard witness when building a transaction

i try to spend a P2WSH 2of2 multisig input in Python for learning purposes. When i check my assembled TX with testmempoolaccept i get "bad-witness-nonstandard". This is my function to ...
f321x's user avatar
  • 11
2 votes
1 answer
109 views

Recreating bitcoin core signature

I am trying to recreate the exact same signature as Bitcoin Core. I have installed bitcoin-core/secp256k1, but I get sometimes different signature as Bitcoin Core (which are valid). I read that since ...
Pawel's user avatar
  • 91
0 votes
1 answer
59 views

Is atomic swap flawed?

I'm reading this paper on atomic swap between BTC and XMR: https://arxiv.org/pdf/2101.12332.pdf and wonder if atomic swap with BTC is flawed by design. My understanding is that, if Alice locks up XMR ...
John M.'s user avatar
  • 121
2 votes
1 answer
178 views

Certain spent P2PKH outputs give error: Non-canonical DER signature

Certain rare spent P2PKH outputs give error: Non-canonical DER signature when I try to verify the spent output using both btcdeb (version 5.0.24) and bitcoinconsensus (version 0.20.2, using Rust ...
Alec Matusis's user avatar
1 vote
1 answer
142 views

Is the signature check performed when the signature is the empty vector?

In this answer Vojtěch Strnad wrote the following: OP_CHECKSIGADD always performs one check per signature, since unused public keys are required to be paired with an empty witness item and are ...
Cosmos's user avatar
  • 309
1 vote
0 answers
120 views

Bip32 Root Key in Metamask Signature? [closed]

I recently fell victim to an inferno contract that took a significant amount of my ERC-20 coins. I realize that this is a Bitcoin site, but a white hat hacker approached and offered to help, and told ...
rnaka's user avatar
  • 11
4 votes
1 answer
242 views

How is this transaction valid?

Transaction in question: 16ac7736552c5791cff5643e6104c76c24018236b2193e014b308efea4f32f81 The P2SH input has a strange redeem script: OP_DUP OP_HASH160 OP_PUSHBYTES_20 ...
Vojtěch Strnad's user avatar
0 votes
1 answer
108 views

What does a digital signature scheme need to have in order to be used (indirectly) in Bitcoin?

Here (see the comments) Pieter Wuille described digital scheme as a collection of three algorithms: (key generation, signing, verification) Since Bitcoin uses ECDSA (pre-Taproot outputs) and Schnorr (...
LeaBit's user avatar
  • 980
2 votes
1 answer
61 views

In the PrivateKey sign() method why are s and N-s equivalent solutions?

In the PrivateKey sign() method (Chapter 3 page 70) s is calculated like this # s = (z + re)/k s = (z + r * self.secret) * k_inv % N if s > N / 2: s = N - s Why does s and N - s work? Closest ...
Jon's user avatar
  • 23
2 votes
1 answer
142 views

Is it correct to say that "each transaction input is signed independently"?

On Chapter 6 - Transactions of Mastering Bitcoin it is said: Note that each transaction input is signed independently. This is critical, as neither the signatures nor the inputs have to belong to or ...
Pedro Martins Timóteo da Costa's user avatar
0 votes
0 answers
47 views

Sending transaction error: -26: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)

I'm not sure what the problem is here, everything seems correct, but I'm new to this and I'm obviously missing something. Can someone pinpoint the issue causing the error? Hex: ...
user2848020's user avatar
1 vote
0 answers
48 views

Sign unsigned transaction with TrustWalletCore Swift

I'm trying to understand how we can sign unsigned transaction in hex format. We use TrustWalletCore, I receive an unsigned tx in hex format, then we decode it to data with let dataToSign = Data(hex: ...
Sergey Udalov's user avatar
2 votes
1 answer
465 views

How to manually verify an ECDSA signature in Python?

Maybe I got the formula wrong but I heard that x = (z*s^-1)*G+(r*s^-1)*K is the equation for verifying an ECDSA signature but my code says signature is invalid but the values are from a valid bitcoin ...
Alexio puk2sefu's user avatar
1 vote
2 answers
274 views

Can someone explain how to get from SigScript to something readable

In the transaction https://blockchain.info/tx/32e8677c968981549acc25f46641c74a3055d949c90bd22c15a5236bf92a622d the first input has the following SigScript ...
user2334659's user avatar
6 votes
1 answer
185 views

Why are hashSequence and hashPrevouts computed separately?

When a Segwit transaction is signed, among the many hashes that are calculated to create the data that is going to be signed, the hash of the concatenated [input + index] is calculated (hashPrevouts) ...
mathboi's user avatar
  • 191
0 votes
1 answer
90 views

How was this transaction validated?

I'm having trouble understanding how the following transaction was valided (Block 364845 July 2015) : 2c6c27639e79038cf446e795e267dc8abbe96d1f21cdd17518cc6b57ad2d86d9 It has one input, and is ...
mathboi's user avatar
  • 191
1 vote
2 answers
285 views

Strange double-spending attack possibility

In Bitcoin you can have different UTXO with different public keys in a single transaction. So suppose someone broadcasts a transaction with sending 10000 BTC. Theoretically I can copy this transaction,...
Denys Malovanyi's user avatar
0 votes
0 answers
39 views

signing input for spend funds locked by this script

Please explain how to sign input for raw transaction with privet key corresponding to 1st or 2nd public key in this script "asm": "OP_IF 1694275749 OP_CHECKLOCKTIMEVERIFY OP_DROP ...
alnostru's user avatar
0 votes
1 answer
200 views

Would two related nonces cause the private key to leak?

Let there be two signatures made with the same private key(d) using two nonces {k1, k2}. Would knowing that k1*u+f=k2 be sufficient to reveal the private key(d)?
Joakim20's user avatar
1 vote
0 answers
75 views

Error when trying to broadcast multi input tx (Programming Bitcoin by Jimmy Song)

I am reading Programming Bitcoin (chapter 7 exercise 5) and I have created a 2 inputs 1 output transaction on testnet which I have signed and it now verifies as true. When I go broadcast the ...
user144329's user avatar
1 vote
1 answer
105 views

Bitcoin Multisig tx signing

I've generated a 2-of-3 P2SH Multisig address (testnet) and am attempting to manually reproduce the signatures to spend from it. While I can replicate the signature for the first key, as produced by ...
Pawel's user avatar
  • 91
0 votes
1 answer
75 views

Do p2pk and SIGHASH_SINGLE still working nowadays?

Seems like p2pk - pay to public key may be working or not in modern wallet apps. Is it still working or not? EDIT: Can old p2pk addresses be used to move balance to new addresses (for example bc1q...)?...
pbies's user avatar
  • 159
2 votes
1 answer
299 views

What is the transaction hash preimage for different values of SIGHASH (not SIGHASH_ALL) in P2PKH?

I have a few questions regarding the transaction hash preimage when signing with different values of the SIGHASH flag in the case of the P2PKH script. I know what the transaction hash preimage looks ...
dassd's user avatar
  • 1,099
1 vote
1 answer
103 views

Taking the existing INPUT and changing the OUTPUT to steal bitcoins. Is this a possible bitcoin theft scenario and how to prevent it?

I'm relatively new to Bitcoin and I'm wondering how Bitcoin defends against the following scenario and if it's even possible. Before I start with the scenario, just two notes: 1. There is a lot of ...
dassd's user avatar
  • 1,099
1 vote
1 answer
176 views

Error Validating Segwit Transactions using Python Blockcypher API: Error Running Input Script

As the title states, I'm trying to send a Litecoin transaction using the Blockcypher API Python SDK, and using Bitcoinlib for key management. I have extensively reviewed the documentation and source ...
Cursed's user avatar
  • 11
1 vote
0 answers
101 views

How to fix this error?: Signature must be zero for failed CHECK(MULTI)SIG operation (code -26)

I'm trying to unlock money from P2SH 2NG4PEU9rya1fcqAfSvQQAteaUkvc54J1fF, but the library is not used by https://www.youtube.com/watch?v=U2bw_N6kQL8 When I combine the Tx, I hash the Tx with SHA256 ...
Mum Jokmok's user avatar
1 vote
0 answers
112 views

Recovered bitcoin public keys do not verify the signature

I need to recover public keys on the bitcoin chain for a project, my current flow is like this: Get hash + signature from bigquery -> Use nodeJS secp256k1 module (native bindings) to import ...
Ano's user avatar
  • 11
1 vote
0 answers
87 views

walletprocesspsbt rpc not signing psbt tx

After extensive regtest testing I've been unable to reproduce this issue. This is a gist to regtest psbt commands that do work. https://gist.github.com/miketwenty1/ecb9acdbca858878f1856b75493fef4c ...
Michael Tidwell's user avatar
1 vote
1 answer
82 views

Is the Z value generated before the (r, s) values?

I just want to confirm my understanding of signatures for P2PKH transactions. The signature hash, z, is generated before generating the r and s values of a DER signature, correct?
jiamijiang's user avatar
1 vote
1 answer
746 views

Transaction keep beeing rejected "non-mandatory-script-verify-flag"

I'm developping Bitcoin integration for Microsoft Dynamics Business Central to offer enterprise capability to apply Bitcoin receivable and payable to accounting. To send a transaction, I'm using ...
Maxime CATY's user avatar

1
2 3 4 5
10