在MAC環(huán)境下之以太坊(ethereum)開發(fā)環(huán)境安裝

先訪問(wèn)github上go語(yǔ)言開發(fā)客戶端網(wǎng)址:

https://github.com/ethereum/go-ethereum

安裝ethereum

https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum

在MAC上安裝

brew tap ethereum/ethereum

brew install ethereum

dogiant@bogon:/usr/local$brew tap ethereum/ethereum
Updating Homebrew... ==>Tapping ethereum/ethereum
Cloning into '/usr/local/Homebrew/Library/Taps/ethereum/homebrew-ethereum'...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 1), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
Checking connectivity... done.
Tapped 3 formulae (31 files, 33.9K) dogiant@bogon:/usr/local$brew install ethereum ==>Installing ethereum from ethereum/ethereum ==>Installing dependencies for ethereum/ethereum/ethereum:****go ==>Installing ethereum/ethereum/ethereum dependency:****go ==>Downloadinghttps://homebrew.bintray.com/bottles/go-1.7.4_1.el_capitan.bottle.tar.gz
######################################################################## 100.0% ==>Pouring go-1.7.4_1.el_capitan.bottle.tar.gz ==>Caveats
As of go 1.2, a valid GOPATH is required to use the go get command:
https://golang.org/doc/code.html#GOPATH

You may wish to add the GOROOT-based install location to your PATH:
export PATH=$PATH:/usr/local/opt/go/libexec/bin ==>Summary
?? /usr/local/Cellar/go/1.7.4_1: 6,438 files, 250.7M ==>Installing****ethereum/ethereum/ethereum ==>Cloninghttps://github.com/ethereum/go-ethereum.git
Cloning into '/Users/dogiant/Library/Caches/Homebrew/ethereum--git'...
remote: Counting objects: 2737, done.
remote: Compressing objects: 100% (2066/2066), done.
remote: Total 2737 (delta 963), reused 1654 (delta 553), pack-reused 0
Receiving objects: 100% (2737/2737), 14.91 MiB | 112.00 KiB/s, done.
Resolving deltas: 100% (963/963), done.
Checking connectivity... done.
Note: checking out 'ff07d54843ea7ed9997c420d216b4c007f9c80c3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b <new-branch-name>

Checking out files: 100% (2487/2487), done. ==>Checking out tag v1.5.5 ==>go env ==>make all ==>Caveats
To have launchd start ethereum/ethereum/ethereum now and restart at login:
brew services start ethereum/ethereum/ethereum ==>Summary
?? /usr/local/Cellar/ethereum/1.5.5: 9 files, 47.7M, built in 5 minutes 30 seconds

安裝完畢后

geth -h

列出當(dāng)前的用戶

geth account list

顯示空

dogiant@bogon:~/ethereum/workspace$geth --datadir "~/ethdev" --dev
I1228 15:16:46.907316 cmd/utils/flags.go:615] WARNING: No etherbase set and no accounts found as default
I1228 15:16:46.907493 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /Users/dogiant/ethdev/geth/chaindata
I1228 15:16:46.911765 ethdb/database.go:176] closed db:/Users/dogiant/ethdev/geth/chaindata
I1228 15:16:46.912892 node/node.go:176] instance: Geth/v1.5.5-stable-ff07d548/darwin/go1.7.4
I1228 15:16:46.912925 ethdb/database.go:83] Allotted 128MB cache and 1024 file handles to /Users/dogiant/ethdev/geth/chaindata
I1228 15:16:46.935109 eth/backend.go:280] Successfully wrote custom genesis block: e5be92145a301820111f91866566e3e99ee344d155569e4556a39bc71238f3bc
I1228 15:16:46.935127 eth/backend.go:299] ethash used in test mode
I1228 15:16:46.935536 eth/db_upgrade.go:346] upgrading db log bloom bins
I1228 15:16:46.935580 eth/db_upgrade.go:354] upgrade completed in 48.143μs
I1228 15:16:46.935601 eth/backend.go:191] Protocol Versions: [63 62], Network Id: 1
I1228 15:16:46.935744 eth/backend.go:219] Chain config: {ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000}
I1228 15:16:46.935983 core/blockchain.go:219] Last header: #0 [e5be9214…] TD=131072
I1228 15:16:46.935998 core/blockchain.go:220] Last block: #0 [e5be9214…] TD=131072
I1228 15:16:46.936007 core/blockchain.go:221] Fast block: #0 [e5be9214…] TD=131072
I1228 15:16:46.936626 p2p/server.go:342] Starting Server
I1228 15:16:49.127910 p2p/discover/udp.go:227] Listening, enode://05399f51a43805c17f82e5016d5969d14b3092018cae87eec77ed52291d66c50c7d7bf024d953b0afcccd44c717f17aaf251b897d770054205ea268b49a3050b@10.0.37.126:58049
I1228 15:16:49.128111 whisper/whisperv2/whisper.go:176] Whisper started
I1228 15:16:49.128115 p2p/server.go:610] Listening on [::]:55739
I1228 15:16:49.129641 node/node.go:341] IPC endpoint opened: /Users/dogiant/ethdev/geth.ipc

dogiant@dubiaoqideMBP:~$geth --dev console 2>> file_to_log_output
Welcome to the Geth JavaScript console!

instance: Geth/v1.5.5-stable-ff07d548/darwin/go1.7.4
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 shh:1.0 txpool:1.0 web3:1.0

eth.accounts
[]
personal.newAccount('123456') "0x556d64ecb09b5df590a2ab842b53a8041e3961b4" > eth.accounts
["0x556d64ecb09b5df590a2ab842b53a8041e3961b4"]
eth.accounts
["0x556d64ecb09b5df590a2ab842b53a8041e3961b4"]
personal.newAccount('123456') "0xb0945a303834ff763695e21ed8acbe80aefee9bb" > eth.accounts
["0x556d64ecb09b5df590a2ab842b53a8041e3961b4","0xb0945a303834ff763695e21ed8acbe80aefee9bb"]

dogiant@dubiaoqideMBP:~$geth --dev account list
Account #0: {556d64ecb09b5df590a2ab842b53a8041e3961b4} /var/folders/jy/q2f6pdjn6p11ytfx0xk8yp7m0000gn/T/ethereum_dev_mode/keystore/UTC--2016-12-28T07-20-52.337017793Z--556d64ecb09b5df590a2ab842b53a8041e3961b4
Account #1: {b0945a303834ff763695e21ed8acbe80aefee9bb} /var/folders/jy/q2f6pdjn6p11ytfx0xk8yp7m0000gn/T/ethereum_dev_mode/keystore/UTC--2016-12-28T07-25-51.683157537Z—b0945a303834ff763695e21ed8acbe80aefee9bb


user1 = eth.accounts[0] "0x556d64ecb09b5df590a2ab842b53a8041e3961b4" > user2 = eth.accounts[1] "0xb0945a303834ff763695e21ed8acbe80aefee9bb" > user1 "0x556d64ecb09b5df590a2ab842b53a8041e3961b4" > user2 "0xb0945a303834ff763695e21ed8acbe80aefee9bb" > eth.getBalance(user1) 0 > eth.getBalance(user2) 0 > eth.blockNumber 0 > miner.start()
true
eth.getBalance(user1) 390000000000000000000

eth.getBalance(user2) 0 > miner.stop()
true
eth.blockNumber 99 > eth.getBalance(user1) 495000000000000000000 > eth.getBalance(user2) 0 > eth.sendTransaction({from:user1,to:user2,value:web3.toWei(3,"ether")}) Error: account is locked at web3.js:3119:20 at web3.js:6023:15 at web3.js:4995:36 at <anonymous>:1:1

personal.unlockAccount("0x556d64ecb09b5df590a2ab842b53a8041e3961b4","123456")

true

eth.sendTransaction({from:user1,to:user2,value:web3.toWei(3,"ether")}) "0x39d604a1df899f6c80ce33279abe88aec28b6d97f83e2dda5f062dd3c099fcf3" > eth.getBalance(user2) 0 > miner.start()
true
miner.stop()
true
eth.getBalance(user2) 3000000000000000000 >

問(wèn)題1:一開始用get account list總是看不到新建的用戶终蒂,后來(lái)考慮是開發(fā)控制臺(tái)創(chuàng)建的用戶要跟開發(fā)一致 加了 —dev后看到正常顯示賬號(hào)

看日志以太幣轉(zhuǎn)賬掉缺,轉(zhuǎn)賬后需要挖礦確認(rèn)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末恩沽,一起剝皮案震驚了整個(gè)濱河市掀抹,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,036評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件堵腹,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡星澳,警方通過(guò)查閱死者的電腦和手機(jī)秸滴,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,046評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)募判,“玉大人,你說(shuō)我怎么就攤上這事咒唆〗斓妫” “怎么了?”我有些...
    開封第一講書人閱讀 164,411評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵全释,是天一觀的道長(zhǎng)装处。 經(jīng)常有香客問(wèn)我,道長(zhǎng)浸船,這世上最難降的妖魔是什么妄迁? 我笑而不...
    開封第一講書人閱讀 58,622評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮李命,結(jié)果婚禮上登淘,老公的妹妹穿的比我還像新娘。我一直安慰自己封字,他們只是感情好黔州,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,661評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著阔籽,像睡著了一般流妻。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上笆制,一...
    開封第一講書人閱讀 51,521評(píng)論 1 304
  • 那天绅这,我揣著相機(jī)與錄音,去河邊找鬼在辆。 笑死证薇,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的开缎。 我是一名探鬼主播棕叫,決...
    沈念sama閱讀 40,288評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼奕删!你這毒婦竟也來(lái)了俺泣?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,200評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎伏钠,沒(méi)想到半個(gè)月后横漏,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,644評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡熟掂,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,837評(píng)論 3 336
  • 正文 我和宋清朗相戀三年缎浇,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片赴肚。...
    茶點(diǎn)故事閱讀 39,953評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡素跺,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出誉券,到底是詐尸還是另有隱情指厌,我是刑警寧澤,帶...
    沈念sama閱讀 35,673評(píng)論 5 346
  • 正文 年R本政府宣布踊跟,位于F島的核電站踩验,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏商玫。R本人自食惡果不足惜箕憾,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,281評(píng)論 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望拳昌。 院中可真熱鬧袭异,春花似錦、人聲如沸炬藤。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,889評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)刻像。三九已至畅买,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間细睡,已是汗流浹背谷羞。 一陣腳步聲響...
    開封第一講書人閱讀 33,011評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留溜徙,地道東北人湃缎。 一個(gè)月前我還...
    沈念sama閱讀 48,119評(píng)論 3 370
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像蠢壹,于是被迫代替她去往敵國(guó)和親嗓违。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,901評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容