7

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


6

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


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 }]''' '{"...


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


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

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

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

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


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

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


2

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


2

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


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

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.


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


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

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


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.


1

Values from 1-75 represent a number of bytes to be pushed into the stack. I that case, 14 hex is 20 dec, and will push the 20 bytes of the hash160.


1

First of all, these are not P2SH-P2WPKH, these are normal P2WPKH outputs. They are not related to P2SH at all. The problem here is probably that the amount is incorrect. If you are providing the previous output data yourself, then the amounts is incorrect. You have it as 0.000560 but the actual amount is 0.00055999. Since Segwit commits to the amount in the ...


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

You can use signrawtransaction, this method accept an array of private keys as an argument. Parameter #3—private keys for signing: An array holding private keys. If any keys are provided, only they will be used to sign the transaction (even if the wallet has other matching keys). If this array is empty or not used, and wallet support is enabled, ...


1

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


1

The hex-encoded transaction itself looks okay to me at first glance. When you send it, do you get an error? It could just be that you have a transaction fee of zero, try increasing the fee (by reducing the amount in your only output) and try again.


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