Blockchain

First Post:

Last Update:

Word Count:
188

Read Time:
1 min

Blockchain

Basic Env

remix ide:

http://remix.ethereum.org/

Or install on local

1
2
sudo apt-get install nodejs
sudo npm install remix-ide -g

Dounload geth ethereum client: https://geth.ethereum.org/downloads/

Run geth to sttart a RPC test env:

1
./geth --networkid 123 --dev --datadir data1 --rpc --rpcapi "db,eth,net,web3,miner,personal,debug" --rpcaddr 0.0.0.0 --rpcport 8545 console

Enter geth console

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
> personal.newAccount() # create a new account

> personal.newAccount() # create a new account again

> eth.accounts # show users list

> eth.getBalance(eth.accounts[0]) # The default account's banlance is infinite

1.15792089237316195423570985008687907853269984665640564039437587945047129639927e+77

>user0=eth.accounts[0] // Set user0 = accounts[0]

"0x36225609210808cc4693d9b819d9648585202d63"

> user1=eth.accounts[1] // Set user1 = accounts[1]

ddd"0x2300c1b01cd14c2aa64a8d070e1576bb71f9d1fa"

> user2=eth.accounts[2]

"0xefb9dc7fe744728293a3e63d7fcd948053997e07"

> eth.sendTransaction({from:user0,to:user1,value:web3.toWei(10,'ether')}) #转账10 ether

> eth.sendTransaction({from:user0,to:user2,value:web3.toWei(10,'ether')}) #转账10 ether

ref: https://www.freebuf.com/articles/blockchain-articles/193357.html

打赏点小钱
支付宝 | Alipay
微信 | WeChat