Search content
Sort by

Showing 20 of 207 results by MixMAx123
Post
Topic
Board Development & Technical Discussion
Topic OP
MOVED: scantxoutset example
by
MixMAx123
on 21/01/2024, 01:49:39 UTC
Post
Topic
Board Development & Technical Discussion
Topic OP
MOVED: Bitcoin Core RPC Security Concerns
by
MixMAx123
on 21/01/2024, 01:48:10 UTC
Post
Topic
Board Development & Technical Discussion
Topic OP
MOVED: Provide the signature hash
by
MixMAx123
on 21/01/2024, 01:46:01 UTC
Post
Topic
Board Development & Technical Discussion
Topic OP
MOVED: btc-rpc-explorer
by
MixMAx123
on 21/01/2024, 01:42:30 UTC
Post
Topic
Board Development & Technical Discussion
Merits 2 from 1 user
Re: Error: Script was NOT verified successfully.
by
MixMAx123
on 19/01/2024, 23:03:06 UTC
⭐ Merited by ABCbits (2)
I see they haven't spent it yet.
Here are some things to check:
Code:
Tx-ID:    93176f012b10c8889023329f3f1de24755461764f55876f0f5cef3e2914e5c54
prevHash: c53efc1e8592cbe103c732a1dae6f94c339a529190ee1ee9ee3699fa9f711c96
prevId:   0
SigHash:  908eb3dc1eeb3bbe81a8c9a021ef1d5c18099c89bd05a2820c645bd6341001d1
SigR:     009ce0f2e09109b7890329813d62feac316183287c1da9e06c4119d8c49fb5388f
SigS:     1ed7a92550c11a8ab4c7025c0f4371fd1039d7f46b0842fa78f424df3f2d7fd4
PubKey:   038b0254d8b428b0516b9337ce48f7549eb429637c8fa445ee7594eda21c511762
The signature is NOT correct!
Post
Topic
Board Development & Technical Discussion
Re: Segwit raw transaction decoder
by
MixMAx123
on 17/01/2024, 05:26:43 UTC
In that case, please show me a witness transaction only Legancy inputs in the blockchain.

You were right about only legacy inputs transaction since that's what the last sentence of the quote also says. It's at the beginning of the document btw. My question now is how to construct the witness in the following case:

but what if only some of the inputs are segwit?
= segwit

Good question.
Funnily enough, I am currently busy with the same task.
When I'm done, I'll report. :-)
Post
Topic
Board Development & Technical Discussion
Re: Segwit raw transaction decoder
by
MixMAx123
on 17/01/2024, 04:05:04 UTC
So if there is no segwit input, it basically means there is no marker, flag, witness field, etc. but what if only some of the inputs are segwit?
= segwit
Post
Topic
Board Development & Technical Discussion
Re: Segwit raw transaction decoder
by
MixMAx123
on 17/01/2024, 04:03:22 UTC
I am relatively certain that in this case you are not allowed to create a Segwit transaction. It must be a legancy TX!
= Segwit


Post
Topic
Board Development & Technical Discussion
Re: Segwit raw transaction decoder
by
MixMAx123
on 17/01/2024, 03:56:02 UTC

They're all UTXOs from a legacy address so I figured that the witness array still needs to be the total length of the inputs.


I am relatively certain that in this case you are not allowed to create a Segwit transaction. It must be a legancy TX!
Witness Field also not permitted in this TX!
Witness field may only be inserted if at least one input comes from a Segwit address.

BIP141 says this:

Quote
The witness is a serialization of all witness fields of the transaction. Each txin is associated with a witness field. A witness field starts with a var_int to indicate the number of stack items for the txin. It is followed by stack items, with each item starts with a var_int to indicate the length. Witness data is NOT script.

A non-witness program (defined hereinafter) txin MUST be associated with an empty witness field, represented by a 0x00. If all txins are not witness program, a transaction's wtxid is equal to its txid.



I don't find this statement in GDP 141.
But I remember reading it.
Possible that I am wrong.
In that case, please show me a witness transaction only Legancy inputs in the blockchain.

So if there is no segwit input, it basically means there is no marker, flag, witness field, etc. but what if only some of the inputs are segwit?

I am not sure what the witness is supposed to be in this case.

In this case, hypothetically if there were 8 witness items, they would not be specified as 00 x8 times, but 08 as the stack length and then each stack (containing the relevant scriptsig)?

And if only half of them were witnesses, then it's 04 as stack length and then the 4 stack items?

How does Core even keep track of which input a witness belongs to if there are legacy inputs scattered in the middle?
Post
Topic
Board Development & Technical Discussion
Re: Segwit raw transaction decoder
by
MixMAx123
on 17/01/2024, 03:18:01 UTC

They're all UTXOs from a legacy address so I figured that the witness array still needs to be the total length of the inputs.

I have not tested with a bech32 address yet, because I was busy verifying that legacy transaction creation works (it does).

I am relatively certain that in this case you are not allowed to create a Segwit transaction. It must be a legancy TX!
Post
Topic
Board Development & Technical Discussion
Re: Segwit raw transaction decoder
by
MixMAx123
on 17/01/2024, 00:41:08 UTC
The witness data + locktime at the end (hex):

0000000000000000

There are 8 inputs in the transaction.

Are you sure that at least one of the 8 inputs comes from a Segwit address?
At least one input must contain witness data!
I'm guessing this transaction needs to be signed in Legancy format.
Can they publish the entire transaction?
Post
Topic
Board Development & Technical Discussion
Topic OP
btc-rpc-explorer
by
MixMAx123
on 12/01/2024, 00:33:07 UTC
My favorite block explorer: https://bitcoinexplorer.org/
is no longer online for testnet.
Where else is this explorer hosted? https://github.com/janoside/btc-rpc-explorer
Post
Topic
Board Development & Technical Discussion
Re: [For Developers] n0nce's Bitcoin Testnet Faucet [~10 tBTC]
by
MixMAx123
on 11/01/2024, 23:58:58 UTC
Unfortunately, coins never came back.



I work on a full Bitcoin wallet in my free time. Without a team in the background. And I have no hurry because it is not a commercial project.
So I need the coins for a longer period of time and a lot of extensive tests. It is quite possible that I still need coins for testing in a year.
At the moment I have just completed Witnes-P2SH transactions.
I would like to thank you politely for the borrowed coins!
I have just transferred the coins back to their address. 60dd8b69d64033b134421832d47d836b8368ff93a48740e23badca78635061b0

Post
Topic
Board Development & Technical Discussion
Re: Why cant get RSZ from Bitcoin Transaction?
by
MixMAx123
on 06/01/2024, 14:02:15 UTC
In the section: P2SH-P2WPKH
Code:
 hashPrevouts:
    dSHA256(db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a547701000000)
  = b0287b4a252ac05af83d2dcef00ba313af78a3e9c329afa216eb3aa2a7b4613a
The last 4 bytes "01000000" are not clear to me where they come from.
It's the second option.
It is the 'Transaction ID' and 'Output Index' of the input(s).

You can refer to the other examples which work similarly but used different sighash flag that are different from the prevIndex.

Yes, that's plausible.
Thank you very much, they helped me a lot!
I'd like to send you merit, but I don't have any more.
Post
Topic
Board Development & Technical Discussion
Re: Why cant get RSZ from Bitcoin Transaction?
by
MixMAx123
on 05/01/2024, 22:44:18 UTC
I would need some help at one point.
It is about the documentation of: https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki
In the section: P2SH-P2WPKH
Code:
  hashPrevouts:
    dSHA256(db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a547701000000)
  = b0287b4a252ac05af83d2dcef00ba313af78a3e9c329afa216eb3aa2a7b4613a
The last 4 bytes "01000000" are not clear to me where they come from.
There are two possibilities that could be confused.
Option 1: It could be the HashCode. "01000000"
Option 2: It could be the index of the previous transaction. (prevIndex) "01000000".
In both options, it would be "01000000". And there would be an error in my implementation if the prevIndex has a different value.
Thank you very much
Post
Topic
Board Development & Technical Discussion
Re: Why cant get RSZ from Bitcoin Transaction?
by
MixMAx123
on 02/01/2024, 12:59:33 UTC
Code:
02000000
a8ea6358b5a2efe25e5b6813b5298c603666c90b3061eea0aed7108588ce6f52
18606b350cd8bf565266bc352f0caddcf01e8fa789dd8a15386327cf8cabe198
e977d313dd88253458ea455fd4a8256453acd7ad193b2c72ae376492ed338e1f01000000
1976a9148e6e804524d16ff27b51fa0b0e65463028ffd4b888ac
77cd300000000000
feffffff
8942f7fbf60d9102e812e3d720d2c0918f68b1dbb3cd7e76366ddf055e051f56
0a6a1800
01000000

Thank you for that too! This is really very useful!
Post
Topic
Board Development & Technical Discussion
Re: Why cant get RSZ from Bitcoin Transaction?
by
MixMAx123
on 02/01/2024, 12:29:00 UTC
That transaction's Z-value should be:
Code:
67927cd4db3a11cd954cf8903f65f1ddbd0e601cba1a3b74cf1136e53f509592

Very nice! The Sighhash is right!
Thank you very much, that helps :-)
I will now take a lot of time to dig through the BIP143!
I hope I can do it alone if I haven't been angry with me if I have to ask again.
Many thanks to everyone who also helped here and posted helpful links :-)

Post
Topic
Board Development & Technical Discussion
Re: Provide the signature hash
by
MixMAx123
on 01/01/2024, 22:25:03 UTC
How are you doing the hashing?

are you SHA256 hashing twice?


Here's my Java code. This calculation does not work for P2SH transactions. This affects multisignature address with the 3 at the beginning.
To fix the method, I need a reference. So I need to know what's right. Hence my questions here.

Code:
public byte[] getSigHash(byte[] pkScript, byte[] valueRaw, int txIndex) throws Exception
{
if(isWitness)
{
byte[][] txPrev = getTxPrevHashNoSwap();
byte[][] prevIndex = getTxPrevIndexByte();
ByteArrayList list = new ByteArrayList(new byte[0]);
for(int i=0; i<txIn_count; i++)
{
list.add(txPrev[i]);
list.add(prevIndex[i]);
}
byte[] nVersion = getVersion_byte();
byte[] hashPrevouts = Calc.getHashSHA256(Calc.getHashSHA256(list.getArrayAll()));
list = new ByteArrayList(new byte[0]);
for(int i=0; i<txIn_count; i++) list.add(getSequence()[i]);
byte[] hashSequence = Calc.getHashSHA256(Calc.getHashSHA256(list.getArrayAll()));
list = new ByteArrayList(new byte[0]);
list.add(txPrev[txIndex]); list.add(prevIndex[txIndex]);
byte[] outpoint = list.getArrayAll();
PkScript pk = new PkScript(pkScript);
byte[] b = {0x19,0x76,(byte)0xa9,0x14};
list = new ByteArrayList(b);
list.add(pk.getHash160());
list.add((byte) 0x88); list.add((byte) 0xac);
byte[] scriptCode = list.getArrayAll();
byte[] amount = valueRaw;
byte[] nSequence = getSequence()[txIndex];
byte[] hashOutputs = new byte[witness_pos-value_pos[0]];
System.arraycopy(data, value_pos[0], hashOutputs, 0, hashOutputs.length);
hashOutputs = Calc.getHashSHA256(Calc.getHashSHA256(hashOutputs));
byte[] nLockTime = getLockTime();
byte[] nHashType = {1,0,0,0};
list = new ByteArrayList(nVersion);
list.add(hashPrevouts);
list.add(hashSequence);
list.add(outpoint);
list.add(scriptCode);
list.add(amount);
list.add(nSequence);
list.add(hashOutputs);
list.add(nLockTime);
list.add(nHashType);
return Calc.getHashSHA256(Calc.getHashSHA256(list.getArrayAll()));
}
else
{
ByteArrayList list = new ByteArrayList(data);
for(int i=txIn_count-1; i>=0;i--)
{
int pos = sigScript_pos[i]-1;
list.remove(pos, pos + sigScript_len[i]+1);
if(i==txIndex)
{
list.insert(pkScript, pos);
list.insert((byte)pkScript.length,pos);
}
else list.insert((byte)0x00, pos);
}
byte[] b = {0x01, 0x00, 0x00, 0x00};
list.add(b);
byte[] uSigTx =  list.getArrayAll();
return  Calc.getHashSHA256(Calc.getHashSHA256(uSigTx));
}
}
Post
Topic
Board Development & Technical Discussion
Merits 1 from 1 user
Re: Provide the signature hash
by
MixMAx123
on 01/01/2024, 21:08:34 UTC
⭐ Merited by hugeblack (1)
Unfortunately, the signature -Hash is not included on this website.
Could someone please calculate me the Signature Hash for this transaction?
Code:
TxID: ac919ea7cd1564fe0826851076041d58185b2ca04f2305f22dd60b63ac476913
Addres:             2NDRD773hJ2aJNNgKNH45CYCzPWQmL6vs5a
prev PkScript: a914dd45f04f230f752dc1236e5cc830a1bcce74f9db87
Value: 77cd300000000000
Sig R: 0d8e8eaa6ecaa92eae1208b04fd6306f02bc66078fab46c9a60bfbf94a49ee18
Sig S: 770a265fe229918c0d67b0bc73dc4408248939d2b261f2b6ea4b7c9c5bcd123c
PubKey: 02b17450a1cabad6f734df66e4ea6a85882c8a14ce350733a20f83f2f10448803e
Post
Topic
Board Development & Technical Discussion
Re: Why cant get RSZ from Bitcoin Transaction?
by
MixMAx123
on 01/01/2024, 20:46:34 UTC
Calculation Z for Legancy addresses is simple. I need the calculations of Z for P2SH Witness Transacons.
For example this one?

TestNet TxId:  ac919ea7cd1564fe0826851076041d58185b2ca04f2305f22dd60b63ac476913
Adresse:         2NDRD773hJ2aJNNgKNH45CYCzPWQmL6vs5a