Community App – 社区应用程序区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Community App – 社区应用程序区块链毕设代写 是一篇很好的国外资料

Community App

truffle

Within the truffle folder you will see:

  • client: this contains the React frontend code.
  • contracts: this contains the project contracts
  • migrations: migration scripts for deploying
  • test: unit tests for the contract

*Note: Please ensure you are running solidity@6 (brew install solidity@6 for mac users). Contracts require ^0.6.0 to compile.

To get started with the contracts:

  1. Run truffle compile to ensure your contracts properly compile.
  2. Run truffle test to ensure your unit tests pass.
  3. Start your ganache gui or ganache cli – ganache-cli.
  4. Run truffle migrate to deploy the contracts on to your local blockchain. (Wait upto 30seconds to ensure your local blockchains updates and contract deployed )
  5. Start react app by typing cd client && npm install && npm run start. You will be redirect to a local dev server, http://localhost:3000
  6. Now grab the account address ganache set as the owner of the contract (the first account in the list). With that address and private key add to your metamask wallet and ensure you use this account when connecting to the webapp. * Note: Add atleast the first account (contract owner) and secondary address so you can test how users will interact with frontend).

Once the DApp loads, after connecting your MM account you will be presented with the current Candidates available (which will be empty to start), as well as the Administration tools only available to the owner (Adding candidates / adding addresses). You can also turn candidates on/off. Toggling this visibility will hide them from the frontend but still keeps their record in the full list.

Add your secondary address as another user and switch your metamask wallet to that account. Refresh page and will now be interacting as a user.

Testnet – Help guide: https://forum.openzeppelin.com/t/connecting-to-public-test-networks-with-truffle/2960

To deploy the contract to ropsten network, first get a projectID from infura.com. Then in the truffle folder create a secrets.json file with to items: mnemonic & projectId. Enter your mnemonic phrase and your infura project id. (npx mnemonics to install a package to generate a phrase for you) { “mnemonic”: “planet auto sign choice …”, “projectId”: “305c137050…” } Test Connection:

  • npx truffle console --network ropsten
  • await web3.eth.getAccounts()
  • await web3.eth.getBalance('0x0000000000000000000000') (change address to first reported address from getAccounts method)

Get some ether for your address: https://faucet.ropsten.be/

Deploy contract to ropsten: npx truffle migrate --network ropsten

mobile-app

A mobile app was also created to extend how users can interact with the Voting frontend. Using a react native app, along with WalletConnect, we are able to connect to our local ganache blockchain and interact with the contract as you would on the desktop. The app will use a mobile wallet (ie MetaMask Mobile) to sign all transactions.

  1. App Template App is created using the boilerplate from https://github.com/infinitered/ignite-andross.

Check out https://reactnative.dev/docs/getting-started to ensure you have the prerequisites up and running for either android or ios platform. iOS will only work on Mac and require an apple developer account.

  1. To get started run

    • cd mobile-app/CommunityApp
    • yarn install
    • yarn run ios or yarn run android. This will compile the app and launch a simulator for the desired platform.
  2. Use ignite helpers to create components, screens and more https://github.com/infinitered/ignite-andross#boilerplate-walkthrough.

    • npx ignite-cli g container Containername
    • npx ignite-cli g screen Screenname
    • npx ignite-cli g component Componentname
  3. In order to connect to a wallet and sign transactions, this library was integrated: https://github.com/cawfree/react-native-walletconnect. This library provides a web browser interface for interacting with the WalletConnect library. (https://walletconnect.org). You can also provide a native integration of WalletConnect (but need to create your own UI for selecting a wallet).

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


社区应用程序

truffle

在truffle文件夹中,您将看到:

  • 客户端:这包含React前端代码。
  • 合同:包含项目合同
  • 迁移:用于部署的迁移脚本
  • 测试:合同的单元测试

*注意:请确保您正在运行固体@6(brew安装固体@6对于mac用户)。合同需要^0.6.0才能编译。

要开始合同:

  1. 运行truffle compile以确保合同正确编译。运行truffle测试以确保单元测试通过。
  2. 启动您的ganache gui或ganache cli-ganache cli。
  3. 运行truffle migrate将合同部署到本地区块链blockchain上。(等待30秒以确保本地区块链blockchain更新和合同部署)
  4. 键入cd client&npm install&npm run Start启动react app。您将被重定向到本地开发服务器,http://localhost:3000
  5. 现在获取作为合同所有者的帐户地址ganache(列表中的第一个帐户)。使用该地址和私钥添加到你的metamask钱包,并确保你在连接到webapp时使用此帐户。*注意:请至少添加第一个帐户(合同所有者)和第二个地址,以便测试用户将如何与前端交互。
  6. npx truffle控制台——network ropsten

一旦DApp加载,在连接您的MM帐户后,您将看到当前可用的候选人(开始时将为空),以及仅对所有者可用的管理工具(添加候选人/添加地址)。您还可以打开/关闭应聘者。切换此可见性将从前端隐藏它们,但仍将它们的记录保留在完整列表中。

将您的第二地址添加为另一个用户,并将metamask钱包切换到该帐户。刷新页面,现在将作为用户进行交互。

Testnet-帮助指南:https://forum.openzeppelin.com/t/connecting-to-public-test-networks-with-truffle/2960

要将协定部署到ropsten network,请首先从infura.com网站. 然后在truffle文件夹中创建一个机密.json使用“收件人”项的文件:助记符和项目ID。输入你的助记符短语和你的infura项目id.(npx助记符来安装一个包来为你生成一个短语){“助记符”:“planet auto-sign choice…”,“projectId”:“305c137050…”}测试连接:

  • 等待web3。eth.getAccounts公司()
  • 等待web3。eth.getBalance公司(’0x0000000000000000000000’)(将地址从getAccounts方法更改为第一个报告的地址)
  • 应用程序模板应用程序是使用https://github.com/infinited/ignite-andross。

为您的地址获取一些乙醚:https://faucet.ropsten.be/

将契约部署到ropsten:npx truffle migrate–network ropsten也创建了一个移动应用程序来扩展用户与投票前端的交互方式。使用react native应用程序和WalletConnect,我们可以连接到本地的ganache区块链blockchain,并像您在桌面上一样与合同进行交互。该应用程序将使用移动钱包(即MetaMask mobile)签署所有交易。

移动应用程序

退房https://reactnative.dev/docs/getting-started以确保您具备android或ios平台的先决条件。iOS只能在Mac上运行,并且需要一个苹果开发者帐户。

  1. 要开始运行cd移动应用程序/社区应用程序yarn,请安装yarn run ios或yarn run android。这将编译应用程序并为所需的平台启动一个模拟器。

开始运行

  1. cd移动应用程序/社区应用程序
  2. npx ignite cli g screen screen name
  3. 我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。

我们使用可选的第三方分析cookies来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。
您可以随时通过单击页面底部的Cookie首选项来更新您的选择。有关更多信息,请参阅我们的隐私声明。

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

www.interchains.cc

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

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Community App – 社区应用程序区块链毕设代写

提供最优质的资源集合

立即查看 了解详情