-
Notifications
You must be signed in to change notification settings - Fork 3
quick_start_zh
Casker edited this page Oct 25, 2018
·
5 revisions
本入门如未特别说明,都是在执行./used 后的console中执行命令。 演示命令都是在ubuntu 18.04上测试通过。
如果没有初始化,需要先初始化。
$ ./used init genesis.json
这一步会拿到CA证书。测试网不做人工审核,自动获取证书。 在操作系统命令行中执行如下命令:
$ ./used verify --id=[your id number] --photo=[your photo path]
# Then you will see idKey in your terminal.
$ ./used verify --query=[idKey]进入console
--moonet相当于--networkid=2
$ ./used --moonet console
为了私密性,我们的账号分为一次性账号,主账号,子账号。一次性账号仅用于向Usechain区块链发送证书认证。
主账号由一次性账号生成,子账号由主账号生成。普通用户无法追踪这些账号之间的关系。
本文进行如下约定:
- 设eth.accounts[0]为一次性账户
- 设eth.accounts[1]为主账户
- 设eth.accounts[2]为子账户
进入console后,可以执行下列命令。
一次性地址(一个):
> personal.newAccount()
主地址(一个):
> personal.newABaccount(eth.accounts[0])
子地址(可以生成多个):
> personal.newABaccount(eth.accounts[1])
> personal.newABaccount(eth.accounts[1])
> personal.newABaccount(eth.accounts[1])
进入console后,可以用admin.addPeer()加入测试网。
> admin.addPeer("enode://6289703f7cd8f370c1e7a822c164d733de27e549e0c3dc18cb21db174dec475ac65f10dba1a68809d7f9c5b19fb50366538ec5b2e541dc619c0e6acac1c25daf@39.107.67.179:30303")
true
访问 https://moonet.usechain.net/gettoken ,输入需要获取代币的地址,获取测试币,用于向Usechain公链测试网注册。每次可以获取10个USE。
用户需要先认证注册,才能成为不受限用户。
必须在console按顺序进行。
在console设置验证合约地址变量。
> sc="0xfffffffffffffffffffffffffffffffff0000001"
- 一次性账号注册
> use.sendOneTimeTransaction({from:eth.accounts[0],to:sc,gas:'0x332423'})
- 主账号注册
> use.sendMainTransaction(eth.accounts[0],{from:eth.accounts[1],to:sc,gas:'0x332423'})
- 子账号注册
> use.sendSubTransaction(eth.accounts[1],{from:eth.accounts[2],to:sc, gas:'0x332423'}
Hui是Usechain公链token的基本单位。USE是Usechain公链的普通单位,1 USE等于10^18 Hui.
> eth.sendTransaction({"from": eth.accounts[1],"to": eth.accounts[2], "value":web3.toHui("100", "USE")})
- 注册矿工
use.minerRegister({from: eth.accounts[1]})
- 挖矿
开始挖矿
> miner.setUsebase(eth.accounts[1])
> personal.unlockAccount(eth.coinbase, passphrase, 5000000)
true
> miner.start(2)
停止挖矿
> miner.stop()
- 可以在区块链浏览器中查询transaction或者address
- 可以在console中查询transaction或者address
> eth.getBalance(address)
This is the Wiki for the official Usechain golang implementation.