Smart Contract Interaction

Inspect live contracts, run read calls, estimate fees, and execute confirmed writes

Contract Discovery

Resolve a contract from its script hash and inspect the manifest reported by the live network:

Live Contract Metadata
const GAS_HASH = "0xd2a4cff31913016155e38e474a2c06d08be276cf";

const contractInfo = await tools.get_contract_info({
  contract: GAS_HASH,
  network: "mainnet"
});

const contractStatus = await tools.get_contract_status({
  contract: GAS_HASH,
  network: "mainnet"
});

console.log("Manifest:", contractInfo.status.contractState.manifest);
console.log("Deployment status:", contractStatus);

Read-Only Invocation

Call methods without a wallet when the operation does not change chain state:

Native GAS Contract
const GAS_HASH = "0xd2a4cff31913016155e38e474a2c06d08be276cf";

const symbol = await tools.invoke_contract({
  scriptHash: GAS_HASH,
  operation: "symbol",
  args: [],
  network: "mainnet"
});

const decimals = await tools.invoke_contract({
  scriptHash: GAS_HASH,
  operation: "decimals",
  args: [],
  network: "mainnet"
});

console.log({ symbol, decimals });

Fee Estimation

Estimate an invocation with the exact signer, contract, operation, and arguments you intend to use:

Invocation Preflight
const contractHash = process.env.NEO_CONTRACT_HASH;

const fees = await tools.estimate_invoke_fees({
  signerAddress: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
  scriptHash: contractHash,
  operation: "setMessage",
  args: ["Hello, Neo N3"],
  network: "testnet"
});

console.log("Exact system fee (datos):", fees.systemFeeDatos);
console.log("Exact network fee (datos):", fees.networkFeeDatos);
console.log("Formatted system fee (GAS):", fees.systemFeeGas);
console.log("Formatted network fee (GAS):", fees.networkFeeGas);

Confirmed Contract Write

Write calls require an explicit network, a valid sender WIF, and a confirm: true safety acknowledgement:

Write and Confirm
const contractHash = process.env.NEO_CONTRACT_HASH;

const writeResult = await tools.invoke_contract_write({
  idempotencyKey: "contract-message-2026-07-11-001",
  scriptHash: contractHash,
  operation: "setMessage",
  args: ["Hello, Neo N3"],
  network: "testnet"
});

const receipt = await tools.wait_for_transaction({
  txid: writeResult.txid,
  timeoutMs: 120000,
  pollIntervalMs: 3000,
  includeApplicationLog: true,
  network: "testnet"
});

console.log("Confirmed transaction:", receipt);

Contract Deployment

Deploy a complete compiler-produced serialized NEF artifact and manifest only after reviewing both files. Raw VM bytecode is not accepted.

Confirmed Deployment
const deployment = await tools.deploy_contract({
  idempotencyKey: "deployment-2026-07-11-001",
  nef: {
    encoding: "base64",
    data: compiledNefBase64
  },
  manifest: compiledManifest,
  network: "testnet"
});

const receipt = await tools.wait_for_transaction({
  txid: deployment.txid,
  includeApplicationLog: true,
  network: "testnet"
});

console.log("Contract hash:", deployment.contractHash);
console.log("Deployment receipt:", receipt);

Next Steps