FLIP COIN with ORACLE – 用甲骨文掷硬币区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,FLIP COIN with ORACLE – 用甲骨文掷硬币区块链毕设代写 是一篇很好的国外资料

FLIP COIN with ORACLE

A simple bet game with solidity using an Oracle (provableAPI.sol) for randomness You bet some ether and you can loose all or double the stake. You can see a video demo in the video directory

You have to edit the truffle-config.js file and create a .secret text file in the root directory of the project with the Metamask seed to make it work! The solidity contracts are in the contracts directory The html start file is index.html and in assets you find the included files To open the file in a browser (with metamask installed) you have to do in bash in the project root folder:

python -m http.server

to simulate a web server.

  • Installation

Clone the repository:

git clone https://github.com/acul71/FlipCoin_with_Oracle

Install this package with npm:

npm install --save-dev @truffle/hdwallet-provider

Do

truffle init

to create a new project

Then edit truffle-config.js and uncomment:

const HDWalletProvider = require('@truffle/hdwallet-provider'); const infuraKey = "fj4jll3k....."; // const fs = require('fs'); const mnemonic = fs.readFileSync(".secret").toString().trim();

HDWalletProvider is a tool that helps with transactions sign infuriaKey is a key you get from infuria. Infuria is an API that let us access to blockchain info without having to mantain a node. fs is a library for dealing with files mnemonic is the wallet seed that we put in .secret file

Than we uncomment the configuration for ropstien (test) network:

ropsten: {   provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),   network_id: 3, // Ropsten's id   gas: 5500000, // Ropsten has a lower block limit than mainnet   confirmations: 2, // # of confs to wait between deployments. (default: 0)   timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)   skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) },

Register on https://infura.io/ and copy the key (project secret) in infuriaKey than copy the api end point (select ropsten) https://ropsten.infura.io/v3/…… in ropsten provider Then put the metamask (wallet) seed frase in .secret file in the root of your project (don’t share this file put in .gitignore) 

Set the compiler version:

// Configure your compilers   compilers: {     solc: {       version: "0.5.12",    // Fetch exact version from solc-bin (default: truffle's version)

To deploy the project do this in the project folder:

truffle deploy --network ropsten

But you need to have (free) ropsten ether: go here https://faucet.metamask.io/


使用ORACLE进行掷硬币安装

一个简单的赌博游戏与坚实的使用甲骨文(可证API.sol)对于随机性,你可以用乙醚下注,这样你就可以把赌注全部输掉或加倍。你可以在视频目录中看到一个视频演示

你必须编辑松露-配置文件文件,并使用元掩码种子在项目的根目录中创建一个.secret文本文件,以使其正常工作!solidity契约在html开始文件所在的contracts目录中索引.html在assets中,您可以找到在浏览器中打开该文件所包含的文件(安装了metamask),您必须在bash中的project root文件夹中执行该操作:

python -m http.server

以模拟web服务器。

  • Installation

克隆存储库:

git clone https://github.com/acul71/FlipCoin_with_Oracle

使用npm安装此包:

npm install --save-dev @truffle/hdwallet-provider

执行

truffle init

创建新项目

然后编辑truffle-配置文件取消注释:

const HDWalletProvider = require('@truffle/hdwallet-provider'); const infuraKey = "fj4jll3k....."; // const fs = require('fs'); const mnemonic = fs.readFileSync(".secret").toString().trim();

HDWalletProvider是一个帮助交易签名的工具,它是一个从infuria获得的密钥。Infuria是一个API,它让我们无需维护节点就可以访问区块链blockchain信息。fs是一个处理文件的库助记符是我们放入的钱包种子。秘密文件

然后我们取消对ropstien(测试)网络的配置的注释:

ropsten: {   provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),   network_id: 3, // Ropsten's id   gas: 5500000, // Ropsten has a lower block limit than mainnet   confirmations: 2, // # of confs to wait between deployments. (default: 0)   timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)   skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) },

注册https://infura.io/并在infurikey中复制密钥(projectsecret),而不是复制api端点(select ropsten)https://ropsten.infura.io/v3/。。。。。。在ropsten provider中,然后将metamask(wallet)seed frase in.secret文件放在项目根目录下(不要共享此文件put-in.gitignore)

设置编译器版本:

// Configure your compilers   compilers: {     solc: {       version: "0.5.12",    // Fetch exact version from solc-bin (default: truffle's version)

若要部署项目,请在项目文件夹中执行此操作:

truffle deploy --network ropsten

但您需要(免费)ropsten ether:转到此处https://faucet.metamask.io/

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情