Do call methods cost Ether?

Image from Gyazo

I’ve been developing a smart contract on Kovan with no issue.

I’ve deployed to Mainnet and the call methods (with ‘external view’) are returning insufficient funds for gas errors.

I thought that call methods do not cost any gas? Is this correct?

If so, what would cause call function to return an error like that?

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

  * Network: Kovan
  * Aggregator: ETH/USD
  * Address: 0x9326BFA02ADD2366b30bacB125260Af641031331

contract Contract {
  address payable public owner;

  string public dapp_name = "Eth Text";
  uint public messagesSentCount = 0;

  uint decimals = 8;
  uint scale = 10**decimals;

  uint public txtPriceUSD = 1.70 * 10**8;
  uint public txtPriceEth;

  using SafeMath for uint;

  AggregatorV3Interface internal priceFeed;

  event Spend(
    string textMsg,
    string recipient
  event TextMsgError(
    string reason

  constructor() {
    owner = msg.sender;
    priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);

  function sendTextMessage(
    string calldata textMsg,
    string calldata recipient
  ) external payable returns(bool) {

    (uint newTxtPriceEth,,) = this.pollTxtPrices();

      msg.value > newTxtPriceEth,
      'Please send the correct amount of ETH to make send a message'

    emit Spend(textMsg, recipient);
    messagesSentCount += 1;
    return true;

  function setTxtPrices(uint _txtPriceUSD) external ownerOnly() {
    (int price,) = getLatestPrice();
    uint ethPriceUSD = uint(price);

    txtPriceEth = scale.mul(_txtPriceUSD).div(ethPriceUSD);
    txtPriceUSD = _txtPriceUSD;

  function pollTxtPrices() external view returns(uint, uint, uint) {
    (int price,) = getLatestPrice();

    uint newTxtPriceEth = scale.mul(txtPriceUSD).div(uint(price));

    return (newTxtPriceEth, txtPriceUSD, decimals);

  function totalBalance() external view returns(uint) {
    return payable(address(this)).balance;

  function withdrawFunds() external ownerOnly() {

  function destroy() external ownerOnly() {

  function getLatestPrice() public view returns (int, uint) {
      ,int price,,,
    ) = priceFeed.latestRoundData();

    return (price, decimals);

  function uintToWei(uint unum) private pure returns(uint p) {
    return unum * (1 wei);

  modifier ownerOnly() {
    require(msg.sender == owner, 'only owner can call this');

1 Like

Hi @G_N,

Welcome to the community :wave:

Reads shouldn’t cost Ether. I am not sure why that is happening. How are you connecting to mainnet?

You could verify your contract on Etherscan and read the values from there.

This is my first deploy to Mainnet. But I’m pretty sure it is deployed ok.

truffle console --network mainnet
truffle(mainnet)> c = await EthText.deployed()

// print out the function definition…

truffle(mainnet)> c.dapp_name
[Function (anonymous)] {
  call: [Function (anonymous)],
  sendTransaction: [Function (anonymous)],
  estimateGas: [Function (anonymous)],
  request: [Function (anonymous)]

Then call function…
truffle(mainnet)> c.dapp_name()

  code: -32000,
  message: 'err: insufficient funds for gas * price + value: address 0x16c8CF300eCE60f6d8e70201AB7163FCc6660f1d have 14260639348606292 want 420361420000000000 (supplied gas 894386)'
1 Like

Hi @G_N,

I just deployed a simple contract on a local test network:

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;

contract MyContract {
  string public dapp_name = "My Text";

I was then able to interact:

truffle(develop)> c = await MyContract.deployed()
truffle(develop)> await c.dapp_name()
'My Text'

I am not sure why you are getting different behavior on mainnet.