以太坊開發文件08
命令列選項
geth [global options] command [command options] [arguments...] VERSION: 1.0.0 COMMANDS: recover attempts to recover a corrupted database by setting a new block by number or hash. See help recover. blocktest loads a block test file import import a blockchain file export export blockchain into file upgradedb upgrade chainblock database removedb Remove blockchain and state databases dump dump a specific block from storage monitor Geth Monitor: node metrics monitoring and visualization makedag generate ethash dag (for testing) version print ethereum version numbers wallet ethereum presale wallet account manage accounts console Geth Console: interactive JavaScript environment attach Geth Console: interactive JavaScript environment (connect to node) js executes the given JavaScript files in the Geth JavaScript VM help Shows a list of commands or help for one command GLOBAL OPTIONS: --identity Custom node name --unlock Unlock the account given until this program exits (prompts for password). '--unlock n' unlocks the n-th account in order or creation. --password Path to password file to use with options and subcommands needing a password --genesis Inserts/Overwrites the genesis block (json format) --bootnodes Space-separated enode URLs for p2p discovery bootstrap --datadir "/Users/tron/Library/Ethereum" Data directory to be used --blockchainversion "3" Blockchain version (integer) --jspath "." JS library path to be used with console and js subcommands --port "30303" Network listening port --maxpeers "25" Maximum number of network peers (network disabled if set to 0) --maxpendpeers "0" Maximum number of pending connection attempts (defaults used if set to 0) --etherbase "0" Public address for block mining rewards. By default the address first created is used --gasprice "1000000000000" Sets the minimal gasprice when mining transactions --minerthreads "8" Number of miner threads --mine Enable mining --autodag Enable automatic DAG pregeneration --nat "any" NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) --natspec Enable NatSpec confirmation notice --nodiscover Disables the peer discovery mechanism (manual peer addition) --nodekey P2P node key file --nodekeyhex P2P node key as hex (for testing) --rpc Enable the JSON-RPC server --rpcaddr "127.0.0.1" Listening address for the JSON-RPC server --rpcport "8545" Port on which the JSON-RPC server should listen --rpcapi "db,eth,net,web3" Specify the API's which are offered over the HTTP RPC interface --ipcdisable Disable the IPC-RPC server --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" Specify the API's which are offered over the IPC interface --ipcpath "/Users/tron/Library/Ethereum/geth.ipc" Filename for IPC socket/pipe --exec Execute javascript statement (only in combination with console/attach) --shh Enable whisper --vmdebug Virtual Machine debug output --networkid "1" Network Id (integer) --rpccorsdomain Domain on which to send Access-Control-Allow-Origin header --verbosity "3" Logging verbosity: 0-6 (0=silent, 1=error, 2=warn, 3=info, 4=core, 5=debug, 6=debug detail) --backtrace_at ":0" If set to a file and line number (e.g., "block.go:271") holding a logging statement, a stack trace will be logged --logtostderr Logs are written to standard error instead of to files. --vmodule "" The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the ".go" suffix) or "glob" pattern and N is a log verbosity level. --logfile Send log output to a file --logjson Send json structured log output to a file or '-' for standard output (default: no json output) --pprof Enable the profiling server on localhost --pprofport "6060" Port on which the profiler should listen --metrics Enables metrics collection and reporting --solc "solc" solidity compiler to be used --gpomin "1000000000000" Minimum suggested gas price --gpomax "100000000000000" Maximum suggested gas price --gpofull "80" Full block threshold for gas price calculation (%) --gpobasedown "10" Suggested gas price base step down ratio (1/1000) --gpobaseup "100" Suggested gas price base step up ratio (1/1000) --gpobasecf "110" Suggested gas price base correction factor (%) --help, -h show help
請注意,datadir的預設值是特定於平臺的。有關更多資訊,請參閱備份和恢復。
例子
帳號
請參閱帳戶管理
將ether預售錢包匯入您的節點(提示輸入密碼):
geth wallet import /path/to/my/etherwallet.json
將一個EC金鑰匯入以太坊帳戶(提示輸入密碼):
geth account import /path/to/key.prv
Geth JavaScript執行時環境
調出geth JavaScript控制檯:
geth --verbosity 5 --jspath /mydapp/js console 2>> /path/to/logfile
test.js
使用js API 執行javascript並將Debug級別的訊息記錄到/path/to/logfile
:
geth --verbosity 6 js test.js 2>> /path/to/logfile
匯入/匯出鏈和轉儲塊
從檔案匯入區塊鏈:
geth import blockchain.bin
升級chainblock資料庫
當一致性演算法改變時,區塊鏈中的塊必須重新匯入新演算法。在需要的時候,Geth會通知使用者說明何時以及如何做到這一點。
geth upgradedb
採礦和網路
使用分別偵聽埠30303和30304的不同資料目錄啟動兩個挖掘節點:
geth --mine --minerthreads 4 --datadir /usr/local/share/ethereum/30303 --port 30303
geth --mine --minerthreads 4 --datadir /usr/local/share/ethereum/30304 --port 30304
在埠8000上啟動一個rpc客戶端:
geth --rpc=true --rpcport 8000 --rpccorsdomain '"*"'
無網路啟動客戶端:
geth --maxpeers 0 --nodiscover --networdid 3301 js justwannarunthis.js
重置區塊鏈
在datadir中,刪除blockchain目錄。對於上面的例子:
rm -rf /usr/local/share/ethereum/30303/blockchain
測試環境中的示例用法
以下各行僅用於測試網路和非互動式指令碼使用的安全環境。
geth --datadir /tmp/eth/42 --password <(echo -n notsosecret) account new 2>> /tmp/eth/42.log
geth --datadir /tmp/eth/42 --port 30342 js <(echo 'console.log(admin.nodeInfo().NodeUrl)') > enode 2>> /tmp/eth/42.log
geth --datadir /tmp/eth/42 --port 30342 --password <(echo -n notsosecret) --unlock primary --minerthreads 4 --mine 2>> /tmp/eth/42.log
連線
將控制檯連線到正在執行的geth例項。預設情況下,這發生在預設IPC端點上的IPC上,但是在必要時可以指定一個自定義端點:
geth attach ipc:/some/path
geth attach rpc:http://host:8545
設定標誌的其他方法
警告:這不適用於最新的邊界。
相同的標誌可以通過配置檔案(預設<datadir>/conf.ini
)以及環境變數來設定。
優先順序:預設<配置檔案<環境變數<命令列
JSON RPC API
JSON是一種輕量級的資料交換格式。它可以表示數字,字串,有序的值序列以及名稱/值對的集合。
JSON-RPC是一種無狀態,輕量級的遠端過程呼叫(RPC)協議。這個規範主要定義了幾個資料結構和圍繞它們處理的規則。它是傳輸不可知的,因為這些概念可以在同一個程序中,在套接字上,在HTTP上,或在許多不同的訊息傳遞環境中使用。它使用JSON(RFC 4627)作為資料格式。
JavaScript API
要從JavaScript應用程式內部與ethereum節點交談,請使用web3.js庫,該庫為RPC方法提供了一個方便的介面。有關更多資訊,請參閱JavaScript API。
JSON-RPC端點
預設的JSON-RPC端點:
C++: http://localhost:8545
Go: http://localhost:8545
Py: http://localhost:4000
GO
您可以使用該--rpc
標誌啟動HTTP JSON-RPC
geth --rpc
更改預設埠(8545)和列表地址(本地主機):
geth --rpc --rpcaddr <ip> --rpcport <portnumber>
如果從瀏覽器訪問RPC,則CORS需要啟用相應的域集。否則,JavaScript呼叫受到同源策略的限制,請求將失敗:
geth --rpc --rpccorsdomain "http://localhost:3000"
JSON RPC也可以使用該命令從geth控制檯啟動admin.startRPC(addr,
port)
。
C ++
您可以通過eth
使用-j
選項執行應用程式來啟動它:
./eth -j
您也可以指定JSON-RPC埠(預設為8545):
./eth -j --json-rpc-port 8079
Python
在python中,JSONRPC伺服器當前預設啟動並偵聽 127.0.0.1:4000
您可以通過提供配置選項來更改埠和監聽地址。
pyethapp -c jsonrpc.listen_port=4002 -c jsonrpc.listen_host=127.0.0.2 run
JSON-RPC支援
CPP-復仇 | 去-復仇 | PY-復仇 | |
---|---|---|---|
JSON-RPC 1.0 | ✓ | ||
JSON-RPC 2.0 | ✓ | ✓ | ✓ |
批量請求 | ✓ | ✓ | ✓ |
HTTP | ✓ | ✓ | ✓ |
輸出HEX值
目前有兩個通過JSON傳遞的關鍵資料型別:未格式化的位元組陣列和數量。兩者都以十六進位制編碼傳遞,但對格式要求不同:
當編碼QUANTITIES(整數,數字)時:編碼為十六進位制,字首為“0x”,最緊湊的表示(略有例外:零應表示為“0x0”)。例子:
- 0x41(十進位制65)
- 0x400(十進位制1024)
- 錯誤:0x(應始終至少有一個數字 - 零是“0x0”)
- 錯誤:0x0400(不允許前導零)
- 錯誤:ff(必須加字首0x)
編碼UNFORMATTED DATA(位元組陣列,帳戶地址,雜湊,位元組碼陣列)時:編碼為十六進位制,字首為“0x”,每個位元組兩個十六進位制數字。例子:
- 0x41(大小1,“A”)
- 0x004200(大小3,“\ 0B \ 0”)
- 0x(大小0,“”)
- 錯誤:0xf0f0f(必須是偶數位數)
- 錯誤:004200(必須加字首0x)
預設的塊引數
以下方法具有額外的預設塊引數:
當請求作用於以太坊的狀態時,最後的預設塊引數決定塊的高度。
以下選項可用於defaultBlock引數:
HEX String
- 一個整數塊號碼String "earliest"
為最早/起源塊String "latest"
- 為最新的開採塊String "pending"
- 待處理狀態/交易
JSON-RPC方法
JSON RPC API參考
web3_clientVersion
返回當前的客戶端版本。
引數
沒有
返回
String
- 當前的客戶端版本
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
// Result
{
"id":67,
"jsonrpc":"2.0",
"result": "Mist/v0.9.3/darwin/go1.4.1"
}
web3_sha3
返回給定資料的Keccak-256(不是標準化的SHA3-256)。
引數
String
- 要轉換為SHA3雜湊的資料
params: [
'0x68656c6c6f20776f726c64'
]
返回
DATA
- 給定字串的SHA3結果。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}'
// Result
{
"id":64,
"jsonrpc": "2.0",
"result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}
net_version
返回當前的網路協議版本。
引數
沒有
返回
String
- 當前的網路協議版本
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": "59"
}
net_listening
true
如果客戶端正在主動偵聽網路連線,則返回。
引數
沒有
返回
Boolean
- true
當聽時,否則false
。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'
// Result
{
"id":67,
"jsonrpc":"2.0",
"result":true
}
net_peerCount
返回當前連線到客戶端的對端的數量。
引數
沒有
返回
QUANTITY
- 連線對等體的數量的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'
// Result
{
"id":74,
"jsonrpc": "2.0",
"result": "0x2" // 2
}
eth_protocolVersion
返回當前的ethereum協議版本。
引數
沒有
返回
String
- 當前ethereum協議版本
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": "54"
}
eth_syncing
用關於同步狀態或FALSE的資料返回一個物件物件。
引數
沒有
返回
Object|Boolean
,具有同步狀態資料的物件,或者FALSE
在不同步時:
startingBlock
:QUANTITY
- 匯入開始的塊(只有在同步達到他的頭後才會被重置)currentBlock
:QUANTITY
- 當前塊,與eth_blockNumber相同highestBlock
:QUANTITY
- 估計的最高區塊
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_isSyncing","params":[],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": {
startingBlock: '0x384',
currentBlock: '0x386',
highestBlock: '0x454'
}
}
// Or when not syncing
{
"id":1,
"jsonrpc": "2.0",
"result": false
}
eth_coinbase
返回客戶的coinbase地址。
引數
沒有
返回
DATA
,20位元組 - 當前coinbase地址。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":64}'
// Result
{
"id":64,
"jsonrpc": "2.0",
"result": "0x407d73d8a49eeb85d32cf465507dd71d507100c1"
}
eth_mining
true
如果客戶端正在主動挖掘新塊,則返回。
引數
沒有
返回
Boolean
- true
客戶的回報是挖礦,否則false
。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_mining","params":[],"id":71}'
// Result
{
"id":71,
"jsonrpc": "2.0",
"result": true
}
eth_hashrate
返回節點正在挖掘的每秒雜湊數。
引數
沒有
返回
QUANTITY
- 每秒的雜湊數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_hashrate","params":[],"id":71}'
// Result
{
"id":71,
"jsonrpc": "2.0",
"result": "0x38a"
}
eth_gasPrice
返回wei中每個氣體的當前價格。
引數
沒有
返回
QUANTITY
- 當前天然氣價格的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'
// Result
{
"id":73,
"jsonrpc": "2.0",
"result": "0x09184e72a000" // 10000000000000
}
eth_accounts
返回客戶端擁有的地址列表。
引數
沒有
返回
Array of DATA
,20位元組 - 客戶擁有的地址。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": ["0x407d73d8a49eeb85d32cf465507dd71d507100c1"]
}
eth_blockNumber
返回最近的塊的數量。
引數
沒有
返回
QUANTITY
- 客戶端所在的當前塊號的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
// Result
{
"id":83,
"jsonrpc": "2.0",
"result": "0x4b7" // 1207
}
eth_getBalance
返回給定地址的帳戶的餘額。
引數
DATA
,20位元組 - 地址檢查餘額。QUANTITY|TAG
- 整數塊號或字串"latest"
,"earliest"
或者"pending"
,請參閱預設塊引數
params: [
'0x407d73d8a49eeb85d32cf465507dd71d507100c1',
'latest'
]
返回
QUANTITY
- wei中當前餘額的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x0234c8a3397aab58" // 158972490234375000
}
eth_getStorageAt
返回給定地址的儲存位置的值。
引數
DATA
,20位元組 - 儲存地址。QUANTITY
- 儲存位置的整數。QUANTITY|TAG
- 整數塊號或字串"latest"
,"earliest"
或者"pending"
,請參閱預設塊引數
params: [
'0x407d73d8a49eeb85d32cf465507dd71d507100c1',
'0x0', // storage position at 0
'0x2' // state at block number 2
]
返回
DATA
- 這個儲存位置的值。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getStorageAt","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "0x0", "0x2"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x03"
}
eth_getTransactionCount
返回從地址傳送的事務數。
引數
DATA
,20位元組 - 地址。QUANTITY|TAG
- 整數塊號或字串"latest"
,"earliest"
或者"pending"
,請參閱預設塊引數
params: [
'0x407d73d8a49eeb85d32cf465507dd71d507100c1',
'latest' // state at the latest block
]
返回
QUANTITY
- 從這個地址傳送的交易數量的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1","latest"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x1" // 1
}
eth_getBlockTransactionCountByHash
從匹配給定塊雜湊的塊中返回塊中的事務數。
引數
DATA
,32位元組 - 塊的雜湊
params: [
'0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
]
返回
QUANTITY
- 此區塊中的交易數量的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xb" // 11
}
eth_getBlockTransactionCountByNumber
從與給定塊號匹配的塊中返回塊中的事務數。
引數
QUANTITY|TAG
- 塊號的整數,或字串"earliest"
,"latest"
或者"pending"
如預設塊引數中所示。
params: [
'0xe8', // 232
]
返回
QUANTITY
- 此區塊中的交易數量的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0xe8"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xa" // 10
}
eth_getUncleCountByBlockHash
從匹配給定塊雜湊的塊中返回塊中的叔數。
引數
DATA
,32位元組 - 塊的雜湊
params: [
'0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
]
返回
QUANTITY
- 此塊中的叔數的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id"Block:1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x1" // 1
}
eth_getUncleCountByBlockNumber
從與給定塊編號匹配的塊中返回塊中的圈數。
引數
QUANTITY
- 塊號的整數,或字串“最新”,“最早”或“掛起”,請參閱預設塊引數
params: [
'0xe8', // 232
]
返回
QUANTITY
- 此塊中的叔數的整數。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockNumber","params":["0xe8"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x1" // 1
}
eth_getCode
返回給定地址的程式碼。
引數
DATA
,20位元組 - 地址QUANTITY|TAG
- 整數塊號或字串"latest"
,"earliest"
或者"pending"
,請參閱預設塊引數
params: [
'0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
'0x2' // 2
]
返回
DATA
- 來自給定地址的程式碼。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"
}
eth_sign
用給定的地址標記資料。
注意簽名的地址必須解鎖。
引數
DATA
,20位元組 - 地址DATA
,要簽署的資料
返回
DATA
:簽名的資料
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sign","params":["0xd1ade25ccd3d550a7eb532ac759cac7be09c2719", "Schoolbus"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x2ac19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601"
}
eth_sendTransaction
如果資料欄位包含程式碼,則建立新的訊息呼叫事務或建立合同。
引數
Object
- 交易物件from
:DATA
,20位元組 - 交易的傳送地址。to
:DATA
,20位元組 - (建立新合同時可選)交易指向的地址。gas
:QUANTITY
- (可選,預設值:90000)為交易執行提供的天然氣的整數。它會返回未使用的氣體。gasPrice
:QUANTITY
- (可選,預設:待確定)每種付費氣體使用的gasPrice整數value
:QUANTITY
- (可選)傳送的值與此事務的整數data
:DATA
- (可選)合同的編譯程式碼nonce
:QUANTITY
- (可選)一個隨機數的整數。這允許覆蓋使用相同的隨機數的您自己的未決事務。
params: [{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f072445675",
"gas": "0x76c0", // 30400,
"gasPrice": "0x9184e72a000", // 10000000000000
"value": "0x9184e72a", // 2441406250
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]
返回
DATA
,32位元組 - 事務雜湊,或者如果事務不可用,則為零雜湊。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{see above}],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
eth_sendRawTransaction
建立新的訊息呼叫事務或為簽名的事務建立合同。
引數
Object
- 交易物件data
:DATA
,簽署的交易資料。
params: [{
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]
返回
DATA
,32位元組 - 事務雜湊,或者如果事務不可用,則為零雜湊。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":[{see above}],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
eth_call
立即執行新的訊息呼叫,而不在塊鏈上建立事務。
引數
Object
- 事務呼叫物件from
:DATA
,20位元組 - (可選)交易的傳送地址。to
:DATA
,20位元組 - 事務處理的地址。gas
:QUANTITY
- (可選)為交易執行提供的天然氣的整數。eth_call消耗零氣體,但這個引數可能需要一些執行。gasPrice
:QUANTITY
- (可選)用於每個付費氣體的gasPrice的整數value
:QUANTITY
- (可選)傳送的值與此事務的整數data
:DATA
- (可選)合同的編譯程式碼
QUANTITY|TAG
- 整數塊號或字串"latest"
,"earliest"
或者"pending"
,請參閱預設塊引數
返回
DATA
- 執行合同的回報價值。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{see above}],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0x0"
}
eth_estimateGas
撥打電話或交易,這些電話或交易不會被新增到區塊鏈中,並返回可用於估算廢氣的廢氣。
引數
請參閱eth_call引數,期望所有屬性都是可選的。
返回
QUANTITY
- 使用的氣體量。
例
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{see above}],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result"