Error - "Contract Creation Code Storage Out of Gas"
Deploying a smart contract on blockchain platforms like Ethereum can occasionally result in errors. One common issue is the "Contract creation code storage out of gas
" error, which generally means that there isn't enough gas available to complete the transaction. This can happen due to insufficient gas fees, an incorrect private key, or poor gas estimation.
Steps to Troubleshoot
Step_1: Verify the Private Key
Ensure that the private key used to sign the transaction is correct and corresponds to the address intended for deployment. Using the wrong private key can lead to transaction failure and issues in paying the necessary gas fees.
Step_2: Check Native Asset Balance
Smart contract deployment, especially on Ethereum, can be expensive in terms of gas fees. Make sure that the blockchain address associated with the private key holds enough native assets (e.g., ETH on Ethereum) to cover the transaction cost.
The native token balance should be sufficient to pay for gas, especially if the transaction involves contract deployment, which is typically more costly than regular transactions.
Step_3: Estimate Gas requirements and Use Manual Gas Fees
Tatum automatically estimates gas fees if they are not explicitly provided. However, in volatile network conditions, the automated estimate might not be sufficient. In such cases, it's a good practice to set manual fees to ensure you have full control over the transaction costs.
Example request - Gas Estimate:
//Gas Estimate to deploy a Smart Contract
curl --location 'https://api.tatum.io/v3/blockchain/estimate' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"chain": "ETH",
"type": "DEPLOY_ERC20",
"sender": "0x0d79b1ce812b09b38de78bd6e96f494db8344561",
}'
//Response:
{
"gasLimit": 2000000,
"gasPrice": 11.489560031
}
Example request - Deployment:
curl --location 'https://api.tatum.io/v3/blockchain/token/deploy' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"chain":"ETH",
"symbol":"TTOKEN",
"name":"Tatum_Token",
"totalCap":"200000000",
"supply":"100000",
"digits":18,
"address":"0x13d9affe6dc6ed1882d5b9af836921fa8183763a",
//Manual Fees
"fee": {
"gasLimit": "2000000",
"gasPrice": "12"
},
"fromPrivateKey":"####"
}'
Step_4: Reattempt Deployment
If you've followed the above steps and the issue persists, try redeploying the contract with a higher gas limit.
Step_5: Follow the Smart Contract Deployment Guides
If you're deploying specific types of smart contracts like ERC-20 tokens, NFTs (ERC-721), or multi-tokens (ERC-1155), following detailed guides can help ensure that your deployment process is accurate.
These guides will walk you through the deployment process, ensuring that you adhere to best practices and avoid common errors.
Updated about 1 month ago