Closed username1565 closed 5 years ago
Also you can merge your code with this web-wallet: https://github.com/ttutdxh-nubits/cointoolkit and combine the functions, which is working there.
Didn't work on either.
First of all, any tx with 0 inputs are invalid. Even coinbases have 1 dummy input... a 0 input count is an invalid transaction.
Second of all, Segwit uses the above fact to make an un-parseable transaction so that old nodes don't choke on a segwit transaction. They will see the input count is zero and not even attempt to parse the rest. (Remember, the C++ logic for Bitcoin Core parses bytes as they come in sequential order)
Sooo, if your site says "Verified" for an invalid transaction... your site is broken.
# READ AS NON-SEGWIT TX
# version
01000000
# input count = 0
00
# output count = 1
01
# first output satoshis count
a086010000000000
# first output scriptPubkey
1976a9145700e52bce4a0fceca7646a9614a46c2f364559f88ac
# TimeLock
00000000
# READ AS SEGWIT TX
# version
01000000
# SEGWIT MARKER
00
# SEGWIT FLAGS
01
# INPUT COUNT (=0xa0 =160 means we have to parse 160 inputs from now on.)
a0
# first input prevTxid
860100000000001976a9145700e52bce4a0fceca7646a9614a46c2f364559f88
# first input prevTxOut (=0xac =172 meaning you are spending the 173rd output of the above txhash tx)
ac000000
# ScriptSig Length = 0
00
# Skip scriptSig parse
....
# nSequence....... is nowhere to be found
So wherever you got this tx data from is broken... it just made you a non-segwit transaction with 0 inputs, and Coinbin rightfully tried to say "oh ok, so it's a segwit tx then" and then choked on your transaction as soon as it found no nSequence for the first input... "Hey, your data just stopped suddenly... ok error time"
Didn't work on either.
Just switch mode to "Bitcoin". Here you can decode this too: https://txid.io/wallet/#verify
How I got this transaction?
010000000001a0860100000000001976a9145700e52bce4a0fceca7646a9614a46c2f364559f88ac00000000
Of course, this is not segwit transaction, but brainwalletx is client-side and open source. Anyone can do fork and fix this or add support of segwit transactions.
P.S.:
I just want to make myself, the correctly signed raw transactions,
but on client-side, offline and in the browser,
and then, when I'll be online I can do broadcast this tx to the miners,
using online services, like this or this
or just using coinb.in API for example, using some get-query, like this (TX decode failed
).
But I don't see any web-wallet where I can do this correctly, and verify then. BrainwalletX being developed to support offline transactions, but this is still not perfect... For example, there, I cann't re-sign transaction to inject another signature, and I cann't see decoded scripts...
I don't understand segwit-innovations, but I think this may to be the backward compatible with the very first format of transactions...
Please read what I said:
The transaction you posted is an invalid format and can not be parsed by a proper application.
Any application that looks at that data and says "this is a valid transaction format" is wrong. The fact that is says "OK" when it SHOULD say "WRONG" means that the app is wrong.
Coinbin is correct here.
Here is the simplest English I can say:
This hex data:
"010000000001a0860100000000001976a9145700e52bce4a0fceca7646a9614a46c2f364559f88ac00000000"
is not a Bitcoin transaction.
Coinbin is right.
Brainwalletx and cointoolkit are wrong.
@junderw Ok, thanks. If you have free time, you can do fork and rewrite this client-side applications, just for fun, and open the pull requests. Bitcoin documentation is very hard to read and understanding.
010000000001a0860100000000001976a9145700e52bce4a0fceca7646a9614a46c2f364559f88ac00000000
Unable to decode
010000000001a0860100000000001976a9145700e52bce4a0fceca7646a9614a46c2f364559f88ac00000000
Source code: https://github.com/ttutdxh-nubits/cointoolkit
Also in coinbin-v1.2a from releases transaction verify working good, but in coinbin-v1.3 this is not working.
Fix this, please.
P.S.: You can fix this, using next code: