diff --git a/src/pages/docs/developers/geth-developer/dev-mode.md b/src/pages/docs/developers/geth-developer/dev-mode.md index a57db2a225..c39fd02681 100644 --- a/src/pages/docs/developers/geth-developer/dev-mode.md +++ b/src/pages/docs/developers/geth-developer/dev-mode.md @@ -27,7 +27,7 @@ Starting Geth in developer mode is as simple as providing the `--dev` flag. It i Remix will be used to deploy a smart contract to the node which requires information to be exchanged externally to Geth's own domain. To permit this, enable `http` and the `net` namespace must be enabled and the Remix URL must be provided to `--http.corsdomain`. For this tutorial some other namespaces will also be enabled. The full command is as follows: ```shell -geth --dev --http --http.api eth,web3,personal,net --http.corsdomain "http://remix.ethereum.org" +geth --dev --http --http.api eth,web3,net --http.corsdomain "http://remix.ethereum.org" ``` The terminal will display the following logs, confirming Geth has started successfully in developer mode: @@ -83,7 +83,7 @@ Welcome to the Geth Javascript console! instance: Geth/v1.10.18-unstable-8d84a701-20220503/linux-amd64/go.1.18.1 coinbase: 0x540dbaeb2390f2eb005f7a6dbf3436a0959197a9 at block: 0 (Thu Jan 01 1970 01:00:00 GMT+0100 (BST)) - modules: eth:1.0 personal:1.0 rpc:1.0 web3:1.0 + modules: eth:1.0 rpc:1.0 web3:1.0 To exit, press ctrl-d or type exit > @@ -118,10 +118,10 @@ Using `web3.fromWei()` is less error prone because the correct multiplier is bui 1.157920892373162e+59 ``` -A new account can be created and some of the ether from the coinbase transferred across to it. A new account is generated using the `newAccount` function in the `personal` namespace: +A new account can be created using Clef. Some of the ether from the coinbase can then be transferred across to it. A new account is generated using the `newaccount` function on the command line: ```shell -personal.newAccount() +clef newaccount --keystore ``` The terminal will display a request for a password, twice. Once provided, a new account will be created and its address printed to the terminal. The account creation is also logged in the Geth terminal, including the location of the keyfile in the keystore. It is a good idea to back up the password somewhere at this point. If this were an account on a live network, intended to own assets of real-world value, it would be critical to back up the account password and the keystore in a secure manner. @@ -280,7 +280,7 @@ The returned value is a left-padded hexadecimal value. For example, the return v This tutorial used an ephemeral blockchain that is completely destroyed and started afresh during each dev-mode session. However, it is also possible to create persistent blockchain and account data that can be reused across multiple sessions. This is done by providing the `--datadir` flag and a directory name when starting Geth in dev-mode. ```shell -geth --datadir dev-chain --dev --http --http.api personal,web3,eth,net --http.corsdomain "remix.ethereum.org" +geth --datadir dev-chain --dev --http --http.api web3,eth,net --http.corsdomain "remix.ethereum.org" ``` ## Re-using accounts @@ -289,7 +289,7 @@ Geth will fail to start in dev-mode if keys have been manually created or import ```shell -geth --datadir dev-chain --dev --http --http.api personal,web3,eth,net --http.corsdomain "remix.ethereum.org" --password password.txt +geth --datadir dev-chain --dev --http --http.api web3,eth,net --http.corsdomain "remix.ethereum.org" --password password.txt ``` diff --git a/src/pages/docs/developers/geth-developer/private-network.md b/src/pages/docs/developers/geth-developer/private-network.md index eade1a89d4..ec8ec3f27c 100644 --- a/src/pages/docs/developers/geth-developer/private-network.md +++ b/src/pages/docs/developers/geth-developer/private-network.md @@ -27,7 +27,7 @@ While the main network uses proof-of-work (PoW) to secure the blockchain, Geth a #### Ethash -Geth's PoW algorithm, [Ethhash](https://ethereum.org/en/developers/docs/consensus-mechanisms/pow/mining-algorithms/ethash), is a system that allows open participation by anyone willing to dedicate resources to mining. While this is a critical property for a public network, the overall security of the blockchain strictly depends on the total amount of resources used to secure it. As such, PoW is a poor choice for private networks with few miners. The Ethash mining 'difficulty' is adjusted automatically so that new blocks are created approximately 12 seconds apart. As more mining resources are deployed on the network, creating a new block becomes harder so that the average block time matches the target block time. +Geth's PoW algorithm, [Ethash](https://ethereum.org/en/developers/docs/consensus-mechanisms/pow/mining-algorithms/ethash), is a system that allows open participation by anyone willing to dedicate resources to mining. While this is a critical property for a public network, the overall security of the blockchain strictly depends on the total amount of resources used to secure it. As such, PoW is a poor choice for private networks with few miners. The Ethash mining 'difficulty' is adjusted automatically so that new blocks are created approximately 12 seconds apart. As more mining resources are deployed on the network, creating a new block becomes harder so that the average block time matches the target block time. #### Clique @@ -388,19 +388,19 @@ TRACE[05-13|16:15:57.767] PING/v4 id=f1364e6d060c It is now possible to attach a Javascript console to either node to query the network properties: -```shell +```sh geth attach node1/geth.ipc ``` Once the Javascript console is running, check that the node is connected to one other peer (node 2): -```shell +```sh net.peerCount ``` The details of this peer can also be queried and used to check that the peer really is Node 2: -``` +```sh admin.peers ``` @@ -441,9 +441,6 @@ eth.getBalance(eth.accounts[0]) This account can then be unlocked and some ether sent to Node 2, using the following commands: ```javascript -// unlock account -personal.unlockAccount(eth.accounts[0]); - // send some Wei eth.sendTransaction({ to: '0xc94d95a5106270775351eecfe43f97e8e75e59e8', diff --git a/src/pages/docs/getting-started/index.md b/src/pages/docs/getting-started/index.md index 1b29b06d49..7028eb94b6 100644 --- a/src/pages/docs/getting-started/index.md +++ b/src/pages/docs/getting-started/index.md @@ -149,7 +149,7 @@ Welcome to the Geth JavaScript console! instance: Geth/v1.10.15-stable/darwin-amd64/go1.17.5 at block: 6354736 (Thu Feb 10 2022 14:01:46 GMT+0100 (WAT)) datadir: /home/go-ethereum/geth-tutorial - modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0 + modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 rpc:1.0 txpool:1.0 web3:1.0 To exit, press ctrl-d or type exit ``` @@ -201,15 +201,7 @@ eth.sendTransaction({ }); ``` -This command will return an error message indicating that `authentication is needed: password or unlock`. This is a security feature that prevents unauthorized access to sensitive account operations. There are two ways to unlock the account. The first is to start Geth with the account permanently unlocked (by passing `--unlock
` at startup). This is not recommended because the account remains unlocked all the time Geth is running, creating a security weakness. Instead, it is better to temporarily unlock the account for the specific transaction. This requires using the `sendTransaction` method from the `personal` namespace instead of the `eth` namespace. The password can be provided as a string in the method call as follows: - -```sh -personal.sendTransaction({ - from: "0xca57f3b40b42fcce3c37b8d18adbca5260ca72ec", - to: "0xce8dba5e4157c2b284d8853afeeea259344c1653", - value: web3.toWei(0.1, "ether") -}, "password") -``` +This command will return an error message indicating that `authentication is needed: password or unlock`. This is a security feature that prevents unauthorized access to sensitive account operations. There are two ways to unlock the account. The first is to start Geth with the account permanently unlocked (by passing `--unlock
` at startup). This is not recommended because the account remains unlocked all the time Geth is running, creating a security weakness. Instead, it is better to temporarily unlock the account for the specific transaction using Clef. This requires Geth to be started with Clef as an external signer, and for Clef to know the location of the keystore (please see the [account management](/pages/docs/fundamentals/account-management.md) or [Clef](/pages/docs/tools/clef/Introduction.md) pages for setup details). In the Javascript console, the transaction hash is displayed. This will be used in the next section to retrieve the transaction details. diff --git a/src/pages/docs/interacting-with-geth/javascript-console.md b/src/pages/docs/interacting-with-geth/javascript-console.md index 93140bfab5..95f3bd2999 100644 --- a/src/pages/docs/interacting-with-geth/javascript-console.md +++ b/src/pages/docs/interacting-with-geth/javascript-console.md @@ -69,7 +69,7 @@ instance: Geth/v1.10.18-unstable-8d85a701-20220503/linux-amd64/go1.18.1 coinbase: 0x281aabb85c68e1638bb092750a0d9bb06ba103ee at block: 12305815 (Thu May 26 2022 16:16:00 GMT+0100 (BST)) datadir: /home/go-ethereum/data - modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0 + modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 rpc:1.0 txpool:1.0 web3:1.0 To exit, press ctrl-d or type exit > diff --git a/src/pages/docs/interacting-with-geth/rpc/index.md b/src/pages/docs/interacting-with-geth/rpc/index.md index dfd56076c2..3e7df4a03d 100644 --- a/src/pages/docs/interacting-with-geth/rpc/index.md +++ b/src/pages/docs/interacting-with-geth/rpc/index.md @@ -38,10 +38,10 @@ geth --http --http.port 3334 Not all of the JSON-RPC method namespaces are enabled for HTTP requests by default. Instead, they have to be whitelisted explicitly when Geth is started. Calling non-whitelisted RPC namespaces returns an RPC error with code `-32602`. -The default whitelist allows access to the `eth`, `net` and `web3` namespaces. To enable access to other APIs like account management (`personal`) and debugging (`debug`), they must be configured using the `--http.api` flag. Enabling these APIs over HTTP is **not recommended** because access to these methods increases the attack surface. +The default whitelist allows access to the `eth`, `net` and `web3` namespaces. To enable access to other APIs like debugging (`debug`), they must be configured using the `--http.api` flag. Enabling these APIs over HTTP is **not recommended** because access to these methods increases the attack surface. ```sh -geth --http --http.api personal,eth,net,web3 +geth --http --http.api eth,net,web3 ``` Since the HTTP server is reachable from any local application, additional protection is built into the server to prevent misuse of the API from web pages. To enable access to the API from a web page (for example to use the online IDE, [Remix](https://remix.ethereum.org)), the server needs to be configured to accept Cross-Origin requests. This is achieved using the `--http.corsdomain` flag.