Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RpcError: 16: mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation) #84

Closed
Frazer-dl opened this issue Sep 9, 2022 · 1 comment

Comments

@Frazer-dl
Copy link

Frazer-dl commented Sep 9, 2022

Hi!
When I have 1 input I am signing it with my private key and send it successfuly.
But now I have 3 inputs, balance 0.29, 0.29, 0.009 and want to send 0.5.
When I am trying to send signed txs with 3 different inputs I have RPC error:
RpcError: 16: mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation)
Summarizing; I have 1 private key and derive it using input.type, input.index.

Could you please explain what I am missing ?

My sign code is:

        let j = 0;
        for (const input of inputs) {
            //getting derived private key for input addresses
            const privKey = this.getPrivKeyForAddress(opts.masterPrivateKey, input.type, input.index);
            zenTX = zencashjs.transaction.signTx(zenTX, j, privKey, true);
            j++;
        }

My signed tx hash is:
0100000003fb1d96993073ba3c3d2234e44cf28335826d03f8a9ea2fb663bdb269edad1f9a000000006a473044022069ce076f72baa9faa11a3af0e3899e9e20097e7476cca406e53fa9a697045a60022041911f3b49387cf01b66e4d26ce18144c9943f53290552a0da06d6d470134d62012103d5ccd3be1eca7dbb98beac5509d5c51a119ba2f688ae01c366127304565fa628ffffffff1968531b9008f99ab9c9d1d44d84b3434e067e12e94ea56179d9aefc12ede754000000006a47304402205e4debe82d12bc4a4cc19b434f259b7f8f46b4c370afb4eae02a57fbfa5b85ca02205a6a822b5796bf429a2a7255e75740b7da4ee74ab2fb1b4fae31a1ea3f98e67d012102ffa20e7e566d8f9be6377a6e93baf5437c3f2a3d3217d8003c61b89c69078ae8fffffffffef681a4a25e3f219625b214d404c311075a73cf46193ce0c22735c77b70f0d0000000006a47304402206490fac8cf548451bc3e577158c6a96a948ac9d3294aa710ba47e8649d806e92022064b1f96e4db24175d39641686aaf42afeee8517f04b09484df5688147cfad9c1012102c7ea07bcaaa12e2f50cce34e9ab2c538c23cb334e850b5df0dea2882dfe39d43ffffffff0283886203000000003f76a91458124d01c5102cc3f14956a1a5ec137e12c24a5d88ac204de424e2f383062ed41f28bd1221d9ea22aa42ac79e7e5db922464000000000003616f12b48d1b3a00000000003f76a914028d839813eeb07719946125786128009a10189b88ac204de424e2f383062ed41f28bd1221d9ea22aa42ac79e7e5db922464000000000003616f12b400000000

@Frazer-dl
Copy link
Author

Sorry, find the reason, I missed script pub key

@cronicc cronicc closed this as completed Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants