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?