how bitcoin reject invalid transaction? (with createrawtransaction)

0

i'm studying 'Mastering Bitcoin' and have a questions,

in this book, we can send coin to other wallet by createrawtransaction but there is no enough secure method.

we can find other's wallet addresses at https://www.blockchain.com. and unused coin value too.

for example - https://www.blockchain.com/en/btc/address/34bN2MQcqA4JpbEVRU9KBsvhXgSEHQrqBz

718ae88f0eb13d2f2d3bc74cbf18721a82739b80f1bfc0658ed699263fca76fd(Fee: 0.00002057 BTC - 3.11 sat/WU - 8.33 sat/B - Size: 247 bytes) 2019-01-14 04:57:04 34bN2MQcqA4JpbEVRU9KBsvhXgSEHQrqBz (1.13215222 BTC - Output) 32T5urH6uN4jhKenhW4LWM66WouzSCERbA - (Spent) 0.03213165 BTC 3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw - (Unspent) 1.1 BTC

than we can make fake transaction such as

$bitcoin-cli createrawtransaction '[{"txid" : "718ae88f0eb13d2f2d3bc74cbf18721a82739b80f1bfc0658ed699263fca76fd","vout":0}]' ' {"MY WALLET ADDRESS": 1.0, "3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw": fee}'

in conclusion, it doesn't works but i want know why this code not working

user10865941

Posted 2019-01-15T06:59:57.837

Reputation: 11

Answers

3

in conclusion, it doesn't works but i want know why this code not working

This part {"MY WALLET ADDRESS": 1.0, "3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw": fee} will throw an error, but the more general answer about security is:

You can only generate a valid transaction if the wallet file you have open contains the private keys that can sign the transaction you've made. If you can't produce a valid signature, then it will not be a valid transaction, and the network will not relay or confirm it.

chytrik

Posted 2019-01-15T06:59:57.837

Reputation: 10 276

i think createrawtransaction working [{"txid ", "my wallet address", "another wallet address"}] so where is validation part on this command?user10865941 2019-01-15T09:47:58.890

@user10865941: All other nodes validate the transaction - they check that you have provided proof that you posess the private key.RedGrittyBrick 2019-01-15T10:05:29.867

@user10865941 the output of createrawtransaction is an unsigned bitcoin transaction. Next you would need to call signrawtransaction to create a valid transaction, but your client will be unable to do so unless it has the relevant private keys. If you cannot produce a valid signature, then the network will not accept it as a valid transaction.chytrik 2019-01-16T01:41:14.487

0

You cannot spend bitcoins of a given BTC address if you do not own the private key of such address. Only private keys allows you to sign and broadcast a valid spendable tx.

It's safe to specify also some peculiarity of creatrawtransaction RPC:

The createrawtransaction RPC command creates an unsigned transaction that will spend a previous output to a new output with a P2PKH or P2SH address. The transaction is not stored in the wallet or transmitted to the network at this stage. It needs to be signed with a valid corresponding private key for the address we want to spend address from.

Given Parameter #1 (references to previous outputs) & Parameter #2 (P2PKH or P2SH addresses and amounts) we get a result in the forum of an unsigned raw transaction in hex.

AG23

Posted 2019-01-15T06:59:57.837

Reputation: 29

i guess! rawtransaction needs signing. so without signrawtransaction, block will reject this transactionuser10865941 2019-01-16T05:46:21.233