基于区块链的毕业设计🏗 scaffold-eth – 🏗 脚手架eth

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计🏗 scaffold-eth – 🏗 脚手架eth 是一篇很好的国外资料

🏗 scaffold-eth

is everything you need to get started building decentralized applications powered by smart contracts


quickstart

yarn install  yarn start 

in a second terminal window:

yarn run chain 

in a third terminal window:

yarn run deploy 

🔏 Edit your smart contract YourContract.sol in packages/buidler/contracts

📝 Edit your frontend App.jsx in packages/react-app/src

📱 Open http://localhost:3000 to see the app

With everything up your dev environment starts looking something like this:

🏗 scaffold-eth - 🏗 脚手架eth

React dev server, Buidler blockchain, deploy terminal, code IDE, and frontend browser.

📚 Keep solidity by example handy and check out the Solidity globals and units

👨‍🏫 Maybe start super simple and add a counter uint8 public count = 1;

⬇️ Then a function dec() public {} that does a count = count - 1;

🔬 What happens with you subtract 1 from 0? Try it out in the app to see what happens!

🧫 You can iterate and learn as you go.

🔐 Global variables like msg.sender and msg.value are cryptographically backed and can be used to make rules

📝 Keep this cheat sheet handy

Maybe we could use block.timestamp or block.number to track time in our contract

🔏 Or maybe keep track of an address public owner; then make a rule like require( msg.sender == owner ); for an important function

🧾 Maybe create a smart contract that keeps track of a mapping ( address => uint256 ) public balance;

🏦 It could be like a decentralized bank that you function deposit() public payable {} and withdraw()

🧬 Next learn about structs

🗳 Maybe an array YourStructName[] public proposals; that could call be voted on with function vote() public {}

📝 Then learn about the fallback function

💸 Maybe add a receive() external payable {} so your contract will accept ETH?

🚁 OH! Programming decentralized money! 😎 So rad!

🛰 Ready to deploy to a testnet? Change the defaultNetwork in packages/buidler/buidler.config.js

🔐 Generate a deploy account with yarn run generate and view it with yarn run account

👩‍🎓 You can “gradute” from 🏗 scaffold-eth and start using 👷 Buidler and 📦 create-eth-app “standalone”

( You will probably want to take some of the 🔗 hooks, 🎛 components with you from 🏗 scaffold-eth so we started 🖇 eth-hooks )

🚀 Good luck!


Quickstart: 🔬 Smart Contract Sandbox

Learn how to quickly iterate on a smart contract app using the <Contract /> component.


Join the telegram support chat 💬 to ask questions and find others building with 🏗 scaffold-eth!


🏗 scaffold-eth - 🏗 脚手架eth


Tutorial 1: 🛠 Programming Decentralized Money

Learn the basics of 🏗 scaffold-eth and building on Ethereum. 👷‍♂️ Buidler, 📦 create-eth-app, 🔥 hot reloading smart contracts, 🛰 providers, 🔗 hooks, 🎛 components, and building a decentralized application. 🎥 Guided Tutorial


Tutorial 2: 🏵 The Token

Learn about tokens. [coming soon] What is a token? Why is it cool? How can I deploy one? Exotic mechanisms? (todo)


Tutorial 3: ⚖️ Minimum Viable Decentralized Exchange

Learn the basics of Automated Market Makers like 🦄 Uniswap. Learn how 💰Reserves affect the 📉 price, ⚖️ trading, and 💦 slippage from low liqudity.

🏃‍♀️ SpeedRun 📹


Tutorial 4: 🚀 Connecting ETH to IPFS

Build a simple IPFS application in 🏗 scaffold-eth to learn more about distributed file storage and content addressing. 🎥 Live Tutorial


Tutorial 5: ⛽️GSN and Meta Transactions

Learn about to provide your users with better UX by abstracting away gas fees and blockchain mechanics. (todo)


Tutorial 6: 🛰 Decentralized Deployment

Learn how to deploy your smart contract to a production blockchain. Then deploy your applicaton to Surge, S3, and IPFS. Finally, register an ENS and point it at the decentralized content! 🎥 Live Tutorial


built with 🏗 scaffold-eth:

👩‍🎨 Nifty Ink

Paintings come to life as you “ink” new creations and trade them on Ethereum. A deep dive into 🖼 NFTs, 🐳 OpenSea, 🖍 react-canvas-draw, 🎨 react-color, and 🛬 onboarding user experience.

🏃‍♂️ SpeedRun 📹 (TODO)

💾 Source Code


🗳 Personal Token Voting

Poll your holders! Build an example emoji voting system with 🏗 scaffold-eth. 🔏 Cryptographically signed votes but tracked off-chain with 📡 Zapier and 📑 Google Sheets.

🏃‍♂️ SpeedRun 📹

💾 Source Code


🌒 xmoon.exchange

Exchange Reddit MOONs for ETH or DAI through xDAI. Learn about different 🛰 providers and how 🌉 bridges can connect different chains with different security models.

🏃‍♂️ SpeedRun 📹

💾 Source Code


Obituary.space

Remember someone permanently on the blockchain. Write an obituary and upload a photo of a person and their memory will be encoded on the blockchain, forever.


^^^ PR your 🏗 scaffold-eth project in above!!! ^^^


🧫 Building on Ethereum in 2020 (research)


Original Quickstart with TODO List:

First, you’ll need NodeJS>=10 plus Yarn and Git installed.

💾 install:

git clone https://github.com/austintgriffith/scaffold-eth.git rad-new-dapp  cd rad-new-dapp  git checkout quickstart  yarn install

⌚️ This will take some time. How about a quick tour of the file structure with your favorite code editor?

💡 Sometimes the install throws errors like “node-gyp”, try the next step even if you see problems.
(You can also download the Apple command line tools to fix the warning.)


🎛 frontend

yarn start

📝 Edit your frontend App.jsx in packages/react-app/src and open http://localhost:3000


blockchain

yarn run chain

Note: You’ll need to run this command in a new terminal window

🛠 Use this eth.build to double-check your local chain and account balances


⚙️ Compile your contracts:

yarn run compile

🚢 Deploy your contracts to the frontend:

yarn run deploy

🔍 Watch for changes then compile, deploy, and hot reload the frontend:

yarn run watch

🔥 Your dapp hot reloads as you build your smart contracts and frontend together 🔥


📝 Edit your smart contract SmartContractWallet.sol in packages/buidler/contracts

🤡 There is a spelling error in packages/buidler/contracts/SmartContractWallet.sol!

🤔 Can you fix it and deploy the contract locally?

🏗 scaffold-eth - 🏗 脚手架eth

☢️ Warning: It is very important that you find SmartContractWallet.sol in packages/buidler/contracts because there are other contract folders and it can get confusing.

🔬Test your contracts by editing myTest.js in packages/buidler/contracts:

yarn run test

🗝 List your local accounts:

yarn run accounts

💰 Check account balance:

yarn run balance **YOUR-ADDRESS**

💸 Send ETH:

yarn run send --from 0 --amount 0.5 --to **YOUR-ADDRESS**

🔧 Configure 👷Buidler by editing buidler.config.js in packages/buidler


The BuidlerEVM provides stack traces and console.log debugging for our contracts


🏃‍♂️ Speedrun (🎥 7 min):

🏗 scaffold-eth - 🏗 脚手架eth


🔬 Smart Contract Sandbox:

💾 install:

git clone https://github.com/austintgriffith/scaffold-eth.git smart-contract-sandbox  cd smart-contract-sandbox  yarn install

⚙️ start

#run in original terminal window: yarn start #run in terminal window 2: yarn run chain #run in terminal window 3: yarn run deploy

🔏 Edit or rename your smart contract YourContract.sol in packages/buidler/contracts

📝 Edit your frontend App.jsx in packages/react-app/src

📱 Open http://localhost:3000 to see the app

☢️ Make sure are running your local chain yarn run chain and your contract is deployed with yarn run deploy

🔥 Try yarn run watch and as you change your Solidity, your frontend <Contract/> will hot reload to give you access to new variables and functions:

📽 Video Guide

📚 RTFM: Check out solidity by example and check out the Solidity globals and units

🚀 Good luck, and go get ’em!


🔏 Web3 Providers:

The frontend has three different providers that provide different levels of access to different chains:

mainnetProvider: (read only) Infura connection to main Ethereum network (and contracts already deployed like DAI or Uniswap).

localProvider: local Buidler accounts, used to read from your contracts (.env file points you at testnet or mainnet)

injectedProvider: your personal MetaMask, WalletConnect via Argent, or other injected wallet (generates burner-provider on page load)


🐜 Ant.design is the UI library with components like the grids, menus, dates, times, buttons, etc.


Helpers:

Transactor: The transactor returns a tx() function to make running and tracking transactions as simple and standardized as possible. We will bring in BlockNative’s Notify library to track our testnet and mainnet transactions.

const tx = Transactor(props.injectedProvider, props.gasPrice);

Then you can use the tx() function to send funds and write to your smart contracts:

tx({   to: readContracts[contractName].address,   value: parseEther("0.001"), });
tx(writeContracts["SmartContractWallet"].updateOwner(newOwner));

☢️ Warning: You will need to update the configuration for react-app/src/helpers/Transactor.js to use your BlockNative dappId


🖇 Hooks:

Commonly used Ethereum hooks located in packages/react-app/src/:

usePoller(fn, delay): runs a function on app load and then on a custom interval

usePoller(() => {   //do something cool at start and then every three seconds }, 3000);

useBalance(address, provider, [pollTime]): poll for the balance of an address from a provider

const localBalance = useBalance(address, localProvider);

useBlockNumber(provider,[pollTime]): get current block number from a provider

const blockNumber = useBlockNumber(props.provider);

useGasPrice([speed]): gets current “fast” price from ethgasstation

const gasPrice = useGasPrice();

useExchangePrice(mainnetProvider, [pollTime]): gets current price of Ethereum on the Uniswap exchange

const price = useExchangePrice(mainnetProvider);

useContractLoader(provider): loads your smart contract interface

const readContracts = useContractLoader(localProvider); const writeContracts = useContractLoader(injectedProvider);

useContractReader(contracts, contractName, variableName, [pollTime]): reads a variable from your contract and keeps it in the state

const title = useContractReader(props.readContracts, contractName, "title"); const owner = useContractReader(props.readContracts, contractName, "owner");

useEventListener(contracts, contractName, eventName, [provider], [startBlock]): listens for events from a smart contract and keeps them in the state

const ownerUpdates = useEventListener(   readContracts,   contractName,   "UpdateOwner",   props.localProvider,   1 );

📦 Components:

Your commonly used React Ethereum components located in packages/react-app/src/:

📬 <Address />: A simple display for an Ethereum address that uses a Blockie, lets you copy, and links to Etherescan.

  <Address value={address} />   <Address value={address} size="short" />   <Address value={address} size="long" blockexplorer="https://blockscout.com/poa/xdai/address/"/>   <Address value={address} ensProvider={mainnetProvider}/>

🏗 scaffold-eth - 🏗 脚手架eth

🖋 <AddressInput />: An input box you control with useState for an Ethereum address that uses a Blockie and ENS lookup/display.

  const [ address, setAddress ] = useState("")   <AddressInput     value={address}     ensProvider={props.ensProvider}     onChange={(address)=>{       setAddress(address)     }}   />

TODO GIF

💵 <Balance />: Displays the balance of an address in either dollars or decimal.

<Balance   address={address}   provider={injectedProvider}   dollarMultiplier={price} />

🏗 scaffold-eth - 🏗 脚手架eth

👤 <Account />: Allows your users to start with an Ethereum address on page load but upgrade to a more secure, injected provider, using Web3Modal. It will track your address and localProvider in your app’s state:

const [address, setAddress] = useState(); const [injectedProvider, setInjectedProvider] = useState(); const price = useExchangePrice(mainnetProvider);
<Account   address={address}   setAddress={setAddress}   localProvider={localProvider}   injectedProvider={injectedProvider}   setInjectedProvider={setInjectedProvider}   dollarMultiplier={price} />

🏗 scaffold-eth - 🏗 脚手架eth

💡 Notice: the <Account /> component will call setAddress and setInjectedProvider for you.

☢️ Warning: You will need to update the configuration for Web3Modal to use your Infura Id

📡 <Provider />: You can choose to display the provider connection status to your users with:

<Provider name={"mainnet"} provider={mainnetProvider} /> <Provider name={"local"} provider={localProvider} /> <Provider name={"injected"} provider={injectedProvider} />

🏗 scaffold-eth - 🏗 脚手架eth

💡 Notice: you will need to check the network id of your injectedProvider compared to your localProvider or mainnetProvider and alert your users if they are on the wrong network!


📄 Smart Contract Wallet:

📝 Edit your smart contract SmartContractWallet.sol in packages/buidler/contracts

📝 Then edit the SmartContractWallet.js React component in packages/react-app/src

▶️ Run yarn run compile and yarn run deploy or just yarn run watch

🏗 scaffold-eth - 🏗 脚手架eth

🛠 Run this eth.build with your contract address to ask it who its owner is.


📚 OpenZeppelin Contracts — TODO

You can import any of the OpenZeppelin contracts:

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

🛰 The Graph — TODO

⛽️ GSN — TODO


📤 Save to your Git

Create a new repo with the same name as this project and then:

git remote add origin https://github.com/**YOUR_GITHUB_USERNAME**/**YOUR_COOL_PROJECT_NAME**.git git push -u origin master

🛳 Ship it!

You can deploy your static site and your dapp can go live:

yarn run build  # ship it!  yarn run surge  OR  yarn run s3  OR  yarn run ipfs

🏗 scaffold-eth

is everything you need to get started building decentralized applications powered by smart contracts


quickstart

yarn install  yarn start 

in a second terminal window:

yarn run chain 

in a third terminal window:

yarn run deploy 

🔏 Edit your smart contract YourContract.sol in packages/buidler/contracts

📝 Edit your frontend App.jsx in packages/react-app/src

📱 Open http://localhost:3000 to see the app

With everything up your dev environment starts looking something like this:

🏗 scaffold-eth - 🏗 脚手架eth

React dev server, Buidler blockchain, deploy terminal, code IDE, and frontend browser.

📚 Keep solidity by example handy and check out the Solidity globals and units

👨‍🏫 Maybe start super simple and add a counter uint8 public count = 1;

⬇️ Then a function dec() public {} that does a count = count - 1;

🔬 What happens with you subtract 1 from 0? Try it out in the app to see what happens!

🧫 You can iterate and learn as you go.

🔐 Global variables like msg.sender and msg.value are cryptographically backed and can be used to make rules

📝 Keep this cheat sheet handy

Maybe we could use block.timestamp or block.number to track time in our contract

🔏 Or maybe keep track of an address public owner; then make a rule like require( msg.sender == owner ); for an important function

🧾 Maybe create a smart contract that keeps track of a mapping ( address => uint256 ) public balance;

🏦 It could be like a decentralized bank that you function deposit() public payable {} and withdraw()

🧬 Next learn about structs

🗳 Maybe an array YourStructName[] public proposals; that could call be voted on with function vote() public {}

📝 Then learn about the fallback function

💸 Maybe add a receive() external payable {} so your contract will accept ETH?

🚁 OH! Programming decentralized money! 😎 So rad!

🛰 Ready to deploy to a testnet? Change the defaultNetwork in packages/buidler/buidler.config.js

🔐 Generate a deploy account with yarn run generate and view it with yarn run account

👩‍🎓 You can “gradute” from 🏗 scaffold-eth and start using 👷 Buidler and 📦 create-eth-app “standalone”

( You will probably want to take some of the 🔗 hooks, 🎛 components with you from 🏗 scaffold-eth so we started 🖇 eth-hooks )

🚀 Good luck!


Quickstart: 🔬 Smart Contract Sandbox

Learn how to quickly iterate on a smart contract app using the <Contract /> component.


Join the telegram support chat 💬 to ask questions and find others building with 🏗 scaffold-eth!


🏗 scaffold-eth - 🏗 脚手架eth


Tutorial 1: 🛠 Programming Decentralized Money

Learn the basics of 🏗 scaffold-eth and building on Ethereum. 👷‍♂️ Buidler, 📦 create-eth-app, 🔥 hot reloading smart contracts, 🛰 providers, 🔗 hooks, 🎛 components, and building a decentralized application. 🎥 Guided Tutorial


Tutorial 2: 🏵 The Token

Learn about tokens. [coming soon] What is a token? Why is it cool? How can I deploy one? Exotic mechanisms? (todo)


Tutorial 3: ⚖️ Minimum Viable Decentralized Exchange

Learn the basics of Automated Market Makers like 🦄 Uniswap. Learn how 💰Reserves affect the 📉 price, ⚖️ trading, and 💦 slippage from low liqudity.

🏃‍♀️ SpeedRun 📹


Tutorial 4: 🚀 Connecting ETH to IPFS

Build a simple IPFS application in 🏗 scaffold-eth to learn more about distributed file storage and content addressing. 🎥 Live Tutorial


Tutorial 5: ⛽️GSN and Meta Transactions

Learn about to provide your users with better UX by abstracting away gas fees and blockchain mechanics. (todo)


Tutorial 6: 🛰 Decentralized Deployment

Learn how to deploy your smart contract to a production blockchain. Then deploy your applicaton to Surge, S3, and IPFS. Finally, register an ENS and point it at the decentralized content! 🎥 Live Tutorial


built with 🏗 scaffold-eth:

👩‍🎨 Nifty Ink

Paintings come to life as you “ink” new creations and trade them on Ethereum. A deep dive into 🖼 NFTs, 🐳 OpenSea, 🖍 react-canvas-draw, 🎨 react-color, and 🛬 onboarding user experience.

🏃‍♂️ SpeedRun 📹 (TODO)

💾 Source Code


🗳 Personal Token Voting

Poll your holders! Build an example emoji voting system with 🏗 scaffold-eth. 🔏 Cryptographically signed votes but tracked off-chain with 📡 Zapier and 📑 Google Sheets.

🏃‍♂️ SpeedRun 📹

💾 Source Code


🌒 xmoon.exchange

Exchange Reddit MOONs for ETH or DAI through xDAI. Learn about different 🛰 providers and how 🌉 bridges can connect different chains with different security models.

🏃‍♂️ SpeedRun 📹

💾 Source Code


Obituary.space

Remember someone permanently on the blockchain. Write an obituary and upload a photo of a person and their memory will be encoded on the blockchain, forever.


^^^ PR your 🏗 scaffold-eth project in above!!! ^^^


🧫 Building on Ethereum in 2020 (research)


Original Quickstart with TODO List:

First, you’ll need NodeJS>=10 plus Yarn and Git installed.

💾 install:

git clone https://github.com/austintgriffith/scaffold-eth.git rad-new-dapp  cd rad-new-dapp  git checkout quickstart  yarn install

⌚️ This will take some time. How about a quick tour of the file structure with your favorite code editor?

💡 Sometimes the install throws errors like “node-gyp”, try the next step even if you see problems.
(You can also download the Apple command line tools to fix the warning.)


🎛 frontend

yarn start

📝 Edit your frontend App.jsx in packages/react-app/src and open http://localhost:3000


blockchain

yarn run chain

Note: You’ll need to run this command in a new terminal window

🛠 Use this eth.build to double-check your local chain and account balances


⚙️ Compile your contracts:

yarn run compile

🚢 Deploy your contracts to the frontend:

yarn run deploy

🔍 Watch for changes then compile, deploy, and hot reload the frontend:

yarn run watch

🔥 Your dapp hot reloads as you build your smart contracts and frontend together 🔥


📝 Edit your smart contract SmartContractWallet.sol in packages/buidler/contracts

🤡 There is a spelling error in packages/buidler/contracts/SmartContractWallet.sol!

🤔 Can you fix it and deploy the contract locally?

🏗 scaffold-eth - 🏗 脚手架eth

☢️ Warning: It is very important that you find SmartContractWallet.sol in packages/buidler/contracts because there are other contract folders and it can get confusing.

🔬Test your contracts by editing myTest.js in packages/buidler/contracts:

yarn run test

🗝 List your local accounts:

yarn run accounts

💰 Check account balance:

yarn run balance **YOUR-ADDRESS**

💸 Send ETH:

yarn run send --from 0 --amount 0.5 --to **YOUR-ADDRESS**

🔧 Configure 👷Buidler by editing buidler.config.js in packages/buidler


The BuidlerEVM provides stack traces and console.log debugging for our contracts


🏃‍♂️ Speedrun (🎥 7 min):

🏗 scaffold-eth - 🏗 脚手架eth


🔬 Smart Contract Sandbox:

💾 install:

git clone https://github.com/austintgriffith/scaffold-eth.git smart-contract-sandbox  cd smart-contract-sandbox  yarn install

⚙️ start

#run in original terminal window: yarn start #run in terminal window 2: yarn run chain #run in terminal window 3: yarn run deploy

🔏 Edit or rename your smart contract YourContract.sol in packages/buidler/contracts

📝 Edit your frontend App.jsx in packages/react-app/src

📱 Open http://localhost:3000 to see the app

☢️ Make sure are running your local chain yarn run chain and your contract is deployed with yarn run deploy

🔥 Try yarn run watch and as you change your Solidity, your frontend <Contract/> will hot reload to give you access to new variables and functions:

📽 Video Guide

📚 RTFM: Check out solidity by example and check out the Solidity globals and units

🚀 Good luck, and go get ’em!


🔏 Web3 Providers:

The frontend has three different providers that provide different levels of access to different chains:

mainnetProvider: (read only) Infura connection to main Ethereum network (and contracts already deployed like DAI or Uniswap).

localProvider: local Buidler accounts, used to read from your contracts (.env file points you at testnet or mainnet)

injectedProvider: your personal MetaMask, WalletConnect via Argent, or other injected wallet (generates burner-provider on page load)


🐜 Ant.design is the UI library with components like the grids, menus, dates, times, buttons, etc.


Helpers:

Transactor: The transactor returns a tx() function to make running and tracking transactions as simple and standardized as possible. We will bring in BlockNative’s Notify library to track our testnet and mainnet transactions.

const tx = Transactor(props.injectedProvider, props.gasPrice);

Then you can use the tx() function to send funds and write to your smart contracts:

tx({   to: readContracts[contractName].address,   value: parseEther("0.001"), });
tx(writeContracts["SmartContractWallet"].updateOwner(newOwner));

☢️ Warning: You will need to update the configuration for react-app/src/helpers/Transactor.js to use your BlockNative dappId


🖇 Hooks:

Commonly used Ethereum hooks located in packages/react-app/src/:

usePoller(fn, delay): runs a function on app load and then on a custom interval

usePoller(() => {   //do something cool at start and then every three seconds }, 3000);

useBalance(address, provider, [pollTime]): poll for the balance of an address from a provider

const localBalance = useBalance(address, localProvider);

useBlockNumber(provider,[pollTime]): get current block number from a provider

const blockNumber = useBlockNumber(props.provider);

useGasPrice([speed]): gets current “fast” price from ethgasstation

const gasPrice = useGasPrice();

useExchangePrice(mainnetProvider, [pollTime]): gets current price of Ethereum on the Uniswap exchange

const price = useExchangePrice(mainnetProvider);

useContractLoader(provider): loads your smart contract interface

const readContracts = useContractLoader(localProvider); const writeContracts = useContractLoader(injectedProvider);

useContractReader(contracts, contractName, variableName, [pollTime]): reads a variable from your contract and keeps it in the state

const title = useContractReader(props.readContracts, contractName, "title"); const owner = useContractReader(props.readContracts, contractName, "owner");

useEventListener(contracts, contractName, eventName, [provider], [startBlock]): listens for events from a smart contract and keeps them in the state

const ownerUpdates = useEventListener(   readContracts,   contractName,   "UpdateOwner",   props.localProvider,   1 );

📦 Components:

Your commonly used React Ethereum components located in packages/react-app/src/:

📬 <Address />: A simple display for an Ethereum address that uses a Blockie, lets you copy, and links to Etherescan.

  <Address value={address} />   <Address value={address} size="short" />   <Address value={address} size="long" blockexplorer="https://blockscout.com/poa/xdai/address/"/>   <Address value={address} ensProvider={mainnetProvider}/>

🏗 scaffold-eth - 🏗 脚手架eth

🖋 <AddressInput />: An input box you control with useState for an Ethereum address that uses a Blockie and ENS lookup/display.

  const [ address, setAddress ] = useState("")   <AddressInput     value={address}     ensProvider={props.ensProvider}     onChange={(address)=>{       setAddress(address)     }}   />

TODO GIF

💵 <Balance />: Displays the balance of an address in either dollars or decimal.

<Balance   address={address}   provider={injectedProvider}   dollarMultiplier={price} />

🏗 scaffold-eth - 🏗 脚手架eth

👤 <Account />: Allows your users to start with an Ethereum address on page load but upgrade to a more secure, injected provider, using Web3Modal. It will track your address and localProvider in your app’s state:

const [address, setAddress] = useState(); const [injectedProvider, setInjectedProvider] = useState(); const price = useExchangePrice(mainnetProvider);
<Account   address={address}   setAddress={setAddress}   localProvider={localProvider}   injectedProvider={injectedProvider}   setInjectedProvider={setInjectedProvider}   dollarMultiplier={price} />

🏗 scaffold-eth - 🏗 脚手架eth

💡 Notice: the <Account /> component will call setAddress and setInjectedProvider for you.

☢️ Warning: You will need to update the configuration for Web3Modal to use your Infura Id

📡 <Provider />: You can choose to display the provider connection status to your users with:

<Provider name={"mainnet"} provider={mainnetProvider} /> <Provider name={"local"} provider={localProvider} /> <Provider name={"injected"} provider={injectedProvider} />

🏗 scaffold-eth - 🏗 脚手架eth

💡 Notice: you will need to check the network id of your injectedProvider compared to your localProvider or mainnetProvider and alert your users if they are on the wrong network!


📄 Smart Contract Wallet:

📝 Edit your smart contract SmartContractWallet.sol in packages/buidler/contracts

📝 Then edit the SmartContractWallet.js React component in packages/react-app/src

▶️ Run yarn run compile and yarn run deploy or just yarn run watch

🏗 scaffold-eth - 🏗 脚手架eth

🛠 Run this eth.build with your contract address to ask it who its owner is.


📚 OpenZeppelin Contracts — TODO

You can import any of the OpenZeppelin contracts:

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

🛰 The Graph — TODO

⛽️ GSN — TODO


📤 Save to your Git

Create a new repo with the same name as this project and then:

git remote add origin https://github.com/**YOUR_GITHUB_USERNAME**/**YOUR_COOL_PROJECT_NAME**.git git push -u origin master

🛳 Ship it!

You can deploy your static site and your dapp can go live:

yarn run build  # ship it!  yarn run surge  OR  yarn run s3  OR  yarn run ipfs

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/17017.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计🏗 scaffold-eth – 🏗 脚手架eth

提供最优质的资源集合

立即查看 了解详情