Solidity – Using sendTransaction When Calling a Contract Function

contract-developmentcontract-invocationgo-ethereumsolidity

I've seen some contracts like here (e.g. in line 332), use "sendTransaction" when they call contract's function. Cannot we call a function without using "sendTransaction"? As I've been calling functions without using it (on testrpc and private chain) and it works fine.

Question 1: Do we have to use "sendTransaction" when we call a contract function?

Question 2: When should we use "sendTransaction"?

Best Answer

There are multiple ways you can interact with smart contract depending on what you want to accomplish. Here you can find detailed explanation on what does what What is the difference between a transaction and a call?