Giter Club home page Giter Club logo

template-ethereum-smart-contract-interaction's Introduction

Template to interact with deployed smart contract on Ethereum's blockchain (Deprecated)

This template allows a user to (a) utilise a smart contract template that can be deployed on Ethereum's blockchain, (b) connect the smart contract to a local repository, (c) interact with the smart contract through a frontend, and (d) customize frontend whilst still being connected to the smart contract.

  • (a): Secret.sol: Smart contract written in Solidity with two simple functions
  • (b): app.js: Interacting with the smart contract on Ethereum's blockchain - change two variables to add your own contract once you have deployed it.
  • (c): app.js and index.html: Intuitive and simple interaction between the html (frontend) and JavaScript (using web3.js to interact with the smart contract)
  • (d): index.css: Simple CSS to customize the website

Get Started

  1. Clone Repository
  2. cd To Repository
  3. Run npm install
  4. Run local server: npm run dev
  5. Edit changes to the template in a code editor. Changes are automatically shown on localhost.

The smart contract

This repository is connected to a deployed contract on Ropsten Test Network. The smart contract in this repository [Secret.sol] is simply included as a smart contract template. To add your own contract:

  1. Use the smart contract in this repository as your template
  2. Go to Remix IDE (https://remix.ethereum.org/) and try interacting with the template to check that everything works
  3. Deploy the contract
  4. Go to [app.js] and change the ABI and var contractAddress

Secret.sol

Our template contract is written in Solidity and has two main funcitons:

  • setSecretWord allows the user to set "a secret word"
  • getSecretWord: retrieving the latest "secret word"

The file is included in this repo for reference, but not used for other purposes. The exact same smart contract is deployed on Ropsten - hence, changes in this file will not affect the template.

Please read:

  1. You need MetaMask for this template - it is injecting the web3
  2. If you are using the pre-made template, remember switching to "Ropsten Test Network" on MetaMask
  3. Don't have Ether on your Ropsten Account? Use Faucet (https://faucet.metamask.io/)

template-ethereum-smart-contract-interaction's People

Contributors

n0rlant1s 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.