~$ mkdir node1
~$ cd node1
~/node1$ touch private.json
config.chainid:用來宣告以太坊網路編號,選擇乙個大於10的數字即可。,
"difficulty": "200"
, "gaslimit": "2100000"
, "alloc": ,
"f41c74c9ae680c1aa78f42e5647a62f353b7bdde":
}}
difficulty:用來宣告挖礦難度,越小的值難度越低,也就能更快速地出塊。
~/node1$ geth --datadir ./data init private
.json
~/node1$ ls
data private.json
~/node1$ touch init.sh
~node1$ chmod +x init.sh
#!/bin/bash
geth --datadir ./data init private.json
~/node1$ ./init.sh
~/node1$
geth--
rpc-
-datadir
./data--
networkid
7878
console
~/node1$ touch console.sh
~/node1$ chmod +x console.sh
rpccorsdomain:用於解決web3從瀏覽器中跨域呼叫的安全限制問題。#!/bin/bash
geth --rpc \
--rpcaddr 0.0.0.0 \
--rpccorsdomain "*" \
--datadir ./data \
--networkid 7878 \
console
以後啟動節點,只要直接執行這個指令碼即可:
~/node1$ ./console.sh
> eth.accounts
> personal.newaccount('78787878')
0xd8bcf1324d566cbec5d3b67e6e14485b06a41d49
> eth.getbalance(eth.accounts[0])
0
> eth.getbalance('0xd8bcf1324d566cbec5d3b67e6e14485b06a41d49')
0
> miner.start(1)
> eth.getbalance(eth.accounts[0])
2.695e+21
> miner.stop()
> eth.unlockaccount(eth.accounts[0],'78787878')
true
四、構建示例專案
即可。
即可。
}
以太坊Dapp開發
名詞 區塊鏈可以分為 公有鏈 聯盟鏈和私有鏈。聯盟鏈 本質仍然是一種私有鏈,只不過它要比小組織開發的私有鏈更大,但是卻沒有公有鏈這麼大的規模,可以理解為它是介於公有鏈和私有鏈的一種區塊鏈。聯盟鏈的特點 聯盟鏈專案 fabric 介紹 fabric 是乙個面向企業應用的區塊鏈框架。以太坊主要是公有鏈,...
以太坊DApp開發環境搭建 Ubuntu平台
以太坊去中心化電商應用開發實戰 在終端中執行以下命令,確定是32位架構還是64位架構 uname p x86 64如果你看到輸出x86 64,那麼就是64位系統,否則是32位。wget v gnu wget 1.17 1 built on linux gnu 如果還沒有安裝wget,使用apt ge...
以太坊DApp開發入門1 開發環境搭建
開發之前要先搞清楚各種概念 以太坊 www.ethereum.org 是乙個區塊鏈系統,相對於位元幣網路系統的純貨幣功能,以太坊區塊鏈增加了智慧型合約,大大拓寬了其應用領域 以太幣 ether,一種類似於位元幣的電子貨幣,以太坊區塊鏈系統上的所有操作都需要消耗以太幣 智慧型合約 smart cont...