Git Product home page Git Product logo

ctf-challenge's Introduction

Ethereum Contract Unlocker App

This Reactjs application allows users to interact with an Ethereum smart contract by unlocking it using a password stored in the contract's storage. The application utilizes the MetaMask Web3Provider to connect to the Ethereum blockchain and the ethers library for Ethereum interactions.

Getting Started

Contract Source Code:

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract CTF1 {
  bool public locked;
  bytes32 private password;
  event Winner(address);

  constructor(bytes32 _password) {
    locked = true;
    password = _password;
  }

  function unlock(bytes32 _password) public {
    if (password == _password) {
      locked = false;
      emit Winner(msg.sender);
    }
  }
}
  1. Clone the repository to your local machine:

    git clone https://github.com/bharatbhusal/ctf-challenge.git
  2. Install dependencies:

    npm install
  3. Start the application:

    npm start
  4. Open your browser and navigate to http://localhost:3000 to view the application.

Usage

  1. Make sure you have MetaMask installed and connected to the Ethereum network.

  2. Click the "Unlock" button to initiate the unlocking process.

Configuration

  • Update the smart contract address and ABI in the App.js file to match your specific contract details:

    const contract_address = `0x89d5b48f3974A05b4BF816aebA12D401c0ebb003`;
    const slot = 1; // Modify this according to your contract storage structure.
  • Ensure MetaMask is configured with the correct network and account.

Contributing

Feel free to contribute by opening issues or submitting pull requests.

ctf-challenge's People

Contributors

bharatbhusal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.