mandatory-script-verify-flag-failed (Script too big)

+2 votes

I issued 8000 to 15000 assets for 1 address in a loop, and when i'm trying to transfer all assets to set of other addresses some are not transferred and it gives error "Error Code: -26 Error Message: Transaction was rejected: ConnectInputs failed: mandatory-script-verify-flag-failed (Script too big)"

From my research, i found that some assets were transferred to the same address successfully and others are not getting transferred.

All addresses have connect, send and receive permissions

Can anyone suggest me a solution for this

asked Aug 22, 2019 by anjnkmr

2 Answers

+1 vote
 
Best answer

OK, so we've found the cause of this, thanks for all the information. It's actually a bug that will be fixed in the next protocol upgrade.

If this is not yet a live system, you can solve the problem by starting a new blockchain with the following parameter setting (edit params.dat before starting the chain):

max-std-element-size=1024

answered Aug 29, 2019 by MultiChain
selected Sep 3, 2019 by anjnkmr
Ok, please let us know once it is fixed.
This issue has been fixed in today's releases. If you want to keep running your old blockchain you will need to upgrade the protocol in order to spend these UTXOs:

https://www.multichain.com/developers/upgrading-nodes-chains/
0 votes
Can you please post an example of an API call you are making to transfer an asset? Are you trying to transfer a large number of assets in a single transaction?
answered Aug 22, 2019 by MultiChain
Hi, even if we are trying to send a particular asset manually using the sendassetfrom command (i.e sendassetfrom "toAddress" "assetname" "quantity") is giving the same error although many other assets got transferred to the same address successfully.

P.S : We are following the asset naming convention of multichain.
we are using top-level command "SENDASSETFROM" to transfer from one address to another address, but some are transferred and some are not
Please post a full example of an API call you are sending.
From multichain-cli we are running the following command
sendassetfrom FROMADDRESS TOADDRESS ABC-846779-9159527-3 9.0

and we get the below output
{"method":"sendassetfrom","params":["FROMADDRESS","TOADDRESS","ABC-846779-9159527-3",9.00000000],"id":"52700653-1566563054","chain_name":"chain-abc-int-1"}

error code: -26
error message:
Error: The transaction was rejected: 16: ConnectInputs failed: mandatory-script-verify-flag-failed (Script is too big)
Thanks. Can you please do the following:

createrawsendfrom FROMADDRESS '{"TOADDRESS":{"ABC-846779-9159527-3":9}}' '[]' sign

And post the output here. Then call decoderawtransaction on the output and post the result here as well. This will not reveal any private keys.
Output of createrawsendfrom FROMADDRESS '{"TOADDRESS":{"ABC-846779-9159527-3":9}}' '[]' sign

0100000001814827dd2649b90073a371316ddd1a48c42773b052eeafca6137b02f88c16a200300000000ffffffff0200000000000fdd12776a91486de661ad6377939d21df732091b9668b5f6881a88ac4dfc1f73706b7124482f0fad2a8300e620d2d4436528000a000000000000007ff8231182c3f03bd85cc8e63c9b34eb0e0100000000000003644e02c61be534586ee48f06428b040a0000000000000000624e50a3a9 .......................


Output of decoderawtransaction  on above output :

{"method":"decoderawtransaction","params":["0100000001814827dd2649b90073a371316ddd1a48c42773b052eeafca6137b02f88c16a200300000000ffffffff0200000000000fdd12776a9......."],"id":"49633615-1566625596","chain_name":"myChain-1"}

{
    "txid" : "a22bd5c0784c4483535415672be23a32eca63979b5a2e43224e511f630f27468",
    "version" : 1,
    "locktime" : 0,
        {
            "txid" : "206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881",
            "vout" : 3,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 1cc92456a40e327d48c8e92665f668d52ec917ed OP_EQUALVERIFY OP_CHECKSIG 73706b719627806bd662b9ac3ff110e6fabc1f675a00000000000000 OP_DROP",
                "hex" : "76a9141cc92456a40e327d48c8e92665f668d52ec917ed88ac1c73706b719627806bd662b9ac3ff110e6fabc1f675a0000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "TO ADDRESS"
                ]
            },
            "assets" : [
                {
                    "name" : "ABC-846779-9159527-3",
                    "issuetxid" : "671fbcfae610f13facb962d66b8027962aba3c612c1c1061e5176a1112d53ab8",
                    "assetref" : "647-1113-8039",
                    "qty" : 9.00000000,
                    "raw" : 90,
                    "type" : "transfer"
                }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        },
        {
            "value" : 0.00000000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 86de661ad6377939d21df732091b9668b5f6881a OP_EQUALVERIFY OP_CHECKSIG 73706b7124482f0fad........21b9042123acf039e08e0a00000000000000e16926c3061c33ee88e3bc7ab2b4079c0a000000000000000514f6c94fa30ee226bb0c0f3ccf9bb61e00000000000000 OP_DROP",
                "hex" : "76a914..........000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "FROM ADDRESS"
                ]
            },
            "assets" : [
                {
                    "name" : "ABC-2112264010AS-1",
                    "issuetxid" : "0028654241225e5d71219f54983d4d220e600832aad0f2f4894154edf3edecc2",
                    "assetref" : "648-28697-10240",
                    "qty" : 1.00000000,
                    "raw" : 10,
                    "type" : "transfer"
                },
            {" + rest of the assets (approx 10000) " }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        }
    ],
    "data" : [
    ]
}
Thanks, it looks like you have a large number of assets already in a single transaction output. Please confirm this by running:

gettxout 206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881 3

If this suspicion is correct, can you tell me your method of performing the asset issuance? If you use MultiChain's regular issue(from) command, it should take care not to put so many assets in a single transaction output. Perhaps you used some raw mechanism for this as well?
After running this command
gettxout 206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881 3

we found that there were multiple assets in the output. however, we are using "issuefrom" command only to issue asset

and we also found that while issuing asset we are issuing asset from node admin address to the same address (node admin address). Could this be the reason for one transaction having multiple assets?

But while transferring we use "node admin address" as from and another address as "to address"

FYI: we are using multichain1.0.6
When you say "multiple assets", how many do you mean?

You indicated above when decoding the transaction that the second transaction output had about 10,000 assets in it. I am trying to understand if this is the case with the input to that transaction.

There should be no problem issuing assets from an address back to itself.
There is a total of 25079 assets in the chain, we are issuing an asset to address inside a loop using the issuefrom command. At a time a loop will issue a maximum of 4000 assets.

After issuing the assets we will transfer the approx 3500 assets in a loop after a specific application event arises, here we are getting Script is too big error
I was asking how many assets are shown in the output of:

gettxout 206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881 3
Sorry,
Earlier we assumed that they were approx 10,000 (As our assets count is nearly 10,000 at that time) but we checked the exact count of the assets in the transaction output of the command and got 424.

We carried out some other asset transfers, Will that affect the asset count in that command output?
OK, so please tell me the asset count in the transaction input as well. Use:

gettxout 206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881 3
If this UTXO is no longer available, we will need to start again. For a new transaction that is failing, please send the output of decoderawtransaction including an exact count of assets in each output, as well as the output of gettxout on the input spent by that transaction (see "txid" and "vout" fields of "vin" structure of the output of decoderawtransaction) including that input's count of assets.
The UTXO was available so we ran the gettxout command and got 424 assets.

Output of the command "gettxout 206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881 3"

{"method":"gettxout","params":["206ac1882fb03761caafee52b07327c4481add6d3171a37300b94926dd274881",3],"id":"92830864-1566995309","chain_name":"my-chain"}

{
    "bestblock" : "00d7b140ca6f6e3acac8d2893a3fe0d864583d7f494ea53d89ad03e1dc163101",
    "confirmations" : 11253,
    "value" : 0.00000000,
    "scriptPubKey" : {
        "asm" : "OP_DUP OP_HASH160 86de661ad6377939d21df732091b9668b5f6881a OP_EQUALVERIFY OP_CHECKSIG 73706b7124482f0fad2a830....00000000 OP_DROP 73706b7129c02aa.........0000000000000 OP_DROP",
        "hex" : "76a91486de661a.........cf9bb61e0000000000000075",
        "reqSigs" : 1,
        "type" : "pubkeyhash",
        "addresses" : [
            "FROM ADDRESS"
        ]
    },
    "version" : 1,
    "coinbase" : false,
    "assets" : [
        {
            "name" : "ABC-214-015-1",
            "issuetxid" : "00286543d4d220e600832aad0f2f48241225e5d71219f549894154edf3edecc2",
            "assetref" : "648-28697-10240",
            "qty" : 1.00000000,
            "raw" : 10
        },
+ 463 ASSETS
"permissions" : [
    ]
}
...