0

I can't get Taquito (version 14.0.0) to write to the blockchain. Below is a minimal (typescript, macos) example to originate a trivial contract on the ghostnet. It gets stuck waiting at the await result.contract() line. There is no error, and the operation hash does not show up in ghostnet.tzkt.io.

import * as t from "@taquito/taquito";
import * as s from "@taquito/signer";


//
// get the private key generated with 
//    `tezos-client --endpoint https://rpc.ghostnet.teztnets.xyz gen keys jeff`
//
import * as fs from 'fs';
const secretKeys = JSON.parse(fs.readFileSync(process.env['HOME'] + '/.tezos-client/secret_keys', 'utf-8')) as {name: string, value: string}[];
const adminSecretKey = secretKeys.find((k) => k.name == 'jeff')
  .value.replace('unencrypted:', '');

/**
 * Originate a trivial contract
 */
async function main() {


  const SAMPLE_CONTRACT = `{ parameter int ; storage int ; code { CAR ; NIL operation ; PAIR } }`;
  const SAMPLE_STORAGE = `3`;
    
  
  const RPC_URL = `https://rpc.ghostnet.teztnets.xyz`;
  // const RPC_URL = `https://ghostnet.tezos.marigold.dev`;
  // const RPC_URL = `https://kathmandunet.tezos.marigold.dev/`;

  const Tezos = new t.TezosToolkit(RPC_URL);
  s.importKey(Tezos, adminSecretKey);
  
  console.log('originating...');
  const result = await Tezos.wallet.originate({
    code: SAMPLE_CONTRACT,
    init: SAMPLE_STORAGE,
    gasLimit: 100000,
    fee: 1,
  }).send();

  console.log('orgination posted. awaiting contract address', result.opHash)
  const contract = await result.contract();
  console.log('contract address', contract.address);

  return;
}

main().catch(e => {
  console.error(e);
});

I can successfully originate the same contract using tezos-client using command

tezos-client --endpoint "https://rpc.ghostnet.teztnets.xyz" \
                originate contract trivial_1 \
                transferring 1 from jeff \
                running '{ parameter int ; storage int ; code { CAR ; NIL operation ; PAIR } }' \
                --init '37' --burn-cap .7

Things I tried:

  • different RPC endpoints (commented out in code) — no luck
  • ensure user jeff has tez from the faucet bot — there's 100 tez in that wallet
  • different contract code — same result
  • waiting for over an hour
  • Using Taquito to interact with a contract originated with tezos-client — Taquito gets stuck awaiting confirmation and the operation does not appear on TzKt

Things I have not tried:

  • anything on the mainnet

What am I missing?

1 Answer 1

2

It works if you remove the gas limit and fee entries:

console.log('originating...'); const result = await Tezos.wallet.originate({ code: SAMPLE_CONTRACT, init: SAMPLE_STORAGE, }).send();

...

orgination posted. awaiting contract address ooiEd9mDH8qijqEBGvJhQMPp1vgmLkWMCcbroYEpi1AUfEJgD5r contract address KT1ShxcET6VnBN2qHGTggyi77vHVBPU3e6Fc

2
  • thanks, that did work. Do you have any idea why having those values could cause the script to fail? Commented Oct 2, 2022 at 1:02
  • 1
    We get the same condition with the Test Dapp we use when there is a large gas limit. It may be something with Beacon. I am not sure. Commented Oct 2, 2022 at 1:42

Your Answer

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

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