7

The signrawtransaction RPC will verify the input scripts of the transaction after it signs it. If the transaction has not been fully signed (i.e. it isn't complete), then the script verification will fail and produce this error. This also happens with multisig transactions. When you don't have enough signatures, the script will fail to verify with the error ...


7

The easiest way to do this by importing the address you generated on the offline Bitcoin Core client into an online fully synced Bitcoin-Core. The command is: bitcoin-cli importaddress <address>. The benefit of importing this address into the synced Bitcoin-Core machine is that you can use it as a watch-only address which will allow you to see all the ...


4

As the error message says, signrawtransaction is deprecated. Stop using it. Instead use signrawtransactionwithwallet (if the transaction you are signing uses keys from your wallet) or signrawtransactionwithkey (if you are specifying keys on the command line).


4

I'm not an expert in this field by any means (and my error message was different), but I spent last week trying to make Bitcoinj sign a transaction and send in raw form (i.e. without using transport protocol which Bitcoinj provides) and here's what I've learned (the hard way): You can't sign transactions like that. If you call tx.addSignedInput in a loop, ...


4

Figured out a few things: Segwit Signatures For segwit transactions one must sign the following (see BIP 143): Double SHA256 of the serialization of: 1. nVersion of the transaction (4-byte little endian) 2. hashPrevouts (32-byte hash) 3. hashSequence (32-byte hash) 4. outpoint (32-byte hash + 4-byte little endian) 5. scriptCode ...


4

I believe the intention of your push_int(1) is to add SIGHASH_ALL to the transaction. However, one of Script's many needless inflexibilities is that the sighash flag actually needs to be part of the signature itself, rather than as a separate stack element in the script. This means that you need to take the Vec<u8> returned from Signature::...


3

You provided the amount incorrectly. The amount is 0.54551 not 545500. This is important as Segwit inputs include the previous output's amount in the signature. Providing the wrong amount will result in the wrong signature which will then fail validation.


3

Good day! Finally I found a solution, I hope it will useful to someone. The problem was that I tried to sign inputs before adding outputs and other info into transaction. So now I add inputs with method addInput(). Before I did it with addSignedInput() method. After adding all inputs and outputs in my TX I try to sign every input manually: for (int i = 0;...


3

Bitcoin Core's signrawtransaction RPC does not know about the specific type of script you're trying to sign for, and won't be usable. You'll need to implement the signing logic yourself.


3

What you're seeing is the extended transaction serialization format introduced in BIP144 (segregated witness). It adds a marker 0x0001 to indicate the presence of a witness after the version number, and a list of witness stack items after the transaction inputs.


2

I have faced the same issue i was trying to creat a raw transaction with erronerous Vout (1 instead 0) bitcoin-cli createrawtransaction "[{\"txid\": \"cd32cc233298662131dab1c2f5fa7b0407879b51bfaa7e26afa4abf453951b09\", \"vout\": 1}]" "{\"data\":\"68656c6c6f20776f726c64\",\"mpCALgNebBXBJByCG7W5XPXe2NvuQCD8au\":1.10000000}" so by fixing the vout i've got ...


2

Signing the same piece of data with the same key typically produces different signatures unless you are using a deterministic signature scheme. Check if that is the case with the library you are using for signing. EDIT: Seems like python-ecdsa supports deterministic signatures


2

Do i need to sign each input in a raw transaction? Technically, yes. But software like Bitcoin Core Client signs all inputs where the private keys are known. And of course, leave unsigned/untouched all other inputs.


2

Assuming the two private keys are unrelated, the answer is no. The reason for this is simple: there are 3 unknowns (the two private keys, and the single secret k value), but only two equations (the ECDSA validation equation for both signatures). If a relation is known between the two private keys (like one is twice the other, or one is one higher than the ...


2

and other input(s) should have "00" in place. Keep in mind that you replace the "scriptsig" with "empty" and the 0x00 is the size of the empty script. non-mandatory-script-verify-flag (Non-canonical DER signature) (code 64) The problem here is the DER encoding used in your signatures. r values in a signature are positive and since each r value that you ...


2

That error message is irrelevant. SegWit introduced a new way of producing the hash digest for signing which requires the "amount" being spent to be included during hashing. This "amount" is the value of the output that is being spent not the amount of the new output you create. In your it is 0.02641617 or the actual value 2641617 in satoshi. Your step 4 ...


2

Enter output address, amount and click on pay: Decide the fee rate and click on finalize: You can export the transaction hex from bottom-left before or after signing the transaction: Make sure "Advanced Preview" is active in the preferences:


1

No, you will get an Invalid private key error. Note that if you use a correct-network private key but it is the wrong key to sign the input you provide you get a different error: Unable to sign input, invalid stack size (possibly missing key) The base58 prefix is checked against a constant value that is different for each network (main, regtest, etc) const ...


1

Bitcoind cannot tell it is a multisig input until it is signed. Prior to signing, all p2sh outputs are identical, and can be any script. Most commonly, it would either be a multisig or a p2sh-p2wsh, or a p2sh-p2wpkh, but an unsigned transaction does not contain enough information to differentiate between them. If the script's redeemscript is known to your ...


1

It can be done offline and with no synced data. Start: .\bitcoind.exe -datadir=c:\bitcoin -prune=550 -noconnect Create transaction: .\bitcoin-cli.exe -datadir=c:\bitcoin createrawtransaction '[{\"txid\":\"some taxid\",\"vout\":0}]' '{\"some target address\":a_number}' To not spend all the sum, of course, add a ...


1

createTX() doesn't sign the transaction. That is performed by sign() in wallet.js. If your private keys are offline anyway, what kind of unexpected behavior are you getting from createTX()? It wouldn't be able to sign without the keys...? New functionality was also recently merged to return the MTX before the input scripts are templated (when the public ...


1

You also need to acquire the UTXO's which are spendable by your private key. The private key in WIF private key format provides the information required to derive the pubkeyhash found in P2PKH(pubkeyhash) and P2WPKH(pubkeyhash) output scripts spendable by the private key. Deriving the pubkeyhash, or even address, can be done with BitcoinJS on the front-end....


1

You are passing the parameter with signedTx incorrectly. A JSON-RPC param key must have a value that is either an array or an object. You are passing in a string. Instead you should pass in the parameter similarly to how you did for the signrawtransactionwithkey call. You should have something like this: Dictionary<string, object> param = new ...


1

It looks like the new calls are not yet supported in btcClient. https://github.com/ruimarinho/bitcoin-core/issues/77 refers generally to your issue. v2.0.0 was released "a year ago" according to https://www.npmjs.com/package/bitcoin-core; v0.17 bitcoind, which made the change, four months ago. If you're just tinkering, you might consider downgrading your ...


1

The original Bitcoin client did not have a debug console or many things that we see in modern Bitcoin software. Furthermore, it is a compiled software (C++ needs to be compiled) so you can't inspect the thing being run for its source code. However, Satoshi did publish the source code along with the pre-compiled binary. For transaction creation, you can find ...


1

Finally I found solution and what i was doing wrong. The way of signing tx is totally correct, the problem was occurred in the other thing. Before I want to broadcast tx I calculate fee per kb (not fixed one). After signing tx - size of raw tx increses and fee amount increases accordingly. After that I should provide new change for address for change (value ...


1

ECDSA signing is not deterministic. A random number k "nonce" is used for signing, and a different nonce must be used for every signature made with the same private key. (Otherwise, the private key could be extracted by a 3rd person.) This could be a random number, as it's in your case. However, never systems generate nonce deterministically, usually using ...


1

I'm sorry but there were missing inputs when I created my Raw transaction. This error has nothing to do with BitcoinLib.


1

Ok, I found the answer after looking at some source code. For a multisig UTXO, the signature is computed using the redeem script and not the scriptPubKey from the Pay-to-Script-Hash. I am not sure why this is not treated uniformly given that the scriptPubKey contains the HASH160 of the redeem script and the net effect of the signature seems would be ...


1

You can just use bitcoin-cli signrawtransaction RAW_TX if the private keys of all inputs of that transaction are in your Bitcoin Core (or bitcoind).


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