Skip to main content
Add more detail
Source Link

I am deploying a contract on the testnet with hardhat, but the address returned is not the real address the contract is at in the blockchain.

I am following hardhat's guide.

Code:

async function main() {
  const TokenContract = await ethers.getContractFactory("Token");
  const token = await TokenContract.deploy();
  await token.deployed();

  console.log("Token deployed to:", token.address);
}

Token deployed to: 0x684c903c66D69777377f0945052160C9f778d689

In reality theAt that address, though, I see a contract that is herenot mine! If I look into my wallet's transaction in the explorer I can find the contract creation transaction and the real contract, thoughhere:: real address

How come?

I am deploying a contract on the testnet with hardhat, but the address returned is not the real address the contract is at in the blockchain.

I am following hardhat's guide.

Code:

async function main() {
  const TokenContract = await ethers.getContractFactory("Token");
  const token = await TokenContract.deploy();
  await token.deployed();

  console.log("Token deployed to:", token.address);
}

Token deployed to: 0x684c903c66D69777377f0945052160C9f778d689

In reality the contract is here, though: real address

How come?

I am deploying a contract on the testnet with hardhat, but the address returned is not the real address the contract is at in the blockchain.

I am following hardhat's guide.

Code:

async function main() {
  const TokenContract = await ethers.getContractFactory("Token");
  const token = await TokenContract.deploy();
  await token.deployed();

  console.log("Token deployed to:", token.address);
}

Token deployed to: 0x684c903c66D69777377f0945052160C9f778d689

At that address, though, I see a contract that is not mine! If I look into my wallet's transaction in the explorer I can find the contract creation transaction and the real contract, here:: real address

How come?

Source Link

Why does Hardhat's just deployed contract.address differ from the real one?

I am deploying a contract on the testnet with hardhat, but the address returned is not the real address the contract is at in the blockchain.

I am following hardhat's guide.

Code:

async function main() {
  const TokenContract = await ethers.getContractFactory("Token");
  const token = await TokenContract.deploy();
  await token.deployed();

  console.log("Token deployed to:", token.address);
}

Token deployed to: 0x684c903c66D69777377f0945052160C9f778d689

In reality the contract is here, though: real address

How come?