I am deploying an ink! smart contract to a local network, but when I tried to call any function from it i have this error:
> { Err: { Module: { index: '8', error: '0x02000000' } } }
Does anyone have any idea what is causing the error and why?
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityI am deploying an ink! smart contract to a local network, but when I tried to call any function from it i have this error:
> { Err: { Module: { index: '8', error: '0x02000000' } } }
Does anyone have any idea what is causing the error and why?
You can dry-run the transaction and receive more human-friendly errors, as far as I remember using https://contracts-ui.substrate.io/ you will always see dry-run result before submitting the tx
Can you share your runtime file? To understand what the error: { Err: { Module: { index: '8', error: '0x02000000' } } }
means we have to check the runtime code in your Substrate node.
The index number
is the index of the pallet in the runtime from which the error originated. The error
is the index of that pallet's errors (in hex) which is the exact one we're looking for. Both of these indices start counting from 0.
For example if you are running the substrate-contracts-node we can see that the index 8 refers to pallet Contracts (see code here). If we go now to the pallet Contracts code we can see that the error in the position 0x02000000
(2 in hex) is OutOfGas (see the code here).