0PricingLogin
Web3 & DApp Development Fundamentals · Lesson

Sending Transactions

Write to the chain.

Writing to the Chain

Changing contract state — transferring tokens, minting, voting — requires a transaction. Transactions must be signed and cost gas.

For this you need a signer, not just a provider.

A Contract with a Signer

To send transactions, create the contract with a signer or connect an existing instance to one:

const contract = new ethers.Contract( address, abi, signer ); // or const writable = readOnly.connect(signer);

Now state-changing functions become available.

const contract = new ethers.Contract(
  address,
  abi,
  signer
);
// or
const writable = readOnly.connect(signer);

All lessons in this course

  1. Connecting to a Provider
  2. Reading Contract Data
  3. Sending Transactions
  4. Listening to Events
← Back to Web3 & DApp Development Fundamentals