以太坊使用及代币开发实战
課程介紹
你在學(xué)習(xí)以太坊入門過程中是否遇到過以下問題:
- 不知如何部署安裝 geth 節(jié)點?
- 不知如何進(jìn)行 geth 節(jié)點的命令操作?
- 不知為何公有鏈的數(shù)據(jù)同步、geth 程序問題接連不斷?
- 想調(diào)用 JSON-RPC 接口卻一頭霧水?
- 想發(fā)一套代幣卻不知如何開發(fā)、編寫、發(fā)布,并在網(wǎng)站上查詢到余額和代碼?
- 想用 Java 版本去調(diào)用代幣執(zhí)行操作,卻不知如何下手?
- 想開發(fā)一套基于以太坊的錢包卻不知核心業(yè)務(wù)如何處理,安全如何保障?
- ……
如果你曾遇到一個或多個以上問題,那么本系列課程就是為你量身打造的。本課程的目標(biāo)就是帶大家快速上手實戰(zhàn),綜合命令操作、代碼示例、內(nèi)容詳解、實戰(zhàn)經(jīng)驗等多方位信息呈現(xiàn),以最短的時間達(dá)到最高效的學(xué)習(xí)效果。課程以以太坊為核心,從具體的以太坊節(jié)點部署、真實環(huán)境同步及問題、以太坊節(jié)點 JSON-RPC 接口調(diào)用、Token 發(fā)行及對應(yīng)的 Java JSON-RPC 調(diào)用和開發(fā)數(shù)字貨幣錢包的設(shè)計等。
通過本系列文章可以讓新手快速入門,進(jìn)行相應(yīng)的開發(fā),同時避免一些不必要的資產(chǎn)損失,完成從入門到核心業(yè)務(wù)開發(fā)的蛻變。
專家推薦
本課程非常適合以太坊新手入門,不僅有本地開發(fā)環(huán)境的搭建,還有實踐例子,比如 Token 及錢包開發(fā),更重要的是朱總分享了他自己總結(jié)的實戰(zhàn)經(jīng)驗,避免入坑,值得認(rèn)真學(xué)習(xí)練習(xí)!
——HiBlock 區(qū)塊鏈社區(qū)發(fā)起人 BoB Jiang
作者介紹
朱智勝,曾長期從事三方支付行業(yè),擔(dān)任事業(yè)部技術(shù)負(fù)責(zé)人。后就職于火幣網(wǎng),擔(dān)任資深研發(fā)工程師。目前擔(dān)任創(chuàng)業(yè)公司 CTO,精于區(qū)塊鏈技術(shù)相關(guān)技術(shù)研究,擁有數(shù)字火幣錢包、交易所開發(fā)和區(qū)塊鏈底層代碼研究經(jīng)驗。
課程內(nèi)容
第01課:以太坊節(jié)點部署及基本命令操作
區(qū)塊鏈誕生自中本聰?shù)谋忍貛?#xff0c;自 2009 年以來,出現(xiàn)了各種各樣的類比特幣的基于公有區(qū)塊鏈的數(shù)字貨幣,目前各個國家及企業(yè)機(jī)構(gòu)都對區(qū)塊鏈投入巨大的財力和人力來對區(qū)塊鏈技術(shù)進(jìn)行研究。
區(qū)塊鏈簡介
這里引用工信部指導(dǎo)發(fā)布的《中國區(qū)塊鏈技術(shù)和應(yīng)用發(fā)展白皮書 2016》中的解釋:
廣義來講,區(qū)塊鏈技術(shù)是利用塊鏈?zhǔn)綌?shù)據(jù)結(jié)構(gòu)來驗證與存儲數(shù)據(jù)、利用分布式節(jié)點共識算法來生成和更新數(shù)據(jù)、利用密碼學(xué)的方式保證數(shù)據(jù)傳輸和訪問的安全、利用由自動化腳本代碼組成的智能合約來編程和操作數(shù)據(jù)的一種全新的分布式基礎(chǔ)架構(gòu)與計算范式。
簡單來說,區(qū)塊鏈就是一個去中心化的分布式賬本數(shù)據(jù)庫,而大家耳熟能詳?shù)谋忍貛?、以太幣等就是這個分布式賬本上流通的數(shù)字貨幣。
第一代的比特幣引爆了區(qū)塊鏈技術(shù),但它能做的事情很少;而以以太坊為代表的第二代區(qū)塊鏈技術(shù),引入了圖靈完備的機(jī)制,它是一個平臺和一種編程語言。在以太坊上面可以進(jìn)行編程操作,比如發(fā)布智能合約、發(fā)布屬于自己的代幣,進(jìn)而衍生出各類應(yīng)用。
本系列課程目標(biāo)
本系列課程的目標(biāo)是快速帶領(lǐng)大家進(jìn)入以太坊的世界,通過私有節(jié)點的部署、公鏈的同步、以太坊的基本命令操作、JSON-RPC 接口的調(diào)用、代幣的快速開發(fā)及發(fā)布、如何在 Etherscan 上對代幣進(jìn)行操作、代幣的 Java 調(diào)用、以太坊的數(shù)字貨幣錢包開發(fā)等。
通過本系列課程的學(xué)習(xí),可以達(dá)到從入門到對以太坊的功能及周邊知識有一個系統(tǒng)的了解。如果有一定的編程基礎(chǔ)可以快速開發(fā)出自己的一套代幣,并通過 JSON-RPC 調(diào)用這套代幣;另一方面,也可以開發(fā)出一套簡單的以太坊數(shù)字貨幣錢包。
本節(jié)課程簡介
無論是學(xué)習(xí)以太坊技術(shù),還是搭建自己的以太坊服務(wù)器或部署相關(guān)智能合約都需要了解以太坊節(jié)點的部署步驟。本篇文章的內(nèi)容是將帶領(lǐng)大家學(xué)習(xí)一下如何安裝部署以太坊的 Geth 節(jié)點。
以太坊的錢包
以太坊的錢包有不少,比如 Geth、Ethereum Wallet、Parity 等,還有一些輕量級的 App 錢包,如 imtoken 等。前面一類錢包是需要同步節(jié)點數(shù)據(jù),而后面的 App 則有相應(yīng)的平臺將數(shù)據(jù)同步完成。
而作為開發(fā)者或?qū)W習(xí)者必定要選擇前面一類錢包,而像 Ethereum Wallet 有友好的用戶界面,針對炒幣人員或存儲以太幣或簡單轉(zhuǎn)賬可進(jìn)行使用;而對于開發(fā)人員來說還是需要官方的專業(yè)錢包——Geth。
如果是在 Linux 系統(tǒng)下啟動 Ethereum Wallet 錢包,通過 ps 命令會看到,其實它內(nèi)置了 Geth 錢包程序,只是在外面用 JavaScript 封裝了一層可視化操作界面。
實戰(zhàn)經(jīng)驗
如果是建立交易平臺或提供外部服務(wù)器或者學(xué)習(xí)相關(guān)技術(shù)(更好的了解底層)一定要選擇 Geth 錢包進(jìn)行部署,這也是官方指定版本。
Geth 下載 & 安裝
下載
以太坊的官網(wǎng)地址詳見這里,官網(wǎng)會自動識別當(dāng)前系統(tǒng),在首頁提供對應(yīng)操作系統(tǒng)的下載鏈接;也可直接訪問 Geth 下載專區(qū)進(jìn)行下載,由于官網(wǎng)的下載經(jīng)常抽風(fēng),可通過此鏡像下載。 在官網(wǎng)的頁面會看到 4 種類型的程序,分別支持 Win、Mac、Linux 和源碼安裝,根據(jù)自己的系統(tǒng)選擇對應(yīng)的安裝程序。
安裝
安裝步驟沒有過多可介紹的,直接執(zhí)行對應(yīng)的程序即可安裝。如果采用源代碼安裝需先搭建 Go 編程語言環(huán)境,同時需要一定的 Go 語言基礎(chǔ),然后參考 GitHub 上的安裝步驟安裝即可。此非本節(jié)重點內(nèi)容這里就不再贅述了。
無論在什么操作系統(tǒng)下安裝完成,我們能夠找的可執(zhí)行的程序是 Geth。下面介紹本節(jié)課的重點,即基于 Geth 的啟動和參數(shù)說明。
下面以 Windows 操作系統(tǒng)為例,安裝過程中的每一步操作如下:
Geth 程序啟動
如果大家比較著急,可以直接執(zhí)行 Geth 程序。在 Windows 下通過 cmd 命令進(jìn)入命令窗口,定位到 geth.exe 所在目錄,然后執(zhí)行即可啟動。Mac 和 Linux 環(huán)境按照 Linux 操作,通過 cd 命令進(jìn)入 geth 所在目錄,執(zhí)行 ./geth 即可啟動程序,后面的內(nèi)容操作不同的系統(tǒng)對應(yīng)不同的操作方式,我們不再進(jìn)行每個系統(tǒng)的區(qū)分,統(tǒng)一按照 Linux 系統(tǒng)來操作,畢竟最終還是要部署到 Linux 操作系統(tǒng)上的。
當(dāng)然,如果你有一定的耐心,那么還是等一下,了解相關(guān)的參數(shù)即配置項之后再啟動程序。
核心命令和參數(shù)
我們可以通過 help 命令來先了解查看一下基本使用參數(shù)情況:
>./geth -hNAME: geth - the go-ethereum command line interface Copyright 2013-2017 The go-ethereum AuthorsUSAGE: geth [options] command [command options] [arguments...]VERSION: 1.7.3-stable-4bb3c89dCOMMANDS: account Manage accounts attach Start an interactive JavaScript environment (connect to node) bug opens a window to report a bug on the geth repo console Start an interactive JavaScript environment copydb Create a local chain from a target chaindata folder dump Dump a specific block from storage dumpconfig Show configuration values export Export blockchain into file import Import a blockchain file init Bootstrap and initialize a new genesis block js Execute the specified JavaScript files license Display license information makecache Generate ethash verification cache (for testing) makedag Generate ethash mining DAG (for testing) monitor Monitor and visualize node metrics removedb Remove blockchain and state databases version Print version numbers wallet Manage Ethereum presale wallets help, h Shows a list of commands or help for one commandETHEREUM OPTIONS: --config value TOML configuration file --datadir "/Users/zzs/Library/Ethereum" Data directory for the databases and keystore --keystore Directory for the keystore (default = inside the datadir) --nousb Disables monitoring for and managing USB hardware wallets --networkid value Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby) (default: 1) --testnet Ropsten network: pre-configured proof-of-work test network --rinkeby Rinkeby network: pre-configured proof-of-authority test network --syncmode "fast" Blockchain sync mode ("fast", "full", or "light") --ethstats value Reporting URL of a ethstats service (nodename:secret@host:port) --identity value Custom node name --lightserv value Maximum percentage of time allowed for serving LES requests (0-90) (default: 0) --lightpeers value Maximum number of LES client peers (default: 20) --lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strengthDEVELOPER CHAIN OPTIONS: --dev Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled --dev.period value Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)ETHASH OPTIONS: --ethash.cachedir Directory to store the ethash verification caches (default = inside the datadir) --ethash.cachesinmem value Number of recent ethash caches to keep in memory (16MB each) (default: 2) --ethash.cachesondisk value Number of recent ethash caches to keep on disk (16MB each) (default: 3) --ethash.dagdir "/Users/zzs/.ethash" Directory to store the ethash mining DAGs (default = inside home folder) --ethash.dagsinmem value Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1) --ethash.dagsondisk value Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2)TRANSACTION POOL OPTIONS: --txpool.nolocals Disables price exemptions for locally submitted transactions --txpool.journal value Disk journal for local transaction to survive node restarts (default: "transactions.rlp") --txpool.rejournal value Time interval to regenerate the local transaction journal (default: 1h0m0s) --txpool.pricelimit value Minimum gas price limit to enforce for acceptance into the pool (default: 1) --txpool.pricebump value Price bump percentage to replace an already existing transaction (default: 10) --txpool.accountslots value Minimum number of executable transaction slots guaranteed per account (default: 16) --txpool.globalslots value Maximum number of executable transaction slots for all accounts (default: 4096) --txpool.accountqueue value Maximum number of non-executable transaction slots permitted per account (default: 64) --txpool.globalqueue value Maximum number of non-executable transaction slots for all accounts (default: 1024) --txpool.lifetime value Maximum amount of time non-executable transaction are queued (default: 3h0m0s)PERFORMANCE TUNING OPTIONS: --cache value Megabytes of memory allocated to internal caching (min 16MB / database forced) (default: 128) --trie-cache-gens value Number of trie node generations to keep in memory (default: 120)ACCOUNT OPTIONS: --unlock value Comma separated list of accounts to unlock --password value Password file to use for non-interactive password inputAPI AND CONSOLE OPTIONS: --rpc Enable the HTTP-RPC server --rpcaddr value HTTP-RPC server listening interface (default: "localhost") --rpcport value HTTP-RPC server listening port (default: 8545) --rpcapi value API's offered over the HTTP-RPC interface --ws Enable the WS-RPC server --wsaddr value WS-RPC server listening interface (default: "localhost") --wsport value WS-RPC server listening port (default: 8546) --wsapi value API's offered over the WS-RPC interface --wsorigins value Origins from which to accept websockets requests --ipcdisable Disable the IPC-RPC server --ipcpath Filename for IPC socket/pipe within the datadir (explicit paths escape it) --rpccorsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --jspath loadScript JavaScript root path for loadScript (default: ".") --exec value Execute JavaScript statement --preload value Comma separated list of JavaScript files to preload into the consoleNETWORKING OPTIONS: --bootnodes value Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers) --bootnodesv4 value Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes) --bootnodesv5 value Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes) --port value Network listening port (default: 30303) --maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 25) --maxpendpeers value Maximum number of pending connection attempts (defaults used if set to 0) (default: 0) --nat value NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any") --nodiscover Disables the peer discovery mechanism (manual peer addition) --v5disc Enables the experimental RLPx V5 (Topic Discovery) mechanism --netrestrict value Restricts network communication to the given IP networks (CIDR masks) --nodekey value P2P node key file --nodekeyhex value P2P node key as hex (for testing)MINER OPTIONS: --mine Enable mining --minerthreads value Number of CPU threads to use for mining (default: 8) --etherbase value Public address for block mining rewards (default = first account created) (default: "0") --targetgaslimit value Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388) --gasprice "18000000000" Minimal gas price to accept for mining a transactions --extradata value Block extra data set by the miner (default = client version)GAS PRICE ORACLE OPTIONS: --gpoblocks value Number of recent blocks to check for gas prices (default: 10) --gpopercentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 50)VIRTUAL MACHINE OPTIONS: --vmdebug Record information useful for VM and contract debuggingLOGGING AND DEBUGGING OPTIONS: --metrics Enable metrics collection and reporting --fakepow Disables proof-of-work verification --nocompaction Disables db compaction after import --verbosity value Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3) --vmodule value Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4) --backtrace value Request a stack trace at a specific logging statement (e.g. "block.go:271") --debug Prepends log messages with call-site location (file and line number) --pprof Enable the pprof HTTP server --pprofaddr value pprof HTTP server listening interface (default: "127.0.0.1") --pprofport value pprof HTTP server listening port (default: 6060) --memprofilerate value Turn on memory profiling with the given rate (default: 524288) --blockprofilerate value Turn on block profiling with the given rate (default: 0) --cpuprofile value Write CPU profile to the given file --trace value Write execution trace to the given fileWHISPER (EXPERIMENTAL) OPTIONS: --shh Enable Whisper --shh.maxmessagesize value Max message size accepted (default: 1048576) --shh.pow value Minimum POW accepted (default: 0.2)DEPRECATED OPTIONS: --fast Enable fast syncing through state downloads --light Enable light client modeMISC OPTIONS: --help, -h show helpCOPYRIGHT: Copyright 2013-2017 The go-ethereum Authors參數(shù)和操作何其多啊,不過,不用擔(dān)心也不要害怕,掌握其中幾個重要的參數(shù)即可成功的部署啟動 Geth 節(jié)點,通過 help 命令可以方便的獲得相關(guān)的命令和參數(shù)。
當(dāng)我們直接執(zhí)行 Geth 命令時,程序會按照默認(rèn)參數(shù)進(jìn)行啟動,所謂默認(rèn)參數(shù)就是上面我們 help 查看到的,說明中有 default 項的參數(shù)值,默認(rèn)參數(shù)值并不能很好的滿足我們的需求。
數(shù)據(jù)目錄
datadir 參數(shù),指定 Geth 區(qū)塊數(shù)據(jù)及私鑰存儲目錄,如果未指定 Windows 系統(tǒng)將在 C 盤下存儲,Linux 系統(tǒng)將在用戶對應(yīng)的 home 目錄下存儲。此時,啟動命令為:
>./geth --datadir /Users/zzs/develop/eth/geth/data-test上面就將所有的數(shù)據(jù)存儲在了 data-test 目錄下。
實戰(zhàn)經(jīng)驗
啟動時一定要指定一個足夠大硬盤的路徑,不建議使用默認(rèn)路徑,此路徑在后面使用的過程中會頻繁用到,如果私鑰文件沒有單獨存儲,那么也將存儲在此目錄下。
開啟 JSON-RPC
單獨啟動程序是無法進(jìn)行 JSON-RPC 與之交互的。因此,Geth 提供了以下兩個參數(shù):
--rpc --rpcapi "db,eth,net,web3,miner,personal"- 第一個參數(shù) rpc 是告訴節(jié)點開啟 JSON-RPC 服務(wù);
- 第二個參數(shù)指定 rpc 服務(wù)支持哪些角色的 rpc 來操作。
其中,第二個參數(shù)的區(qū)別及支持哪些操作命令內(nèi)容比較多,在后面的章節(jié)中我們會對此參數(shù)的內(nèi)容進(jìn)行詳細(xì)的示例講解,這里先不著急。
此時,啟動 Geth 的命令已經(jīng)變成如下:
>./geth --datadir /Users/zzs/develop/eth/geth/data-test --rpc --rpcapi "db,eth,net,web3,miner,personal"實戰(zhàn)經(jīng)驗
在真實生產(chǎn)環(huán)境中 rpcapi 的 personal、admin 等級別較高的操作權(quán)限慎重開啟,一旦使用不當(dāng)會導(dǎo)致系統(tǒng)安全問題。
ipcpath 和 attach
此參數(shù)指定 ipc 臨時文件的路徑,默認(rèn)在 datadir 指定的目錄之下,當(dāng)節(jié)點啟動會生成一個名字為 geth.ipc 的文件,當(dāng)程序關(guān)閉時此文件隨之消失。
可配合 attach 命令來進(jìn)入與 geth 節(jié)點進(jìn)行 js 交互的窗口?;久钊缦?#xff1a;
>./geth attach rpc:/Users/zzs/develop/eth/geth/data-test/geth.ipc以上操作為 Linux 操作,如果 Windows 操作系統(tǒng)未修改 datadir 路徑可直接執(zhí)行 attach 命令,無需添加后面的路徑信息。
實戰(zhàn)經(jīng)驗
真實環(huán)境中我們一般采用后臺進(jìn)程的形式來啟動 Geth,Linux 下為在啟動參數(shù)后面添加 & 符號來啟動。此時如果我們想通過命令行來進(jìn)行交互,即可使用此命令來進(jìn)入交互窗口。
console
通過此命令可以直接啟動 Geth 并進(jìn)入交互窗口,使用示例:
>./geth --datadir /Users/zzs/develop/eth/geth/data-test --rpc --rpcapi "db,eth,net,web3,miner,personal" console和 attach 的效果一樣,但不建議直接使用 console 進(jìn)入,否則,一旦退出程序 Geth 節(jié)點也隨之關(guān)閉了,建議使用 attach 模式。
數(shù)據(jù)存儲目錄結(jié)構(gòu)
通過上面的參數(shù)調(diào)整我們已經(jīng)能夠正常啟動一個公有鏈的 Geth 程序了,關(guān)于公有鏈同步會遇到的問題我們將在下一章節(jié)進(jìn)行詳細(xì)介紹。先來看一下指定的 datadir 目錄下都有什么。
datadir 目錄下有兩個子目錄,分別為 geth 和 keystore,其中 geth 目錄下存儲了區(qū)塊鏈同步下來的數(shù)據(jù)和節(jié)點(node)相關(guān)個數(shù)據(jù)。而 keystore 目錄下將存儲經(jīng)過加密的私鑰文件,不過現(xiàn)在還未生成地址,此目錄暫時為空。文件名類似如下格式:
UTC--2018-02-22T08-21-53.763257000Z--c180962e3f348c71bc6aab30552da9e514429ca1實戰(zhàn)經(jīng)驗
keystore 目錄下的文件一定要慎重保管,一旦丟失將永遠(yuǎn)丟失對應(yīng)地址上的資產(chǎn),它們和創(chuàng)建賬戶時設(shè)置的密碼一一匹配。同時,也要確保此文件放置在公網(wǎng)中,導(dǎo)致賬號資產(chǎn)被盜。
基本操作命令
基本操作命令官方文檔中已經(jīng)有相應(yīng)的說明,這里就簡單舉例介紹一下相關(guān)的操作,以下命令都需要先進(jìn)入控制臺操作窗口。
(1)創(chuàng)建賬戶
查看此節(jié)點下的所有賬戶:
eth.accounts(2)查看塊高
eth.blockNumber(3)創(chuàng)建賬戶
注意:創(chuàng)建賬戶需要用 pesonal 角色,其中參數(shù)為密碼:
#方式一:>personal.newAccount("111111")"0xbe2f1213da9807e9d64e8ae607be1c86bd53c210"#方式二:> personal.newAccount()Passphrase:Repeat passphrase:"0xbe2f1213da9807e9d64e8ae607be1c86bd53c210"此處建議使用不添加參數(shù)的創(chuàng)建模式,這樣就不會明文暴露密碼信息。當(dāng)創(chuàng)建賬戶完成之后,再進(jìn)入 keystore 目錄下就可以看到創(chuàng)建賬戶對應(yīng)的加密私鑰文件了。
(4)查看賬戶余額
其中參數(shù)為區(qū)塊鏈地址:
eth.getBalance("0xbe2f1213da9807e9d64e8ae607be1c86bd53c210")(5)轉(zhuǎn)賬
比如從賬戶 0x7d1f7be4112ce63b9de04a0bf95c1e87e430bd1b 轉(zhuǎn)賬 1 個以太幣到 0x587e57a516730381958f86703b1f8e970ff445d9。
eth.sendTransaction({from:"0x7d1f7be4112ce63b9de04a0bf95c1e87e430bd1b",to:"0x587e57a516730381958f86703b1f8e970ff445d9",value:web3.toWei(1,"ether")})當(dāng)直接執(zhí)行此方法時會拋出異常:
account is locked at web3.js:3119:20 at web3.js:6023:15 at web3.js:4995:36 at <anonymous>:1:1此異常說明需要執(zhí)行賬戶解鎖操作。
(6)解鎖轉(zhuǎn)出賬戶
其中第一個參數(shù)為轉(zhuǎn)出賬戶,第二個參數(shù)為密碼,也可以直接填寫第一個參數(shù),然后通過命令行提示再輸入密碼。
personal.unlockAccount("0x7d1f7be4112ce63b9de04a0bf95c1e87e430bd1b","111111")解鎖之后即可進(jìn)行轉(zhuǎn)賬操作。
實戰(zhàn)經(jīng)驗
需要注意的是默認(rèn)解鎖時間為 300 秒,可設(shè)置解鎖時間防止被盜。
(1)啟動挖礦
miner.start()(2)停止挖礦
miner.stop()當(dāng)在執(zhí)行挖礦時日志會不停刷屏,不用管,只要命令輸入全,執(zhí)行即可停止挖礦。
實戰(zhàn)經(jīng)驗
關(guān)于上面的命令操作,在使用中有一個小技巧,比如在交互窗口想查看 eth 都有什么操作命令,可輸入 eth.,然后連著敲擊兩下 tab 鍵接口展示此角色的所有操作命令,比如:
>eth.#敲擊兩下tabeth._requestManager eth.defaultAccount eth.getBlockNumber eth.getMining eth.getTransactionCount eth.isSyncing eth.sendTransactioneth.accounts eth.defaultBlock eth.getBlockTransactionCount eth.getPendingTransactions eth.getTransactionFromBlock eth.mining eth.signeth.blockNumber eth.estimateGas eth.getBlockUncleCount eth.getProtocolVersion eth.getTransactionReceipt eth.namereg eth.signTransactioneth.call eth.filter eth.getCode eth.getRawTransaction eth.getUncle eth.pendingTransactions eth.submitTransactioneth.coinbase eth.gasPrice eth.getCoinbase eth.getRawTransactionFromBlock eth.getWork eth.protocolVersion eth.submitWorketh.compile eth.getAccounts eth.getCompilers eth.getStorageAt eth.hashrate eth.resend eth.syncingeth.constructor eth.getBalance eth.getGasPrice eth.getSyncing eth.iban eth.sendIBANTransactioneth.contract eth.getBlock eth.getHashrate eth.getTransaction eth.icapNamereg eth.sendRawTransaction致謝及提要
感謝大家學(xué)習(xí)此篇內(nèi)容,由于篇幅有限就先介紹到這里,在后面的章節(jié)中會為大家分享更多實戰(zhàn)經(jīng)驗。
第02課:以太坊私鏈搭建 & 公鏈同步
第03課:以太坊常見 JSON-RPC 接口解析
第04課:以太坊常見 JSON-RPC Java 調(diào)用實例
第05課:ERC-20 Token 標(biāo)準(zhǔn)詳解及代碼
第06課:Token 的發(fā)布及操作
第07課:Token 的 Java 調(diào)用
第08課:開發(fā)以太坊錢包的基本思路與安全
閱讀全文: http://gitbook.cn/gitchat/column/5ad98d9479e8c577efc7557d
總結(jié)
以上是生活随笔為你收集整理的以太坊使用及代币开发实战的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。