FIl模式Defi模式燃燒代幣模式專案系統開發技術(成熟技術)

a1271916008發表於2023-04-25

  Mining is a popular investment channel nowadays,but in fact,there are so many other investment channels now.Why do many miners choose to invest in mining?It's actually related to risk return.The digital currency investment market is divided into the production and circulation process of digital currency.It can be imagined that the lower the risk generated by being closer to the downstream of the industry,the lower the return rate.The trading process is not supported by the price of physical mining machines,and the rich expansion of trading products also indirectly increases leverage risk.


  開啟測試網路的控制檯


  輸入以下命令:


  geth--datadir"~/ethdev"--dev console 2>>geth.log


  這樣我們就開啟了測試網的控制檯,之後的步驟如無特別說明都將在控制檯中完成。


  編寫智慧合約


  >source="contract test{function hello()returns(string s){return'hello world!';}}"


  "contract test{function hello()returns(string s){return'hello world!';}}"


  編譯智慧合約


  >contract=eth.compile.solidity(source).test


  1


  指定建立合約的外部賬戶


  我們首先需要從當前的賬戶裡選擇一個作為建立智慧合約的外部賬戶:


  >address=eth.accounts[0]


  "0x62b1746767522b36f6421e630fa0198151d72964"


  然後將該賬戶啟用:


  >personal.unlockAccount(address,'123456',10000)


  true


  最後開啟挖礦,為處理交易做準備:


  >miner.start()


  true


  部署合約


  部署合約就是將編譯好的合約位元組碼透過外部賬號傳送交易的形式部署到以太坊區塊鏈上。輸入以下命令:


  >abi=[{constant:false,inputs:null}]


  [{


  constant:false,


  inputs:null


  }]


  >MyContract=eth.contract(abi)


  {


  abi:[{


  constant:false,


  inputs:null


  }],


  eth:{


  accounts:["0x62b1746767522b36f6421e630fa0198151d72964","0xaa79b5468a4f4cf35a32cc976f689a5db5873f0c"],


  blockNumber:600,


  coinbase:"0x62b1746767522b36f6421e630fa0198151d72964",


  compile:{


  lll:function(),


  serpent:function(),


  solidity:function()


  },


  defaultAccount:"0x62b1746767522b36f6421e630fa0198151d72964",


  defaultBlock:"latest",


  gasPrice:20000000000,


  hashrate:3302,


  mining:true,


  pendingTransactions:[],


  syncing:false,


  call:function(),


  contract:function(abi),


  estimateGas:function(),


  filter:function(fil,callback),


  getAccounts:function(callback),


  getBalance:function(),


  getBlock:function(),


  getBlockNumber:function(callback),


  getBlockTransactionCount:function(),


  getBlockUncleCount:function(),


  getCode:function(),


  getCoinbase:function(callback),


  getCompilers:function(),


  getGasPrice:function(callback),


  getHashrate:function(callback),


  getMining:function(callback),


  getNatSpec:function(),


  getPendingTransactions:function(callback),


  getStorageAt:function(),


  getSyncing:function(callback),


  getTransaction:function(),


  getTransactionCount:function(),


  getTransactionFromBlock:function(),


  getTransactionReceipt:function(),


  getUncle:function(),


  getWork:function(),


  iban:function(iban),


  icapNamereg:function(),


  isSyncing:function(callback),


  namereg:function(),


  resend:function(),


  sendIBANTransaction:function(),


  sendRawTransaction:function(),


  sendTransaction:function(),


  sign:function(),


  signTransaction:function(),


  submitTransaction:function(),


  submitWork:function()


  },


  at:function(address,callback),


  getData:function(),


  new:function()


  }


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69983064/viewspace-2948584/,如需轉載,請註明出處,否則將追究法律責任。

相關文章