最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

DAPP/FDF互助模式系統(tǒng)開發(fā)詳細(xì),DAPP/FDF互助開發(fā)源碼邏輯

2023-02-26 10:38 作者:bili_16249894763  | 我要投稿

  什么是DApp


  “DApp”代表去中心化應(yīng)用程序。與傳統(tǒng)應(yīng)用程序一樣,去中心化應(yīng)用程序也有前端(客戶端)和后端(服務(wù)器端)。DApp的用戶界面可以用任何語言編寫(就像傳統(tǒng)應(yīng)用程序一樣),并且可以調(diào)用其后端。那么,Dapps與傳統(tǒng)應(yīng)用程序有何不同?DApp的后端代碼運行在分散的對等網(wǎng)絡(luò)(即區(qū)塊鏈)上。您可能聽說過BitTorrent、Tor、Popcorn Time——它們是在點對點網(wǎng)絡(luò)上運行但不在區(qū)塊鏈上運行的DApp。


  Dapps開發(fā)包括三個簡單的步驟:


  在區(qū)塊鏈網(wǎng)絡(luò)上部署智能合約


  從部署的智能合約中讀取數(shù)據(jù)


  將交易發(fā)送到部署的智能合約


  智能合約


  Solidity是編寫智能合約最常用的語言,它編譯為可以在節(jié)點上運行的以太坊虛擬機(jī)上執(zhí)行的字節(jié)碼。


  pragma solidity^0.5.7;


  contract greeter{開發(fā)案例設(shè)計I35模式7O98開發(fā)O7I8


  string greeting;


  function greet(string memory _greeting)public{


  greeting=_greeting;


  }


  function getGreeting()public view returns(string memory){


  return greeting;


  }需求及模式:MrsFu123


  import json


  from web3 importWeb3,HTTPProvider


  from web3.contract importConciseContract


  #compile your smart contract with truffle first


  truffleFile=json.load(open('./build/contracts/greeter.json'))


  abi=truffleFile['abi']


  bytecode=truffleFile['bytecode']


  #web3.py instance


  w3=Web3(HTTPProvider("https://ropsten.infura.io/v3/<API key>"))#modify


  print(w3.isConnected())


  contract_address=Web3.toChecksumAddress("<Deployed Contract Address here>")#modify


  key="<Private key with 0x prefix here>"#modify


  acct=w3.eth.account.privateKeyToAccount(key)


  account_address=acct.address


  #Instantiate and deploy contract


  contract=w3.eth.contract(abi=abi,bytecode=bytecode)


  #Contract instance


  contract_instance=w3.eth.contract(abi=abi,address=contract_address)


  #Contract instance in concise mode


  #contract_instance=w3.eth.contract(abi=abi,address=contract_address,ContractFactoryClass=ConciseContract)


  tx=contract_instance.functions.greet("Hello all my goody people").buildTransaction({'nonce':w3.eth.getTransactionCount(account_address)})


  #Get tx receipt to get contract address


  signed_tx=w3.eth.account.signTransaction(tx,key)


  #tx_receipt=w3.eth.getTransactionReceipt(tx_hash)


  hash=w3.eth.sendRawTransaction(signed_tx.rawTransaction)


  print(hash.hex())


DAPP/FDF互助模式系統(tǒng)開發(fā)詳細(xì),DAPP/FDF互助開發(fā)源碼邏輯的評論 (共 條)

分享到微博請遵守國家法律
防城港市| 北安市| 祁东县| 运城市| 娄底市| 韩城市| 广平县| 基隆市| 武定县| 衡东县| 手游| 尖扎县| 瓮安县| 安顺市| 黄梅县| 天峨县| 松潘县| 射阳县| 长武县| 周宁县| 伊宁县| 广德县| 张掖市| 句容市| 舒兰市| 武胜县| 阿拉善右旗| 贵州省| 苗栗市| 福州市| 蒙自县| 芦溪县| 黎平县| 读书| 武义县| 天等县| 新乡市| 报价| 哈尔滨市| 津市市| 密云县|