88 lines
3.0 KiB
Markdown
88 lines
3.0 KiB
Markdown
# ether: set up node
|
|
|
|
###### Sprint: ?
|
|
|
|
|
|
###DOC
|
|
|
|
we setup our node with geth.Geth(Go Ethereum) is a command line interface for running Ethereum node implemented in Go Language. Using Geth you can join Ethereum network, transfer ether between accounts or even mine ethers.
|
|
|
|
|
|
###steup
|
|
|
|
You can start Geth in one of three different sync modes using the --syncmode "<mode>" argument that determines what sort of node it is in the network.
|
|
|
|
These are:
|
|
|
|
1. Full: Downloads all blocks (including headers, transactions, and receipts) and generates the state of the blockchain incrementally by executing every block.
|
|
2. Fast: Downloads all blocks (including headers, transactions and receipts), verifies all headers, and downloads the state and verifies it against the headers.
|
|
3. Snap (Default): Same functionality as fast, but with a faster algorithm.
|
|
4. Light: Downloads all block headers, block data, and verifies some randomly.
|
|
|
|
we used light mode to better speed in syncing and decrease needed storage.
|
|
|
|
|
|
Ethereum has many networks:
|
|
1. mainnet
|
|
2. testnet
|
|
1. Görli(goerli)<br >
|
|
A proof-of-authority testnet that works across clients.
|
|
|
|
2. Kovan:<br >
|
|
A proof-of-authority testnet for those running OpenEthereum clients.
|
|
|
|
3. Rinkeby:<br >
|
|
A proof-of-authority testnet for those running Geth client.
|
|
4. Ropsten:<br >
|
|
A proof-of-work testnet. This means it's the best like-for-like representation of Ethereum.
|
|
|
|
|
|
we wrote an script to setup eth node:
|
|
|
|
```shell
|
|
geth --goerli --http --http.vhosts="" --http.addr=0.0.0.0 --datadir /home/ubuntu/.ethereum --rpcaddr=0.0.0.0 --rpcport=8545 --port=30303 --rpcapi="admin,db,debug,personal,eth,net,web3" --rpccorsdomain="" --rpcvhosts="*" --syncmode="light" --cache=2048 --allow-insecure-unlock --nousb
|
|
```
|
|
* in goerli testnet and light mode
|
|
|
|
you can see more detail in [geth docs](https://geth.ethereum.org/docs/interface/command-line-options) or use
|
|
```shell
|
|
geth --help
|
|
```
|
|
after installation
|
|
|
|
|
|
###some commands and tips
|
|
1. install the geth on your machine<br/>
|
|
commands for ubuntu
|
|
- sudo add-apt-repository -y ppa:ethereum/ethereum
|
|
- sudo apt-get update
|
|
- sudo apt-get install ethereum
|
|
2. connect to console of Eth server:
|
|
geth attach `http://ip:prot`
|
|
3. personal.newAccount()<br >
|
|
Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account.<br >
|
|
At the geth console, newAccount will prompt for a passphrase when it is not supplied as the argument.
|
|
```shell
|
|
> personal.newAccount()
|
|
Passphrase:
|
|
Repeat passphrase:
|
|
"0x5e97870f263700f46aa00d967821199b9bc5a120"
|
|
```
|
|
|
|
2. for checking that geth is updated or not you can use:
|
|
```shell
|
|
> eth
|
|
```
|
|
for all informations
|
|
```shell
|
|
> eth.blockNumber
|
|
```
|
|
for getting only last received block<br >
|
|
and compare it with [etherscan](https://etherscan.io/)
|
|
|
|
3. to connect to your node with js console you can use:
|
|
```shell
|
|
geth attach {$your_node_anddress}
|
|
```
|
|
|