Skip to content

Instantly share code, notes, and snippets.

View Shih-Yu's full-sized avatar
:shipit:

Shih-Yu Hwang Shih-Yu

:shipit:
  • Austin, Tx
View GitHub Profile
@Shih-Yu
Shih-Yu / Truffle.config.js
Created August 30, 2021 16:52
React Project Setup Using Hardhat & Truffle - part 2
compilers: {
solc: {
version: "0.8.6", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
@Shih-Yu
Shih-Yu / Truffle-network.config.js
Last active August 30, 2021 17:09
React Project Setup Using Hardhat & Truffle - part 2
networks: {
// Useful for testing. The `development` name is special - truffle uses it by default
// if it's defined here and no other network is specified at the command line.
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the `host`, `port` and `network_id`
// options below to some value.
//
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
@Shih-Yu
Shih-Yu / Ganache-cli.sh
Last active August 30, 2021 17:09
React Project Setup Using Hardhat & Truffle - part 2
Ganache CLI v6.12.2 (ganache-core: 2.13.2)
Available Accounts
==================
(0) 0x969bA70Cfe0C4F008420Fe8f3692a0E38F1651C7 (100 ETH)
(1) 0xcF284112963B78a15b7e4EbCcc4D0C375c7b7220 (100 ETH)
(2) 0x0aFb5969722AE021327B0bBA1BA9587aa990D7Ba (100 ETH)
(3) 0xF20419183d1b0de9cb95157A5fB7963625C85C7a (100 ETH)
(4) 0x8978E1f007f2Bb3C3baFB128575bD0706814E92E (100 ETH)
(5) 0xac5e8CD2A98a817b7D98870F3Bf1C879Eb3d3412 (100 ETH)
@Shih-Yu
Shih-Yu / Hardhat.config.js
Created August 30, 2021 17:08
React Project Setup Using Hardhat & Truffle - part 2
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.6",
};
@Shih-Yu
Shih-Yu / Hardhat-network.js
Created August 30, 2021 17:12
React Project Setup Using Hardhat & Truffle - part 2
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
networks: {
hardhat: {
chainId: 1337
},
},
solidity: "0.8.6",
@Shih-Yu
Shih-Yu / Hardhat-cli.sh
Created August 30, 2021 17:14
React Project Setup Using Hardhat & Truffle - part 2
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
Accounts
========
Account #0: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH)
Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Account #1: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 (10000 ETH)
Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
import { useState } from "react";
import './App.css';
import Web3 from "web3";
import NumberChanger from "./build/NumberChanger.json";
const contractAddress = "0x7c2481b87100844E11df966BcCD55E82A138Fe84";
function App() {
const web3 = new Web3("http://localhost:8545");
import { useState } from "react";
import './App.css';
import Web3 from "web3";
import NumberChanger from "./build/NumberChanger.json";
const contractAddress = "0x7c2481b87100844E11df966BcCD55E82A138Fe84";
function App() {
const web3 = new Web3("http://localhost:8545");
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
return (
<div className="App">
<header className="App-header">
<h1>Welcome to Number Changer</h1>
<h3 >
Your number is: {number}
</h3>
<input
placeholder="Enter a number"
onChange={ (e) => setNewNumber(e.target.value) }