Upgradeable Solidity Smart Contracts (with simple React front-end) – 可升级的Solidity智能合约区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Upgradeable Solidity Smart Contracts
(with simple React front-end) – 可升级的Solidity智能合约区块链毕设代写 是一篇很好的国外资料

Upgradeable Solidity Smart Contracts
(with simple React front-end)

The purpose of this repository is to demonstrate how to develop upgradeable smart contracts.

Dependencies

Truffle v4.1.12 Node v8.11.3

To Run

Once Truffle and Node are installed:

  1. Navigate to project dir via terminal
  2. run truffle develop -Starts a development blockchain which will allow you to “migrate” the smart contracts onto.
  3. run compile -Compiles all the smart contracts into their respective “ABIs.”
  4. run migrate -Migrate the contracts onto the development server.
  5. In a separate terminal tab/window navigate to the project dir and run npm run start -This will start a development server which you can access via http://localhost:3000 in your browser
  6. Setup MetaMask (below)

MetaMask

MetaMask is an Ethereum wallet Chrome extension, which makes it easy to process transactions in browser. To interact with this application, this extension needs to be installed and setup properly. Out of the box it is setup to connect to the main Ethereum network, but we want it to interact with our local development blockchain.

Setup MetaMask

  1. Install the MetaMask Chrome Extension
  2. Once installed, open up MetaMask and locate Main Ethereum Network at the top. Click on this to open up other network options.
  3. At the bottom click on Custom RPC.
  4. Under New RPC URL input the address: http://localhost:9545 then save.(This is the port that the development chain should be running on)
  5. At this point MetaMask should connect to your development blockchain if it’s running. Once MetaMask is setup on the private network, the front-end can send and recieve data from the blockchain.

Setup Ethereum Test Account

  1. Logout of MetaMask, then click Import using account seed phrase.
  2. Find the seed phrase given from the development blockchain and use it to setup a new account. (This seed phrase is normally printed in the console when the development blockchain started.)
  3. Now you have access to test funds from your newly created account on the development blockchain.

How the Contracts Interact

The workings of this proxy would not be possible without the knowledge gained from the following article: How to write upgradable smart contracts in solidity!

This repo was designed to take the idea of upgradeable smart-contracts one step further and add interface support so that large contracts can be split to meet gas constraints.

Below you will find a visual of how all of the contracts interact together.

Key:

  • Every rectange represents a different contract, with the contract name in bold at the top. PropertyStorageProxy is also a separate contract, but it is used to ‘leech’ onto PropertyManagementV1 and essentially become it.
  • The solid arrows point to parent contracts of the originator.
  • The dashed arrows show where pointers are stored.

First be aware that only certain contracts are upgradeable. EternalStorage, PropertyStorageProxy, and StorageState cannot be upgraded. Because of this, a key-value storage scheme is used in EternalStorage so that any type of data scheme can be used. All of these contracts work together to make access to EternalStorage possible. All data in EternalStorage is stored in a mapping that maps msg.sender to the data so that external addresses cannot alter the data.

The rest of the contracts can be upgraded and hold the logic to make the DApp functional.

Upgradeable Solidity Smart Contracts    (with simple React front-end) - 可升级的Solidity智能合约

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.


Upgradeable Solidity Smart Contracts
(with simple React front-end)

The purpose of this repository is to demonstrate how to develop upgradeable smart contracts.

Dependencies

Truffle v4.1.12 Node v8.11.3

To Run

Once Truffle and Node are installed:

  1. Navigate to project dir via terminal
  2. run truffle develop -Starts a development blockchain which will allow you to “migrate” the smart contracts onto.
  3. run compile -Compiles all the smart contracts into their respective “ABIs.”
  4. run migrate -Migrate the contracts onto the development server.
  5. In a separate terminal tab/window navigate to the project dir and run npm run start -This will start a development server which you can access via http://localhost:3000 in your browser
  6. Setup MetaMask (below)

MetaMask

MetaMask is an Ethereum wallet Chrome extension, which makes it easy to process transactions in browser. To interact with this application, this extension needs to be installed and setup properly. Out of the box it is setup to connect to the main Ethereum network, but we want it to interact with our local development blockchain.

Setup MetaMask

  1. Install the MetaMask Chrome Extension
  2. Once installed, open up MetaMask and locate Main Ethereum Network at the top. Click on this to open up other network options.
  3. At the bottom click on Custom RPC.
  4. Under New RPC URL input the address: http://localhost:9545 then save.(This is the port that the development chain should be running on)
  5. At this point MetaMask should connect to your development blockchain if it’s running. Once MetaMask is setup on the private network, the front-end can send and recieve data from the blockchain.

Setup Ethereum Test Account

  1. Logout of MetaMask, then click Import using account seed phrase.
  2. Find the seed phrase given from the development blockchain and use it to setup a new account. (This seed phrase is normally printed in the console when the development blockchain started.)
  3. Now you have access to test funds from your newly created account on the development blockchain.

How the Contracts Interact

The workings of this proxy would not be possible without the knowledge gained from the following article: How to write upgradable smart contracts in solidity!

This repo was designed to take the idea of upgradeable smart-contracts one step further and add interface support so that large contracts can be split to meet gas constraints.

Below you will find a visual of how all of the contracts interact together.

Key:

  • Every rectange represents a different contract, with the contract name in bold at the top. PropertyStorageProxy is also a separate contract, but it is used to ‘leech’ onto PropertyManagementV1 and essentially become it.
  • The solid arrows point to parent contracts of the originator.
  • The dashed arrows show where pointers are stored.

First be aware that only certain contracts are upgradeable. EternalStorage, PropertyStorageProxy, and StorageState cannot be upgraded. Because of this, a key-value storage scheme is used in EternalStorage so that any type of data scheme can be used. All of these contracts work together to make access to EternalStorage possible. All data in EternalStorage is stored in a mapping that maps msg.sender to the data so that external addresses cannot alter the data.

The rest of the contracts can be upgraded and hold the logic to make the DApp functional.

Upgradeable Solidity Smart Contracts    (with simple React front-end) - 可升级的Solidity智能合约

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.

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

www.interchains.cc

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

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Upgradeable Solidity Smart Contracts (with simple React front-end) – 可升级的Solidity智能合约区块链毕设代写

提供最优质的资源集合

立即查看 了解详情