Ich verstehe, dass "OP_CHECKSIG" dies tut, aber ich kann nicht sehen, wie ich es neu erstellen kann. Ich habe SHA1 und SHA256 einiger Informationen in einer bestimmten Bitcoin-Transaktion ausprobiert, aber es hat mir keine bestätigten Werte von Z gegeben. Kann jemand bitte eine Transaktion auswählen, mir sagen, welche es ist, und mir zeigen, was ich ausschneiden und einfügen muss in einen SHA1-Rechner, um den tatsächlichen Z-Wert zu erhalten?
The hash value of TX 9ec4bc49e828d924af1d1029cacf709431abbde46d59554b62bc270e3b29c4b1 is supposed to be z = c0e2d0a89a348de88fda08211c70d1d7e52ccef2eb9459911bf977d587784c6e and also z = 17b0f41c8c337ac1e18c98759e83a8cccbc368dd9d89e5f03cb633c265fd0ddc but I do not see how the z values are achieved.
0) lesen Wie löse ich eine Basis-Tx ein?
1) Nehmen Sie Ihre Transaktion als Array von Bytes
2) Ersetzen Sie alle Eingabeskripte durch leere Skripte
3) Ersetzen Sie ein Eingabeskript durch das ursprüngliche "OP_DUP OP_HASH160 ..."
4) "Hash-Code-Typ" SIGHASH_ALL anhängen
5) nimm sha256 ( sha256 ( Daten ) )
das ist alles
Schau mal in meinen Code
const MyKey32 Transaction::getRawHash ( const int n, const QByteArray& scr ) const
{
MyByteArray ret; // create empty array
Stream stream ( s );
ret.putInt32 ( stream.readU32 ( ) ); // version
ret.putVarInt ( stream.readVar ( ) ); // input count
for ( int i ( 0 ); i < inputs; i++ ) // copy all inputs
{
ret.append ( stream.readHash ( ) );
ret.putInt32 ( stream.readU32 ( ) );
stream.skipVarData ( ); // skip original script
ret.putPrefixed ( i == n ? scr : QByteArray ( ) ); // !!! script replacement
ret.putInt32 ( stream.readU32 ( ) );
}
ret.putVarInt ( stream.readVar ( ) ); // output count
for ( int i ( 0 ); i < outputs; i++ ) // copy all outputs byte-by-byte
{
ret.putInt64 ( stream.readU64 ( ) );
ret.putPrefixed ( stream.readVarData ( ) );
}
ret.putInt32 ( stream.readU32 ( ) ); // lock
ret.putInt32 ( SIGHASH_ALL ); // !!! append hashcode
return MyKey32 ( ret.constData ( ), ret.size ( ) ); // create hash256 of array
}
Mine
Amaclin
Mine