五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

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

互助開發(fā)丨互助系統(tǒng)開發(fā)(FDF開發(fā))丨互助源碼模式

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

  智能合約是部署在區(qū)塊鏈的代碼,區(qū)塊鏈本身不能執(zhí)行代碼,代碼的執(zhí)行是在本地的EVM中,實際上,部署在區(qū)塊鏈上代碼是能夠在本地產(chǎn)生原智能合約代碼的代碼,可以理解區(qū)塊鏈為一個數(shù)據(jù)庫,而客戶端從數(shù)據(jù)庫中讀取了存儲的運行代碼,并在本地運行后,將結果寫入到了區(qū)塊鏈這個數(shù)據(jù)庫中。


  Smart contracts are only programs stored on the blockchain,which will run when the predetermined conditions are met.They are often used to automate the execution of the agreement so that all participants can immediately determine the results without any middleman and without wasting time.They can also automatically complete the workflow and trigger the next operation when the conditions are met.


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


  a)創(chuàng)建項目:


  mkdir pythonDapp


  cd pythonDapp


  truffle init


  成功初始化項目后,轉到您的文件夾并在/contracts目錄中創(chuàng)建greeter.sol文件。在網(wǎng)絡上部署合約之前,我們必須編譯它并構建工件。


  b)智能合約的編譯:開發(fā)方案I35合約7O98系統(tǒng)O7I8


  因此,對于編譯,我們將使用Truffle solc編譯器。在您的主目錄中,運行以下命令:


  truffle compile


  (or)


  truffle.cmd compile#(for windows only)


  上面的命令將在/contracts目錄中編譯你的合約,并在/build目錄中創(chuàng)建二進制工件文件greeter.json。


  c)部署合約:詳細需求:MrsFu123


  打開您的Python IDLE編輯器,并在主目錄deploy.py中使用以下代碼創(chuàng)建一個新文件,然后在您的目錄中運行py deploy.py。


  import json


  from web3 importWeb3,HTTPProvider


  from web3.contract importConciseContract


  #web3.py instance


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


  print(w3.isConnected())


  key="<Private Key here with 0x prefix>"


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


  #compile your smart contract with truffle first


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


  abi=truffleFile['abi']


  bytecode=truffleFile['bytecode']


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


  #building transaction


  construct_txn=contract.constructor().buildTransaction({


  'from':acct.address,


  'nonce':w3.eth.getTransactionCount(acct.address),


  'gas':1728712,


  'gasPrice':w3.toWei('21','gwei')})


  signed=acct.signTransaction(construct_txn)


  tx_hash=w3.eth.sendRawTransaction(signed.rawTransaction)


  print(tx_hash.hex())


  tx_receipt=w3.eth.waitForTransactionReceipt(tx_hash)


  print("Contract Deployed At:",tx_receipt['contractAddress'])


互助開發(fā)丨互助系統(tǒng)開發(fā)(FDF開發(fā))丨互助源碼模式的評論 (共 條)

分享到微博請遵守國家法律
二手房| 随州市| 宁海县| 台江县| 内江市| 吉安县| 来安县| 德保县| 万宁市| 青神县| 永善县| 雷波县| 余庆县| 夹江县| 临沭县| 东山县| 阜新市| 栾城县| 策勒县| 葫芦岛市| 宜章县| 松滋市| 勃利县| 时尚| 萨迦县| 石棉县| 南平市| 陕西省| 信阳市| 娄烦县| 西昌市| 遵义县| 同江市| 齐河县| 漾濞| 监利县| 桂平市| 津南区| 兴宁市| 保亭| 乳山市|