CLI Issues when adding contact to mainnet account

My team and I have been working on a NFT distribution app utilizing the flow blockchain. We have everything working and are ready for our first event but I am having a very difficult time getting everything setup on mainnet. It is working great on testnet but I am stuck at the first step in moving it over to mainnet, getting my contracts onto our account. Here is what I have done.

  1. Created an account at port.onflow using blocto
  2. Switched my blocto account to non custodian
  3. Generated a new key in the account
  4. Updated my flow.json file on my local system with the keys and settings according to this tutorial Flow CLI Configuration - Flow Documentation
  5. Attempted to add my contract to the account using the CLI
    When I run this command
    flow -n mainnet accounts add-contract NFTController \NFTController.cdc --signer mainnet-account
    I get this error
    Command Error: [Error Code: 1006] invalid proposal key: public key 0 on account e76dc37433d8ce45 does not have a valid signature: [Error Code: 1009] invalid envelope key: public key 0 on account e76dc37433d8ce45 does not have a valid signature: signature is not valid
    You can see this on the chain at
    Transaction ID: 1b6186a61095a8dba90e39c1ae862c3fccdf2f7bd2e2300253f64f44f3024931
    When I created my account on testnet I used and used the private that I used when creating the account to sign all transactions. I did not need to generate additional keys. Everything else in the process was the same and ran w/o issues.

My question is 2 fold.

  1. Is there a way to generate a non-custodian account on flow mainnet w/o already have an existing account such as what I did on testnet-faucet
  2. Is the format at #advanced-format-1 correct for CLI v 0.33.0? If not what format should I be using?
    Any help would be greatly appreciated.

@sideninja, I saw you offer to help with CLI issues in other posts so I am tagging you here. Hopefully that is okay :slight_smile:

Thank you for tagging me. I will try to help you ofc.

  1. I don’t think there’s a faucet for mainnet cc @JeffreyDoyle but there is a fresh out of the oven non-custodial wallet you can find here Lilico - Chrome Web Store

  2. Yes the advanced format is correct in case you want to also provide signature and hashing algorithms (although be sure they are correct).

I’m not sure why it would say signature is not valid if you indeed match the address and private key and right signature and hash algos. Are you sure about the algos?

As you have followed all the steps correct, I think so when you convert your wallet address to non-custodial mode your already created public keys are revoked automatically and your new public key is created, simple this is the process.
What you have done wrong is adding the signature and hash algorithm to your public key and account address as you can see your address in the flow view source Flow View Source key Id no 3 is your key through which you will do the transactions, and please fill all the related detail to index 3 in your flow.json file and fix all the related signature algorithm and hash algorithm with that as you are doing in this transaction as this is incorrect becuase you have different signature and hash algorithms in your flow.json file.
I hope so this will solve your problem.