Joey Yi Zhao
Joey Yi Zhao

Reputation: 42418

Is smartcontract the only way to transfer ether in Ethereum network?

I am new to smartcontract and start writing some demo code in Solidity to work with Ropsten testing network. I see that I can use send/transfer method in the contract to transfer ether to other accounts. One question about it is that is contract the only way to transfer ether? Can I transfer ether without a contract?

I understand the concept of the contract but not sure whether it is a required thing in Ethereum. When I deploy a contract to the network, it will be sitting in a new block and all transactions generated from this contract are in the same block? Am I understand correctly?

Upvotes: 0

Views: 781

Answers (1)

pygeek
pygeek

Reputation: 7404

You do not need a smart contract to sign or send a transaction. The transferring of ETH is built into the protocol. This can be accomplished by using libraries such as web3 or ethers if you're a developer. If you're not a developer, this can be accomplished by using tools such as Metamask.

Steps to send a transaction using ethers.js:

  1. Instantiate your provider and signer using ethers.providers. and Signer.
  2. Then sign a transaction using signer.signTransaction.
  3. Use provider to send the transaction using provider.sendTransaction.

References:

Ethers.js: https://docs.ethers.io/v5/api/

web3.js: https://web3js.readthedocs.io/en/v1.5.2/

metamask: https://metamask.io

Upvotes: 2

Related Questions