Giter Club home page Giter Club logo

crypto-faucet's Introduction

Solidity & Ethereum in React (Next JS): The Complete Guide

Tutorial

git commands

truffle migrate --reset truffle console

truffle console

const instance = await Faucet.deployed()

// add Funds
instance.addFunds({value: "1000000000000000000"})
// from specific account, otherwise defaults to accounts[0]
instance.addFunds({value: "2000000000000000000", from: accounts[1]})

// same as above
// data: "0xa26759cb" = addFunds()
// web3.eth.sendTransaction({from: accounts[0], to: "0x570113B91702Aa34bcF7fdc05925F663289C5F9a", data: "0xa26759cb", value: "1000000000000000000"})

instance.getFunderAtIndex(0)
instance.getAllFunders()

old-code-with-notes

// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0;

contract Faucet { // this is a special function // it's called when you make a transaction that doesn't specify function name to call

// external functions are part of the contract interface, which means they can be called via contracts and other transactions

receive() external payable {}
function addFunds() external payable {}

// Transactions - can generate state changes and require gas fees    
// JSON-RPC http calls - talk to node on the network to make a transaction

// pure, view - read-only call, no gas fee
// view - indicates that the function will not alter the storage state in any way 
// pure - even more strict, it won't even read the storage state

// private vs internal
// private -> can be accessible only within the smart contract
// internal -> can be accessible within smart contract and also derived smart contracts (less strict than private)

// mapping(key => value)

}

// with metamask we have access to window.ethereum & window.web3 // metamask injects a global API into website // this API allows websites to request users, accounts, read data to blockchain, sign messages and transactions

crypto-faucet's People

Contributors

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