OutCast3k / coinbin

Javascript Bitcoin Wallet. Supports Multisig, Stealth, HD, SegWit, Bech32, Time Locked Addresses, RBF and more!
https://coinb.in/
MIT License
906 stars 621 forks source link

scriptsig-not-pushonly (code 64) #242

Open jsim77 opened 3 years ago

jsim77 commented 3 years ago

I'm using Coinb.in and so far from Create Raw Transaction up to Sign Transaction, everything is okay except for Broadcast Transaction as I received the above-mentioned error code --> scriptsig-not-pushonly (code 64)

Okay this is the encoded bitcoin transaction which I've input under the Broadcast section:

0100000001000000000000000000000000000000000000000000000000000000000000000000000000210330e40ac3f32626310b0c265600d054b554060be3c9512cc0067da60db5353e14feffffff0100c39dd0000000001976a914ddca50bf194b13f3174073790c0fb62d84e3167188ac00000000

scriptsig-not-pushonly (code 64)

Okay before that, I'm creating a New Transaction so which means by logic, I don't have a Transaction ID, which is why I put all zeros. Also, throughout this transaction, I'm using the Segwit and Normal generated address in CoinB.in itself and there is no external wallet or private key here.

Any advice? Appreciate your kind advice to resolve this. Show me the mistakes, thanks in advance.

junderw commented 3 years ago

Your first input's scriptSig is just a raw public key without a push byte, so it is reading the 0x03 at the beginning of the public key as "push 3 bytes", which pushes 0x30e40a to the stack, then it tries reading the next byte as an op code which is 0xc3 which is an invalid op code.

Since scriptSig must only contain push data directives, this causes the error.

That said, an input pointing to a transaction id of all 0s is invalid, since such a transaction does not exist.

In order to send bitcoin you must first RECEIVE bitcoin. The transaction ID you use in your transaction is the ID of the transaction where you RECEIVED bitcoin. You then add an output to send however many bitcoin you want to wherever you're sending it... then you add another output back to yourself (this is known as change).

I highly recommend against using Coinbin with real money if you do not know these very basic things about bitcoin (and related coins)

Please play around with some testnet coins first until you understand how coinbin works. If you lose a bunch of testnet coins at least they're not worth anything.

jsim77 commented 3 years ago

Overall, I understand what you meant. Thanks ya