There are two kinds of functions. One, the functions called "Getter" and the other the functions called "Setter". Getter functions do not change the state and used to get some data from smart contract. For this reason, they are always called with this command in Truffle console:
getterFunctionName.call()
Setter functions change the state, e.g. changing a state variable's value or generally changing the storage. Executing these function with the below command in Truffle console changes the state and ledger:
setterFunctionName.sendTransaction(arguments)
or
setterFunctionName(arguments)
A block is mined when the setter function be executed with one of these two commands. A transaction is recorded in the ledger or a block whenever it changes the state. Calling a function never change the state. So, It is natural to say no transaction sent and sequencely no block mined. Now, whether a function is a Setter or a Getter, if one executes that with .call() no block will be created because no change occurs on state by that.
Your function:
function sayHello() public pure returns (string memory) {
return 'Hello World!';
}
}
never needs to change state because it is a Getter function. For this reason I explained one should not wait for a block being mined for calling this function.
Good Luck.
setPayloadit should create a block? I am doingfunctions.setPayload("wonpfe").call()but it doesn't seem to create a block on ganache – nz_21 Oct 20 '20 at 14:13functions.setPayload("wonpfe")orfunctions.setPayload.sendTransaction("wonpfe")if you defined your deployed contract asfunctions. If my answer solves your problem, please mark it to if another questioner has a similar question can find its solution easily. – Alireza Oct 20 '20 at 14:18