Bad request when deploying smart contract

So I'm currently trying to deploy a router smart contract. I've been building it through erdpy contract build, which has been successful (I'm on rust nightly tool chain as the Smart contract needs it). And I am now trying to deploy it, but I can't manage to do it. I keep having a 400 BadRequest from https://devnet-api.elrond.com/transaction/send.

Here are the logs from the deployment:

erdpy contract deploy
INFO:accounts:Account.sync_nonce()
INFO:accounts:Account.sync_nonce() done: 0
INFO:cli.contracts:Contract address: erd1qqqqqqqqqqqqqpgqzqv7kk893c3ftwgaekvvv9whpqcfn4kazqxq3mud36
INFO:transactions:Transaction.send: nonce=0
CRITICAL:cli:Proxy request error for url [https://devnet-api.elrond.com/transaction/send]: {'statusCode': 400, 'message': 'Bad Request'}

And here is erdpy.json used to configure the command:

{
    "configurations": {
        "default": {
            "proxy": "https://devnet-api.elrond.com",
            "chainID": "D"
        }
    },
    "contract":{
        "deploy":{
            "verbose": true,
            "bytecode": "output/router.wasm",
            "recall-nonce": true,
            "nonce": 1,
            "pem": "../../../wallets/owner/wallet-owner.pem",
            "gas-limit": 600000000,
            "send": true,
            "outfile": "deploy-testnet.interaction.json"
        }
    }
}

The contract I'm trying to deploy is the following. I've also been through the OpenAPI Spec or the documentation searching for an answer, but there is nothing about it. This route is normally returning error message, but for this specific case it is not.

Some other contract like ping-pong are working properly with the same erdpy.json config.


Solution 1:

After talking with someone who were interested into this issue, I ended up with the following command:

erdpy --verbose contract deploy --project=$PROJECT_NAME --pem="wallet-owner.pem" --gas-limit=600000000 --proxy="https://devnet-gateway.elrond.com" --outfile="elrond.workspace.json" --recall-nonce --send --chain="D"

Replace $PROJECT_NAME by the folder of your contract (you need to be one level upper than your smart contract folder).

It won't use the elrond.json file, but i guess you can move up the file to make the command use it.

Solution 2:

I have you tried to deploy with the argument --verbose?

That should be something like that (not sure of the syntax because I am on phone) erdpy --verbose contract deploy