I just started learning about interacting with smart contract deployed on Ethereum blockchain and I've come across these two methods to interact with non-view functions in the contract.
- MyContract.methods.Mymethod().send({from: ..some address}) and
- web3.eth.sendSignedTransaction(...) and specify the hash of the contract's method call in the data field of the transaction.
It seems that these two ways can both interact with the states and methods in the smart contract. So what's the difference? Can I use 1. instead of 2. or 2. instead of 1.? or is there any disadvantage in using either methods? Thanks in advance.
Another related question is that the 2nd way needs private key to sign the tx but the 1st doesn't. If both can interact with the state, then what's the point of signing tx with private key? Correct me if I understand wrong, thanks.