13

Yes! The trick is to count each input with its effective value rather than its nominal value. Transactions are composed of three parts: the overhead, the inputs and the outputs. Outputs: The size of the output scripts is determined by the recipient addresses, so their size is given by the transaction instructions. We do not know whether we will need a ...


8

The bolded byte in the following raw transaction is the number of outputs (two in this transaction): ...


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 ...


6

The issue here is that the two transactions are different, and combinerawtransaction does not operate on different transactions (it apparently just silently does nothing). It sounds like you expect combinerawtransaction to take two separate transactions and create a new one which has the inputs and outputs of both transactions. (or perhaps take two ...


5

When looking at the Bitcoin Developer Reference I saw an example where they use two additional '' before and after the list of inputs in comparison to you. For your input, I also got "Error parsing JSON", but with bitcoin-cli -testnet createrawtransaction '''[{ "txid" : "12b8e7ede4992f4d30f93idj3085746951d945e39f40becebd7c290af8c2e7ad", "vout" : 0 }]''' '{"...


5

Kind of, but coin selection is hard in general. The idea is that inputs pay for themselves. It is easy to compute how much in fees you will need to pay for an input at a given fee rate. So when you do coin selection, instead of selecting on the actual value of the input, you use the value of the input minus the fees it will pay. This is known as the ...


4

EDIT: based on OPs request, I put examples in here: there are a lot of examples for different tx types on bitcoin.org, in the developer examples. Basically you will need three steps. Assuming you are on OpenBSD/MacOS/Linux, you can go this way: 1.) createrawtransaction - this is what you have already, and it looks ok. I don't know if the previous tx ID or ...


4

Try rewriting your command to bitcoin-cli -testnet createrawtransaction "[{\"txid\": \"12b8e7ede4992f4d30f93idj3085746951d945e39f40becebd7c290af8c2e7ad\", \"vout\": 0}]" "{\"mxh3H416KCRoBDiweSESew5YJyAk1nxLrN\": 0.025, \"mkrzDhhZtzQm8zgckSs4fMNrvtNJ66zaFe\": 0.0245}" as suggested by this thread.


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

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

Currently, the create raw transaction method only uses the txid and vout parameters from that argument. You can view the relevant part of the source here. For all practical purposes, you could pass in 00 for the scriptPubKey and still get the same result.


3

Body must be a string. You can use form instead of body. Reference: https://www.npmjs.com/package/request#forms


3

Yep, it is partially possible with the getblocktemplate RPC command. This is what miners routinely use to obtain the information necessary to begin mining a block. The exact parameters and response has been specified by BIP 22 and BIP 23 (an extension for pooled mining). These output values will provide the information you need: "coinbaseaux" : { ...


3

In the console do listunspent that will show you all the UTXO in your wallet including the txids. You can type help to get a list of commands, then help <command> to get details about each command


3

Here is the correct json: createrawtransaction '[{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":0}]' '{"1Ka3q3DVTBNBo2c4kVGMNzbd32RARV1FbA":12.5}' I used 0for vout, because it has to be numeric (I don't believe hex is accepted). help createrawtransaction createrawtransaction [{"txid":"id","vout":n},...] {"address":...


3

The coinbase transaction contains a single input, which has txid set to 0000000000000000000000000000000000000000000000000000000000000000 and vout set to 0xFFFFFFFF.


3

Here is the algorythm without the code: createrawtransaction with amount that you want to send assuming that fees are 0 fundrawtransaction to let your bitcoind construct final transaction, put your change address (on where you get change from unspent transaction - very important!) AND to caclulate fees that will be taken of your account for this transaction....


3

Is there any possible way to create a raw transaction using Bitcoin-cli createrawtransaction API that doesn't require spending the entire input? No. It's an inherent feature of the Bitcoin protocol that inputs must be spent entirely or not at all. It's a binary state: spent or unspent. There is no "partially spent". What I'm doing now is consuming ...


2

There are many more parameters than number of confirmations for input selection. It mainly depends on the amounts used in the outputs because eventually enough inputs have to be used to cover the costs, which means unconfirmed inputs might be used if that's all what the wallet has. If you want to control the number of minimum confirmations that an input ...


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

You are providing it an Object in JSON, not an array just as the error states. return {"txid": sourcetransaction['txid'] ,"vout":sourcetransaction['vout']} I would try creating it from a dictionary and then adding it to a list instead of building it from a string, something like: >>> inputs = {} #create the dictionary >>> inputs["...


2

The value of an output in a transaction is a 8-byte field encoded in little-endian. The value is always represented with 8 bytes no matter how small it is. Here you have the full transaction structure with sizes:


2

You need to use (simplified notation) [{addr:amount},{addr:amount}] for the outputs, not [{addr:amount,addr:amount}]. This is to permit multiple outputs with the same address (which wouldn't be valid JSON in your assumed syntax). A simpler alternative also exists, namely {addr:amount,addr:amount}.


2

You're putting the locktime in the wrong place. You have "[{\"txid\":\"myid\",\"vout\":0}]" "{\"address\":0.01, \"address\":0.01} 20" but it should really be "[{\"txid\":\"myid\",\"vout\":0}]" "{\"address\":0.01, \"address\":0.01}" 20 The locktime is a separate parameter, not part of the quoted parameter that has the transaction outputs. It goes outside ...


2

Generally, you don't have to. The normal workflow is: Use listunspent to identify the outputs you want to use (if any). Use createrawtransaction to construct a raw transaction with the outputs you want to create (excluding change) and inputs you want to use (if any). Use fundrawtransaction to let bitcoind add a change output back to itself (and additional ...


2

The Bitcoin Wiki entry for OP_CHECKSIG answers your question. OP_CHECKMULTISIG works the same way, just applied to each signature in the sequence. First of all, it depends on the SIGHASH type you, as the signer, choose. Most likely you will use the default SIGHASH_ALL for each of the required signatures, but you could actually use different SIGHASH methods ...


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 ...


1

Don’t know what this is: 02 It's the number of outputs in the transaction.


1

A very generic question, so only a generic answer. I think, what you are looking for is how to create a transaction with multiple inputs, to a single output. There are many bitcoin tools out there, I for myself use some shell scripts on unixoide systems. There is also bx and tx tools, as described in Andreas‘ book „Mastering Bitcoin“ (book is online readable)...


1

It's a push op code. 0x14 (20 in decimal) tells the script to that the next 20 bytes must be pushed to the stack (the hash). You can view a full list of OP_CODEs here.


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