Invalid key type for account emulator-account

Hi all, I’m following this introduction to NFT marketplaces using Flow and managed to initialize my project, generate my keys, and write the minting contract. When I run the following command

flow transactions send pinata-party/transactions/MintPinataParty.cdc --signer emulator-account -f ./flow.json

I get the error

Invalid key type for account emulator-account

My flow.json file looks like this:

	"emulators": {
		"default": {
			"port": 3569,
			"serviceAccount": "emulator-account"
	"contracts": {
		"PinataPartyContract": "~/pinata-party/cadence/contracts/PinataPartyContract.cdc"
	"networks": {
		"emulator": "",
		"mainnet": "",
		"testnet": ""
	"accounts": {
		"emulator-account": {
		   "address": "f8d6e0586b0a20c7",
		   "privateKey": "47b4b93e4b082f9cbc343ed29628b3db98588b3244b1a96cd7fef9377dc1912b",
		   "chain": "flow-emulator",
		   "sigAlgorithm": "ECDSA_P256",
		   "hashAlgorithm": "SHA3_256"
	"deployments": {
		"emulator": {
			 "emulator-account": ["PinataPartyContract"]

and the contract looks like this:

import PinataPartyContract from 0xf8d6e0586b0a20c7

transaction {
  let receiverRef: &{PinataPartyContract.NFTReceiver}
  let minterRef: &PinataPartyContract.NFTMinter

  prepare(acct: AuthAccount) {
      self.receiverRef = acct.getCapability<&{PinataPartyContract.NFTReceiver}>(/public/NFTReceiver)
          ?? panic("Could not borrow receiver reference")        
      self.minterRef = acct.borrow<&PinataPartyContract.NFTMinter>(from: /storage/NFTMinter)
          ?? panic("could not borrow minter reference")

  execute {
      let metadata : {String : String} = {
          "name": "The Big Swing",
          "duration": "11", 
          "creator": "Matahi Drollet",
          "category": "Sports",
          "last_owner": "Matahi Drollet",
          "uri": "ipfs://QmVQxruUF2BRoN4tDHaxs7DFom9gcy1hNTkFd5h9CMY53M"
      let newNFT <- self.minterRef.mintNFT()
      self.receiverRef.deposit(token: <-newNFT, metadata: metadata)

      log("NFT Minted and deposited to Account 2's Collection")

Any help is much appreciated.

1 Like

I had the same issue… I don’t know for what reason, but basically, it’s missing an attribute “key”, that was originally in the flow.json file and was later replaced with the privateKey values. Undo the changes to before you deleted the “key” and keep it along the other privateKey values too