0

I created a smart contract it compiles without problem but I have an error when deploying, I don't know what this error can refer to...

HttpResponse: Http error response: (500) [{"kind":"temporary","id":"failure","msg":"Error while applying operation ood21FLzwWRzrbUQkCESDNJeL9zodNAAQ8AYLWwxetRTPuBB59e:\nbranch refused (Error:\n                  Counter 3333097 already used for contract tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr (expected 3333098)\n)"}]

    at XMLHttpRequest.request.onload (M:\TEZOS\DEV\TEZOS_NFT_V2\node_modules\@taquito\http-utils\src\taquito-http-utils.ts:132:13)
    at XMLHttpRequestEventTarget.dispatchEvent (M:\TEZOS\DEV\TEZOS_NFT_V2\node_modules\xhr2-cookies\xml-http-request-event-target.ts:44:13)
    at XMLHttpRequest._dispatchProgress (M:\TEZOS\DEV\TEZOS_NFT_V2\node_modules\xhr2-cookies\xml-http-request.ts:390:8)
    at XMLHttpRequest._onHttpResponseEnd (M:\TEZOS\DEV\TEZOS_NFT_V2\node_modules\xhr2-cookies\xml-http-request.ts:347:8)
    at IncomingMessage.<anonymous> (M:\TEZOS\DEV\TEZOS_NFT_V2\node_modules\xhr2-cookies\xml-http-request.ts:311:39)
    at IncomingMessage.emit (node:events:532:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  status: 500,
  statusText: 'Internal Server Error',
  body: '[{"kind":"temporary","id":"failure","msg":"Error while applying operation ood21FLzwWRzrbUQkCESDNJeL9zodNAAQ8AYLWwxetRTPuBB59e:\\nbranch refused (Error:\\n                  Counter 3333097 already used for contract tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr (expected 3333098)\\n)"}]\n',
  url: 'https://rpc.hangzhou.tzstats.com/injection/operation'

my deploy:

import { TezosToolkit } from '@taquito/taquito'
import { importKey } from '@taquito/signer'
import * as fs from 'fs';

const provider = 'https://rpc.hangzhou.tzstats.com'

async function deploy() {
  const tezos = new TezosToolkit(provider)
  await importKey(
    tezos,
    '[email protected]', //mail
    'ZSrbDk3Nzf', //password
    [
        "sky",
        "inquiry",
        "build",
        "man",
        "aunt",
        "tropic",
        "pattern",
        "image",
        "giant",
        "burger",
        "shock",
        "banner",
        "safe",
        "initial",
        "rather"
    ].join(' '),
    '121124d38edd019ec3d8c2ad91d562599efea920' //private key
  )

  try {
    const op = await tezos.contract.originate({
      //smart contract code
      code: JSON.parse(fs.readFileSync("./nft.json").toString()),
      //storage state
      init: '(Pair (Pair (Pair "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr" { Elt 1 "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr" }) (Pair { Elt "" 0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f36663138333737353065366562383163646434666633363230663738613133322f7261772f653238396663353037326235613931353134383936376239613433333765313835343731363561322f636f6e74726163745f6d6574612e6a736f6e } 2)) (Pair (Pair {  } { Elt "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr" { 1 } }) { Elt 1 (Pair 1 { Elt "" 0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f35313763373231396531383639333938613765666631343335623862653237392f7261772f326337336132613564353365626466313662633864623831643837343236353964323763646462332f6e66745f6d6574612e6a736f6e }) }))'
    })
    //beginning to deploy
    console.log('Awaiting confirmation...')
    const contract = await op.contract()
    //deployment report: amount of used gas, storage state
    console.log('Gas Used', op.consumedGas)
    console.log('Storage', await contract.storage())
    //operation hash one can use to find the contract in the explorer
    console.log('Operation hash:', op.hash)
  } catch (ex) {
    console.error(ex)
  }
}

deploy()

thank you all for your help and attention

1 Answer 1

0

It seems that you already have an operation pending in the mempool. Restarting the node or waiting for 60 blocks should fix the error.

I think that in the Ithaca testnet you can now replace an operation by increasing the fee.

3
  • I am on test net hangzhounet how to solve this problem exactly (I am new to tezos) I updated my question with my deploy file, the weird thing is yesterday it was working and all of a sudden nothing I don't think I have an operation pending...
    – oriana
    Mar 16, 2022 at 8:55
  • 1
    my error is corrected, hangzhounet changed rpc it is no longer: rpc.hangzhou.tzstats.com but now: rpc.tzkt.io/hangzhou2net :)
    – oriana
    Mar 16, 2022 at 9:13
  • More backup nodes: visualtez.com/nodes Mar 16, 2022 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.