CLI Issues when adding contact to mainnet account

Hello,
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 Configuration | Flow Developer Portal
  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 https://testnet-faucet.onflow.org/ 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.
    Ryan

@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 https://flowscan.org/transaction/5e42bf24ae1f3456bf459e63bc786911866184308949cfa2258a9389df174071/script becuase you have different signature and hash algorithms in your flow.json file.
I hope so this will solve your problem.

Hi @sideninja getting the same :x: Command Error: [Error Code: 1009] error caused by: 1 error occurred:
* transaction verification failed: [Error Code: 1006] invalid proposal key: public key 0 on account 0215aaa5ab6bce99 does not have a valid signature: [Error Code: 1009] invalid envelope key: public key 0 on account 0215aaa5ab6bce99 does not have a valid signature: signature is not valid
when trying with testnet account created by lilico wallet I get the following error
My flow.json is
“second-account”: {
“address”: “0215aaa5ab6bce99”,
“keys”: “4378297e30ef39d7d68734af72e98bfb1f46a43687b85a2d6c8ac94aa9967351”,
“chain”:“flow-testnet”,
“signAlgorithm”:“ECDSA_secp256k1”,
“hashAlgorithm”:“SHA2_256”
}
My account in flow-view-source is
flow testnet account

Not able to find what the issue is
Could you please help on this

Hi @NasirAliShah getting the same :x: Command Error: [Error Code: 1009] error caused by: 1 error occurred:

  • transaction verification failed: [Error Code: 1006] invalid proposal key: public key 0 on account 0215aaa5ab6bce99 does not have a valid signature: [Error Code: 1009] invalid envelope key: public key 0 on account 0215aaa5ab6bce99 does not have a valid signature: signature is not valid
    when trying with testnet account created by lilico wallet I get the following error
    My flow.json is
    “second-account”: {
    “address”: “0215aaa5ab6bce99”,
    “keys”: “4378297e30ef39d7d68734af72e98bfb1f46a43687b85a2d6c8ac94aa9967351”,
    “chain”:“flow-testnet”,
    “signAlgorithm”:“ECDSA_secp256k1”,
    “hashAlgorithm”:“SHA2_256”
    }
    My account in flow-view-source is
    flow testnet account

Not able to find what the issue is
Could you please help on this
[/quote]

Hi @zaneousryan I changed my blocto wallet to non-custodial wallet and received an account recovery kit which is a json.
How can to add this in flow.json?
I am unable to do that

When you receive your JSON file, there is no direct private key in that JSON file, you should extract the Private key using your password.

You can also extract your private key using myEtherWallet. MyEtherWallet | MEW
Go to myetherwallet, paste your json file there in the keystore, give your password, when you were converting custodial to non-custodial there they required password, that password should be given to your etherwallet then there will be your private key.
The give json file is in encrypted format.

You are passing your json file in wrong format.
The right format is:
“second-account”: {
“address”: “0215aaa5ab6bce99”,
“key”: {
“type”: “hex”,
“index”: 0,
“signatureAlgorithm”: “ECDSA_secp256k1”,
“hashAlgorithm”: “SHA2_256”,
“privateKey”: “4378297e30ef39d7d68734af72e98bfb1f46a43687b85a2d6c8ac94aa9967351”
}
},

Hi @NasirAliShah I generated non custodial wallet using port.onflow now by creating a new account on blocto


my flow view source is
https://flow-view-source.com/testnet/account/0x912d5440f7e3769e/
my flow.json
“second-account”: {
“address”: “912d5440f7e3769e”,
“key”:{
“type”:“hex”,
“index”:0,
“signAlgorithm”:“ECDSA_P256”,
“hashAlgorithm”:“SHA3_256”,
“privateKey”:“49573230237444c3570e74c41217d00f1084acb9acc0a6fbdff7f86f2c0fc2e3”
}
}
still getting
:x: Config Error: invalid signature algorithm for account second-account
sorry for confusing you
trying different ways to work it out
but no luck still

I don’t think so, there is any option in the flow port to generate non-custodial accounts?
Please if you discuss your problem what you want, I think there may be a better way to solve the problem

public key for this would be: 3ef373640ee7044075ce6e36fb137f6aedb2e35da7855fc0b2a75feadf9dcb912aa060bfa0bc749151e7ce3efcebc367b7bb221623902f2150c3fe4e7046525d

Hi @NasirAliShah.Thanks a lot for your timely replies.actually I am trying out a sample flow nft marketplace.to accomplish that I require blocto wallet .and need to deploy the contracts using the blocto address.using the flow view source I am unable to authenticate using blocto.I generated a custodial blocto wallet.so inorder to try using CLI I need to convert it to non custodial wallet.
I created lilico wallet account.but that too has some issues in UI


Could you please tell me in myetherwallet where is the option to generate private key

Thanks a lot @bluesign The pub key was the issue

Since this came up a couple times across this thread, just want to let everyone know that as of a couple days ago we launched a Flow CLI command to easily create non-custodial accounts on Emulator, testnet AND mainnet, with no Flow required :slight_smile:

Command: flow accounts create

  1. Type the command
  2. Choose your network: Emulator/Testnet/Mainnet
  3. Get your account and start building!

Docs for more info: Create an Account | Flow Developer Portal

1 Like

Hello Everyone