I see this input script:
4C141F8B0800FFC1765400038D78055C545DF3FF5D4A4C141F8B0800FFC1765400038D78055C545DF3FF5D4A4C141F8B0800FFC1765400038D78055C545DF3FF5D4AA94C141C18EB2E89217B39A344622D3EAF2368F220674788A94C141C18EB2E89217B39A344622D3EAF2368F220674788A94C141C18EB2E89217B39A344622D3EAF2368F220674787
4C is OP_PUSHDATA, saying next byte is # of bytes that go onto stack. Next byte is 14, which is decimal 20 bytes on stack... you say you want to push DATA1 (520 bytes) on stack?
520 bytes is hex 0x208, so maybe you want to say PUSHDATA 0x208 <520 bytes>?
520 bytes written from the source of the script. But I use three identical parts of 20 bytes to make it easier. They are also the same to make it easier to replace the hash because it's not entirely clear how to get the hash160. I know that first I need to hash in sha256 and then in RIPEMD160 but there are different values depending on the case of letters after hashing in sha256 and I do not know what case exactly is needed. For example hash160 of OP_TRUE should be da1745e9b549bd0bfa1a569971c77eba30cd5a4b but when I'm hashing 51 with sha-256 I get 031b4af5197ec30a926f48cf40e11a7dbc470048a21e4003b7a3c07c5dab1baa ripemd160 of which d3212ee812e38323ebb60b193c5d54bd55728b38 and what's wrong?
And: "Data push larger than necessary" indicates a situation, where you use 2 opcodes, whereas a single one would be fully sufficient. Hence when pushing 20 bytes (hex 14) to stack, a single command "0x14" is sufficient (
https://en.bitcoin.it/wiki/Script).
From another thread, I copied this comment into one of my scripts:
# 1.) OP_PUSHDATA1 and even OP_PUSHDATA2 are allowed inside P2SH scripts fine.
# However, there is another policy in Bitcoin Core to require that all pushes
# are minimal in standard transactions. That means you can only use
# OP_PUSHDATA1 when a direct push is not possible (up to 75 bytes), and only
# use OP_PUSHDATA2 when an OP_PUSHDATA1 is not possible (up to 255 bytes).
This is very useful, thank you.
But for now I have transaction:
020000000001019e1ab6b4683d58a37f969991304798bbbf7687599f057de0ae61f92945fd12160 000000085141f8b0800ffc1765400038d78055c545df3ff5d4a141f8b0800ffc1765400038d7805 5c545df3ff5d4a141f8b0800ffc1765400038d78055c545df3ff5d4a45a9147348ade0b3cbbc86a 50396bfdccb047525ee890288a9147348ade0b3cbbc86a50396bfdccb047525ee890288a9147348 ade0b3cbbc86a50396bfdccb047525ee890287ffffffff02801d2c040000000017a9141a75cd53e 9740caadbf83cbefdd087cdceb978a48760F590000000000017a914ceb069bfa77f4a589e63eb4a d022ef122100453887024830450221008cf6b0c4741be13e058e33123b337836da4eb487dde98da 9adc7a26cf3b7b6f10220369d85d178a2af9b34af8104c46822b353e59371ebe8310e1095ad96f9 c128cc012102ada9884dbd1e8bd90968ba66256f017cd77d83595027f7929ae3537f98c92d4a000 00000
Input script of which
141f8b0800ffc1765400038d78055c545df3ff5d4a141f8b0800ffc1765400038d78055c545df3f f5d4a141f8b0800ffc1765400038d78055c545df3ff5d4a45a9147348ade0b3cbbc86a50396bfdc cb047525ee890288a9147348ade0b3cbbc86a50396bfdccb047525ee890288a9147348ade0b3cbb c86a50396bfdccb047525ee890287
In this script I perform: OP_PUSHDATA < Data 1 (20 bytes) >OP_PUSHDATA < Data 2 (20 bytes) > OP_PUSHDATA < Data 3 (20 bytes) > OP_PUSHDATA < RedeemScript > where RedeemScript pattern as in first my message. And for now I get error code=-26, message=16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element).
Also I have one more question. As I understand hash of RedeemScript should be equal output of previous transaction. So in my case should I firstly create transaction with output which equals of hash160(a9147348ade0b3cbbc86a50396bfdccb047525ee890288a9147348ade0b3cbbc86a50396bfdccb0
47525ee890288a9147348ade0b3cbbc86a50396bfdccb047525ee890287)?