本文原文連接
點擊這裏獲取Etherscan API 中文文檔(完整版)
完整內容排版更好,推薦讀者前往閱讀。html
智能合約相關的 API,接口的參數說明請參考Etherscan API 約定, 文檔中不單獨說明。web
Newly verified Contracts are synced to the API servers within 5 minutes or lessapi
Verified Contract Source Codesless
https://api.etherscan.io/api?module=contract&action=getabi&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyToken
A simple sample for retrieving the contractABI using Web3.js and Jquery to interact with a contractide
var Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider()); var version = web3.version.api; $.getJSON('http://api.etherscan.io/api?module=contract&action=getabi&address=0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359', function (data) { var contractABI = ""; contractABI = JSON.parse(data.result); if (contractABI != ''){ var MyContract = web3.eth.contract(contractABI); var myContractInstance = MyContract.at("0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359"); var result = myContractInstance.memberId("0xfe8ad7dd2f564a877cc23feea6c0a9cc2e783715"); console.log("result1 : " + result); var result = myContractInstance.members(1); console.log("result2 : " + result); } else { console.log("Error" ); } });
https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyToken
示意圖:
ui
Solidity 中文文檔(完整版)
ethers.js 中文文檔(完整版)
Web3.js 中文文檔(完整版)
Truffle 中文文檔(完整版)code