Developers Forum for XinFin XDC Network

DZariusz
DZariusz

Posted on

[WIP] Hardhat deployment issue on XDC Apothem testnet

When I setup hardhat like this:

    xdc_sandbox: {
      url: 'https://rpc.apothem.network',
      accounts: [***],
      chainId: 51,
      gasPrice: 'auto'
    },
Enter fullscreen mode Exit fullscreen mode

I got setup from https://docs.xdc.community/get-details/networks/apothem

and when I try to deploy hardhat deploy --network xdc_sandbox

I'm getting error about insufficient funds for intrinsic transaction cost.
However, when I check wallet balance on https://explorer.apothem.network/ I see I have 1000 XDC:

printscreen of balance on testnet explorer

There are other EVM networks configured and deployment script works for them.

I printed out data

console.log(`deploying on ${hre.network.name} (${await hre.getChainId()})`);
console.log(`balanceOf(${deployer.address}): (${await hre.ethers.provider.getBalance(deployer.address)})`);
Enter fullscreen mode Exit fullscreen mode

and I got:

deploying on xdc_sandbox (51) 
balanceOf(***): (0)
Enter fullscreen mode Exit fullscreen mode

so for some reason hardhat does not see balance or RPC returns invalid state of the blockchain.

packages:

    "@nomiclabs/hardhat-ethers": "~2.2.3",
    "@typechain/ethers-v5": "~10.1.0",
    "@typechain/hardhat": "~9.1.0",
    "ethers": "~5.7.2",
    "hardhat": "~2.14.0",
    "hardhat-deploy": "~0.11.44",
    "hardhat-deploy-ethers": "~0.3.0-beta.13",
Enter fullscreen mode Exit fullscreen mode

Discussion (4)

Collapse
ruslan_wing profile image
ruslan wing

Please use following RPC erpc.apothem.network to deploy a smart contract

Collapse
gzliudan profile image
Daniel Liu

Yes, please use 0x-prefix PRC node, such as:

Collapse
dzariusz profile image
DZariusz Author

erpc.apothem.network worked at begin (I was able deploy contracts and send few "normal" transactions) and then it stoped working - I was not able to do any calls, request for balance returner 0 even if wallet has founds. I switched to earpc.apothem.network and it started to work again.

Thread Thread
gzliudan profile image
Daniel Liu

You can try erpc.apothem.network again. It's normal now.