Install Go v1.10 or higher, Git, and the C compiler(if you have not installed GO, Git or C compiler please follow README).
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.
Something you may need to know before 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.
Get an account:
You will need an account to send transactions, deploy contracts and start mining on the mainnet. See How to create an account to create your own account. However, if you just want to run a seele node locally or in a test environment, you can skip this step. Some default accounts are provided for testing.
Running a Node:
In go-seele/cmd/node:
On Windows:
Running a Single Node:
In the cmd window, run: node start -c .\config\node1.json
By default this will start the miner, not metrics. You can add flags -m stop to not start the miner, or -t true to start metrics.
Running Multiple Nodes:
In one cmd window, run: node start -c .\config\node1.json
In a second cmd window, run: node start -c .\config\node2.json
On Linux & Mac:
Running a Single Node:
On terminal, run: ./node start -c ./config/node1.json
By default this will start the miner, not metrics. You can add flags -m stop to not start the miner, or -t true to start metrics.
Running Multiple Nodes:
In one terminal window, run: ./node start -c ./config/node1.json
In another terminal window, run: ./node start -c ./config/node2.json
Important note: under seeleteam/go-seele/cmd/node/config, there are 4 node configurations (with filename node*.json) that can be used as examples. To use your own account to interact with the mainnet, make sure you use the correct coinbase, p2p private key and shard information in one of these json files. For details, see How to customize your node configurations.
If you want to have a quickstart in a test or private blockchain environment, you can use the default node configurations and accounts. For example:
Note that seeleteam/go-seele/cmd/node/config/accounts.json only contains test accounts, do not use them if you are going to connect to the Seele mainnet.
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.
crossorgins
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.
genesis
timestamp
Timestamp of the genesis block.
difficult
Difficulty level: should be difficult near the beginning in order for easier block creation.
shard
Number of shards in the genesis block.
Help:
Use "node -h" for a list of available commands.
Use "node [command] --help" for more information about a command. </a>
Create a Full Node Client:
Preparations:
Install go v1.10 or higher and the C compiler (if you haven't install GO, Git or C compiler please follow README).
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
On Mac & Linux:
In the command window, run: ./client
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
On Mac & Linux:
In the command window, run: ./light
Help:
light -hNAME: light - interact with a light node processUSAGE: 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 commandGLOBAL OPTIONS:--help,-h show help
Of course, you need an account with money in it to transfer money (for example, 10 fans) to A.
Use the following example need to add the --accounts parameter when you need to start the node, In seeleteam/go-seele/cmd/node: command:node start -c ./config/node1.json --accounts ./config/accounts.json
// Request (if not given value, default value will be : gasprice = 10, gaslimit = 21000) client sendtx --amount 10000--price 1--gas 2--from .keystore-shard-1-0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21--to 0xb286933bccbec9ca1cd92257d12d12ebab9b1201// Response (If we want use coherent name as savekey step in “How To Create An Account”, it is recommended to use .keystore-shard1& It is .keystore-shard1 not .keystore-shard-1) In seeleteam/go-seele/cmd/node: 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=" } }
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.
For the sake of convenience, use A to deploy the simple_storage.sol contract. Using the contract simulator will help you to get the contract binary data.
// Requestclient sendtx --amount 0 --from .keystore-shard-1-0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 --payload 0x608060405234801561001057600080fd5b50600560008190555060df806100276000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058207f6dc43a0d648e9f5a0cad5071cde46657de72eb87ab4cded53a7f1090f51e6d0029
// ResponsePlease input your key file password:account 0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21 current nonce:0, sending nonce:0transaction 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.
The result of "failure": falserow, which indicates the deploy contract was successful. The result of "contract": "0xc3e7b32db87dd5b8d70a78666518c6395d0f0092" row is the contract address.
Under seeleteam/go-seele/cmd/node/config, you can find four node*.json files. You can create your own Seele node by customizing any one of them.
After creating your account (How to create an account), replace "coinbase" field with your public key.
Modify the "shard" field with the correct shard number associated with your account.
Create another private-public key pair. Replace "privateKey" field in "p2p" section with your private key. This private key is used for p2p network only and should be different from the private key you use to mine and send transactions. Do not use private keys associated with your coinbase or any other transaction accounts here!
You could connect to some static nodes in the network by configuration. The format of "staticNodes" field is ["ip:port",...], for example, ["127.0.0.1:8057"].
If "isDebug" and "printLog" fields are true, the display is in debug mode and log mode when you run the Seele node. Default values should be false.
The "networkID", "difficult" and "timestamp" field for nodes in the same network should be the same. Nodes with different values in these field can not connect to each other.
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.