Getting Started With Seele¶
Setting Up a Node¶
- Preparations:
- Install Go v1.10 or higher, Git, and the C compiler.
- Clone the go-seele repository to the
GOPATH
directory :
go get -u -v github.com/seeleteam/go-seele/... - In
seeleteam\go-seele\cmd\node, run:go build; if you are running this for the first time a node executable object will appear.
- Running a Node:
- If you run into the error related to “genesis block hash mismatch”, follow the solution located here.
- If you want to run a light node, just replace node1.json with light_node1.json. Of course, don’t forget to start a full node before you do this.
- Unless otherwise stated, the nodes mentioned below refer to the full node.
commands:
On Windows:
- Running a Singular Node:
- In the cmd window, run:
node start -c .\config\node1.json [--accounts .\config\accounts.json] - By default this will start the miner, not metrics. You can
add flags
-m stopto not start the miner, or-t trueto start metrics.
- In the cmd window, run:
- Running Multiple Nodes:
- In one cmd window, run:
node start -c .\config\node1.json [--accounts .\config\accounts.json] - In a second cmd window, run:
node start -c .\config\node2.json [--accounts .\config\accounts.json]
- In one cmd window, run:
- Running a Singular Node:
On Linux & Mac:
- Running a Singular Node:
- On terminal, run:
./node start -c ./config/node1.json [--accounts ./config/accounts.json] - By default this will start the miner, not metrics. You can
add flags
-m stopto not start the miner, or-t trueto start metrics.
- On terminal, run:
- Running Multiple Nodes:
- In one terminal window, run:
./node start -c ./config/node1.json [--accounts ./config/accounts.json] - In another terminal window, run:
./node start -c ./config/node2.json [--accounts ./config/accounts.json]
- In one terminal window, run:
Note: in the config file under the seeleteam/go-seele/cmd/node path, there are 4 different module configurations that you can choose from to start your node.
- Running a Singular Node:
Custom Configurations:
You can choose your own custom module configurations and not use the default module configurations to start your node. The custom configurations are below: (
Notes: you can followJoin Seele Networkto join Seele Network)
node1.json:
{
"basic":{
"name": "seele node1",
"version": "1.0",
"dataDir": "node1",
"address": "0.0.0.0:8027",
"coinbase": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
"algorithm": "sha256"
},
"p2p": {
"privateKey": "0xf65e40c6809643b25ce4df33153da2f3338876f181f83d2281c6ac4a987b1479",
"staticNodes": [],
"address": "0.0.0.0:8057",
"networkID": "seele"
},
"log": {
"isDebug": true,
"printLog": true
},
"httpServer": {
"address": "0.0.0.0:8037",
"crossorigins": [
"*"
],
"whiteHost": [
"*"
]
},
"wsserver": {
"address": "0.0.0.0:8047",
"crossorigins": [
"*"
]
},
"metrics": {
"address": "0.0.0.0:8087",
"duration": 10,
"database": "influxdb",
"username": "test",
"password": "test123"
},
"genesis": {
"difficult":8000000,
"shard":1,
"timestamp":1539742676
}
}
accounts.json:
{
"0x007d1b1ea335e8e4a74c0be781d828dc7db934b1": 1000000000000,
"0x0a57a2714e193b7ac50475ce625f2dcfb483d741": 1000000000000,
"0x2a23825407740fa7163069257c57452c4d4fc3d1": 1000000000000,
"0x2a87b6504cd00af95a83b9887112016a2a991cf1": 1000000000000,
"0x3b691130ec4166bfc9ec7240217fc8d08903cf21": 1000000000000,
"0x4eea165e9266f20bf6e5e08e0c11d38e8fc02661": 1000000000000,
"0x4fb7c8b0287378f0cf8b5a9262bf3ef7e101f8d1": 1000000000000,
"0xec759db47a65f6537d630517f6cd3ca39c6f93d1": 1000000000000,
"0xfaf78f23293cc537154c275c874ede0f8c8b8801": 1000000000000,
"0xfbe506bdaf256682551873290d0a794d51bac4d1": 1000000000000
}
Domain | Parameter | Explanation |
|---|---|---|
basic | name | Name of node |
version | Version of node | |
dataDir | System file path of node, used to store data | |
address | Address to start RPC server | |
coinbase | Coinbase used to mine | |
p2p | privateKey | Private key for the p2p module, not used as an account |
staticNodes | A static node. When the node is started, it will be connected to search for more nodes. | |
address | The p2p server will listen on the TCP connection, which is used as the UDP address for the Kad protocol. | |
networkID | Used to indicate the network type. For example, 1 is testnet, 2 is mainnet. | |
log | isDebug | If IsDebug is true, the log will be on the debug level, otherwise it will be on the info level. |
printLog | If PrintLog is true, then all logs will be printed on the console, otherwise it will be written and stored in a file. | |
httpServer | address | HTTP RPC’s service address. |
crosssorgins | Sent to the client’s cross-origin resource sharing origin. Note that CORS is a type of forced safety measure by the browser, which is irrelevant to the client’s custom HTTP. | |
whiteHost | Whitelist of permitted hosts. | |
wsserver | address | Address of Websocket RPC server. |
pattern | Pattern to request path. | |
genesis | accounts | Account information of the genesis block, used for testing. |
difficult | Difficulty level: should be difficult near the beginning in order for easier block creation. | |
shard | Number of shards in the genesis block. |
Help:
To run:node -h
use “node help []” for detailed usage
Usage: node [command]
Available Commands: help Help about any command key generate a key pair with specified shard number start start the node of Seele validatekey validate the private key and generate its public key
Flags: -a, –addr string rpc address (default “127.0.0.1:55027”) -h, –help help for node
Use “node [command] –help” for more information about a command.
Others:
- To create a public and private key, run in the command window: node key
- To create a public key based on the private key,run in the command window: node validatekey -k PRIVATEKEY
Create a Full Node Client:¶
- Preparations:
- Install go v1.10 or higher and the C compiler.
- In
seeleteam\go-seele\cmd\client, run:go build. If you are running this for the first time, a client executable object will appear.
- Running a Full Node Client:
- On Windows:
- In the command window, run:
client
- In the command window, run:
- On Mac & Linux:
- In the command window, run:
./client
- In the command window, run:
- On Windows:
- Help:
client -h
NAME:
client - interact with a full node process
USAGE:
client [global options] command [command options] [arguments...]
AUTHOR:
seeleteam <dev@seelenet.com>
COMMANDS:
call call contract
deckeyfile Decrypt key file
domain system domain name commands
dumpheap dump heap for profiling, return the file path
getbalance get balance info
getblock get block by height or hash
getblockheight get block height
getblocktxcount get block transaction count by block height or block hash
getdebtbyhash get debt by debt hash
getdebts get pending debts
getinfo get node info
getlogs get logs
getnonce get account nonce
getpendingtxs get pending transactions
getreceipt get receipt by transaction hash
getshardnum get account shard number
gettxbyhash get transaction by transaction hash
gettxinblock get transaction by block height or block hash with index of the transaction in the block
gettxpoolcontent get transaction pool contents
gettxpoolcount get transaction pool transaction count
htlc Hash time lock contract commands
key generate key with or without shard number
miner miner commands
p2p p2p commands
payload generate the payload according to the abi file and method name and args
savekey save private key to a keystore file
sendtx send transaction to node
sign generate a signed transaction and print it out
subchain system sub chain commands
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
Create a Light Node Client:¶
- Preparations:
- Install go v1.10 or higher and the C compiler.
- In
seeleteam\go-seele\cmd\client\light, run:go build. If you are running this for the first time, a client executable object will appear.
- Running a Light Node Client:
- On Windows:
- In the command window, run:
light
- In the command window, run:
- On Mac & Linux:
- In the command window, run:
./light
- In the command window, run:
- On Windows:
- Help:
light -h
NAME:
light - interact with a light node process
USAGE:
light [global options] command [command options] [arguments...]
AUTHOR:
seeleteam <dev@seelenet.com>
COMMANDS:
deckeyfile Decrypt key file
getbalance get balance info
getblock get block by height or hash
getblockheight get block height
getblocktxcount get block transaction count by block height or block hash
getnonce get account nonce
getpendingtxs get pending transactions
getreceipt get receipt by transaction hash
getshardnum get account shard number
gettxbyhash get transaction by transaction hash
gettxinblock get transaction by block height or block hash with index of the transaction in the block
gettxpoolcontent get transaction pool contents
gettxpoolcount get transaction pool transaction count
key generate key with or without shard number
p2p p2p commands
payload generate the payload according to the abi file and method name and args
savekey save private key to a keystore file
sendtx send transaction to node
sign generate a signed transaction and print it out
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
Three common scene commands:¶
Prepare:
How to create an account will help you to get a Seele account.
1. Transfer¶
- Of course, you need a rich account to transfer money (for example, 10
fans) to A.
> Use the following example need to add the
--accountsparameter when you need to start the node, command:node start -c ./config/node1.json --accounts ./config/accounts.json
// Request
client sendtx --amount 10000 --price 1 --gas 2 --from .keystore-shard-1-0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 --to 0xb286933bccbec9ca1cd92257d12d12ebab9b1201
// Response
Please input your key file password:
account 0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 current nonce: 0, sending nonce: 0
transaction sent successfully
{
"Hash": "0x9c0e2565b8a0b33c3f69aa6eb9bad4a86c3925a1fe12272e2082091b9b1c5609",
"Data": {
"From": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
"To": "0xb286933bccbec9ca1cd92257d12d12ebab9b1201",
"Amount": 10000,
"AccountNonce": 0,
"GasPrice": 1,
"GasLimit": 21000,
"Timestamp": 0,
"Payload": ""
},
"Signature": {
"Sig": "N8XzJ/GEpU73dpzW5t5WShmVPFb8gQOrInGdypul8aBaDakmhbZ2rdqekA5bWslHQBfsoafeMukF5b7A1/6JWQA="
}
}
- Query the transfer result with the tx
Hash.
// Request
client getreceipt --hash 0x9c0e2565b8a0b33c3f69aa6eb9bad4a86c3925a1fe12272e2082091b9b1c5609
// Resposne
{
"contract": "0x",
"failed": false,
"poststate": "0xef59ced1b06d3ec77aa5c3b0fa1bd7cdd83890961f49d06aabe0a2d57583dd3b",
"result": "0x",
"totalFee": 21000,
"txhash": "0x9c0e2565b8a0b33c3f69aa6eb9bad4a86c3925a1fe12272e2082091b9b1c5609",
"usedGas": 21000
}
The result of "failure": falserow, indicating that the transfer
was successful. By the way, if tx is not packed by the miner or the
miner is packing, you may
seeget error when call rpc leveldb: not found. Don’t worry, just
wait for servals seconds, or you can use client gettxbyhash to query
tx status.
- Confirm the A balance.
// Request
client getbalance --account 0xb4153ca4090a11af1984cdf20b0d0cbed5ff97a1
// Response
{
"Account": "0xb4153ca4090a11af1984cdf20b0d0cbed5ff97a1",
"Balance": 10
}
2. Deploy contract¶
- For the sake of convenience, use A deploy the
simple_storage.solcontract.Using the contract simulator will help you to get the contract binary data.
// Request
client sendtx --amount 0 --from .keystore-shard-1-0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 --payload 0x608060405234801561001057600080fd5b50600560008190555060df806100276000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058207f6dc43a0d648e9f5a0cad5071cde46657de72eb87ab4cded53a7f1090f51e6d0029
// Response
Please input your key file password:
account 0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 current nonce: 0, sending nonce: 0
transaction sent successfully
{
"Hash": "0xc4674bf0a3ee0796d3ae139ac40a480fa40d4e59ed0af9aa22d57dbc3c21a96e",
"Data": {
"From": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
"To": "0x0000000000000000000000000000000000000000",
"Amount": 0,
"AccountNonce": 0,
"GasPrice": 10,
"GasLimit": 200000,
"Timestamp": 0,
"Payload": "0x608060405234801561001057600080fd5b50600560008190555060df806100276000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058207f6dc43a0d648e9f5a0cad5071cde46657de72eb87ab4cded53a7f1090f51e6d0029"
},
"Signature": {
"Sig": "Ws2zZlCiAyZYIx/iQQwz7hAG+K99gR5B8db2GZ0zKW8hTUfSBt1XH3swcB+dtZR/yUC1tl+jRY3Jv6fwRtYiiwA="
}
}
If you display
get error when call rpc balance is not enough, account:0xb4153ca4090a11af1984cdf20b0d0cbed5ff97a1, balance:10, amount:0, fee:123,
that’s right, I deliberately, quickly fill the money.
- Query the contract deploy result
// Request
client getreceipt --hash 0xc4674bf0a3ee0796d3ae139ac40a480fa40d4e59ed0af9aa22d57dbc3c21a96e
// Response
{
"contract": "0x12fe58608430e36ba6bfb0a9bc5623a634530002",
"failed": false,
"poststate": "0x6bccb0ae94795ae716644300257863e157dd5717a00ca3293bd1d7e0cc1ece61",
"result": "0x6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058207f6dc43a0d648e9f5a0cad5071cde46657de72eb87ab4cded53a7f1090f51e6d0029",
"totalFee": 1007070,
"txhash": "0xc4674bf0a3ee0796d3ae139ac40a480fa40d4e59ed0af9aa22d57dbc3c21a96e",
"usedGas": 100707
}
The result of "failure": falserow, which indicates the deploy
contract was successful. The result of
"contract": "0xc3e7b32db87dd5b8d70a78666518c6395d0f0092" row is the
contract address.
3. Call contract¶
Sendtx¶
sendtxto call the contract
// Request
client sendtx --amount 0 --payload 0x6d4ce63c --from .keystore-shard-1-0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 --to 0x12fe58608430e36ba6bfb0a9bc5623a634530002
// Response
Please input your key file password:
account 0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 current nonce: 1, sending nonce: 1
transaction sent successfully
{
"Hash": "0xae073c03abc04ad182792bc5bf9faeb04d1c80888c985e839f896fd5fd08bf9f",
"Data": {
"From": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
"To": "0x12fe58608430e36ba6bfb0a9bc5623a634530002",
"Amount": 0,
"AccountNonce": 1,
"GasPrice": 10,
"GasLimit": 200000,
"Timestamp": 0,
"Payload": "0x6d4ce63c"
},
"Signature": {
"Sig": "RB7a0T8ej34R7co1OgRsdYh3we1DQmJ1INUq1Tysoi4Sgf89u0Njvld+wOh1+XARhc/ojM4B0rpP4dIqqg7rvAA="
}
}
- Query the result
// Request
client getreceipt --hash 0xae073c03abc04ad182792bc5bf9faeb04d1c80888c985e839f896fd5fd08bf9f
// Response
{
"contract": "0x",
"failed": false,
"poststate": "0x0685695c28fde434c3d9b1e857849ad761cc607a804aa32bef4185469c359995",
"result": "0x0000000000000000000000000000000000000000000000000000000000000005",
"totalFee": 216960,
"txhash": "0xae073c03abc04ad182792bc5bf9faeb04d1c80888c985e839f896fd5fd08bf9f",
"usedGas": 21696
}
Call¶
callthe contract, thecallcommand is separate from the blockchain and is suitable for querying data without changing the state.
// Request
client call --payload 0x6d4ce63c --to 0x12fe58608430e36ba6bfb0a9bc5623a634530002 --height -1
// Response
{
"contract": "0x",
"failed": false,
"poststate": "0x6c81260cea77c64aa240534c27a3c46cf41749f4c027546675819b3b1fb58ccb",
"result": "0x0000000000000000000000000000000000000000000000000000000000000005",
"totalFee": 21696,
"txhash": "0x452c1bbd09292411095780badf8f2b18b5e7ba72910214e683d741ff3547df3e",
"usedGas": 21696
}
GCC install newbie guide¶
Install Document: https://gcc.gnu.org/install/
Download Link: https://gcc.gnu.org/install/binaries.html
Or you can go directly to the website to download the release installer. (Recommend)
Start Metrics¶
If you want to start the metrics, it is necessary to install InfluxDB first.
Download Link: https://portal.influxdata.com/downloads
After downloading Influxdb, go to the Influxdb folder and update Influxdb.conf:
[http]
# Determines whether the HTTP endpoint is enabled.
# enabled = true
# The bind address used by the HTTP service.
# bind-address = ":8086"
bind-address = ":8087"
Then, start the influxdb with influxdb.conf.
influxd run -config influxdb.conf
And in another cmd window, use the influxdb client to create the database “influxdb”.
influx -port 8087
create database influxdb
exit
Finally, start the node with -t true.
Q&A¶
genesis block hash mismatch¶
If the log looks like the following:
- Windows:
data folder: C:\Users\seele\.seele\node1
INFO[0000] NewSeeleService BlockChain datadir is C:\Users\seele\.seele\node1\db\blockchain caller="seeleservice.go:62" module=seele
INFO[0000] NewSeeleService account state datadir is C:\Users\seele\.seele\node1\db\accountState caller="seeleservice.go:72" module=seele
ERRO[0000] NewSeeleService genesis.Initialize err. genesis block hash mismatch caller="seeleservice.go:88" module=seele
genesis block hash mismatch
- Linux:
log folder: /var/folders/dq/mcz24sr571g48wrbjvdbpndw0000gn/T/seeleTemp/log
data folder: /Home/seele/.seele/node1
INFO[0000] NewSeeleService BlockChain datadir is /Home/seele/.seele/node1/db/blockchain caller="seeleservice.go:62" module=seele
INFO[0000] NewSeeleService account state datadir is /Home/seele/.seele/node1/db/accountState caller="seeleservice.go:72" module=seele
ERRO[0000] NewSeeleService genesis.Initialize err. genesis block hash mismatch caller="seeleservice.go:88" module=seele
genesis block hash mismatch
You can just delete the .seele/node1 folder and restart. The absolute path to the .seele folder is in the logs printed above.