and add more visibility to the test account use risk
Change the postman button as it was just an image and users
kept trying to click it (heatmap said)
Signed-off-by: Nicolas MASSART <nicolas.massart@consensys.net>
Co-authored-by: Alexandra Tran <12214231+alexandratran@users.noreply.github.com>
Here we query the version of the Besu node, which confirms the node is running.
=== "Result explanation"
Successfully calling this method shows that you can connect to the nodes using RPC. From here, you
can walk through more interesting requests demonstrated in the rest of this section, or skip ahead
to [Create a transaction using MetaMask](#create-a-transaction-using-metamask).
* `"jsonrpc" : "2.0"` indicates that the JSON-RPC 2.0 spec format is used.
* `"id" : 1` is the request identifier used to match the request and the response. This tutorial always uses 1.
* `"result"` contains the running Besu information:
* `v21.1.2` is the running Besu version number. This may be different when you run this tutorial.
* `linux-x86_64` is the architecture used to build this version.
* `oracle_openjdk-java-11` is the JVM type and version used to build this version. This may be different when you run this tutorial.
Successfully calling this method shows that you can connect to the nodes using JSON-RPC over HTTP.
From here, you can walk through more interesting requests demonstrated in the rest of this section,
or skip ahead to [Create a transaction using MetaMask](#create-a-transaction-using-metamask).
### Count the peers
Peers are the number of other nodes connected to the RPC node.
Peers are the other nodes connected to the node receiving the JSON-RPC request.
Poll the peer count using `net_peerCount`:
Poll the peer count using [`net_peerCount`](../../Reference/API-Methods.md#net_peercount):
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' http://localhost:8545
```
The result indicates that there are four peers:
The result indicates that there are four peers (our validators):
```json
{
@ -207,28 +215,31 @@ The result indicates that there are four peers:
### Request the most recent block number
Call `eth_blockNumber` to retrieve the number of the most recent block:
Call [`eth_blockNumber`](../../Reference/API-Methods.md#eth_blockNumber) to retrieve the number of the most recently synchronized block:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545
```
The result indicates the highest block number synchronized on this node.
```json
{
"jsonrpc" : "2.0",
"id" : 1,
"result" : "0x8b8"
"result" : "0x2a"
}
```
The hexadecimal value `0x8b8` translates to `2232` in decimal, the number of blocks so far.
Here the hexadecimal value `0x2a` translates to decimal as `42`, the number of blocks received by the node so far,
about 2 minutes after the new network started.
## Create a transaction using MetaMask
Now let's use [MetaMask](https://metamask.io/) to send transactions.
You can use [MetaMask](https://metamask.io/) to send a transaction on your private network.
Before sending transactions, you need to create an account or use one of the accounts below
created during the genesis of this private test network.
* Open MetaMask and connect it to your private network RPC endpoint by selecting `Localhost 8545` in the network list.
* Choose one of the following test accounts and [import it into MetaMask by copying the corresponding private key](https://metamask.zendesk.com/hc/en-us/articles/360015489331-How-to-import-an-Account).
{!global/test_accounts.md!}
@ -238,169 +249,172 @@ created during the genesis of this private test network.
[account management](../../HowTo/Send-Transactions/Account-Management.md). To create your own
account, you have to use a third-party tool, such as MetaMask.
After you sign in to MetaMask, connect to the private network RPC endpoint:
After importing an existing test account, [create another test account from scratch]
to use as the recipient for a test Ether transaction.
1. In the MetaMask network list, select **Custom RPC**.
1. In the **New RPC URL** field, enter the JSON-RPC HTTP service endpoint displayed when you
started the private network.
In MetaMask, select the new test account and [copy its address](https://metamask.zendesk.com/hc/en-us/articles/360015289512-How-to-copy-your-MetaMask-Account-Public-Address).
Save the configuration and return to the MetaMask main screen. Your current network is now set to
the private network RPC node.
In the [Block Explorer](http://localhost:25000), search for the new test account by clicking on the :mag: and pasting
the test account address into the search box.
[Import one of the existing accounts above into MetaMask] using the corresponding private key.
The new test account displays with a zero balance.
!!!note
In this tutorial, we don't need to secure the keys, because we're using a private test network
to send valueless Ether. In a production environment, be sure to secure your accounts on the
main Ethereum network (MainNet).
When you're finished importing an existing account, [create another account from scratch] to send
Ether to.
[Send test Ether](https://metamask.zendesk.com/hc/en-us/articles/360015488931-How-to-send-ETH-and-ERC-20-tokens-from-your-MetaMask-Wallet)
from the first test account (containing test Ether) to the new test account (which has a zero balance).
In MetaMask, select the new account and copy the account address by clicking the **…**
gadget and selecting **Copy Address to clipboard**.
!!!tip
In the block explorer, search for the new account by clicking on the magnifying glass and pasting
the account address into the search box. The account displays with a zero balance.
You can use a zero gas price here as this private test network is a [free gas network](../../HowTo/Configure/FreeGas.md)
but the maximum amount of gas that can be used (the gas limit) for a value transaction must be at least 21000.
View the [Besu JSON-RPC APIs documentation](https://api.besu.hyperledger.org/) in the Postman format
and obtain example requests in multiple coding languages.
You can also run requests directly in Postman.
### Run requests
Click the ![Run in Postman](https://run.pstmn.io/button.svg){style="vertical-align: middle; height: 2em;"} button on the top right hand corned on [the Postman API documentation](https://api.besu.hyperledger.org/) to run the requests of the collection.
#### Run in Postman
Click the following button to fork the collection and run requests directly on your local network.
[![Run in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/11610746-f334929f-c8c3-43ed-bb73-69a6f0d728d8?action=collection%2Ffork&collection-url=entityId%3D11610746-f334929f-c8c3-43ed-bb73-69a6f0d728d8%26entityType%3Dcollection%26workspaceId%3Dc4b60b6f-9f15-42d0-8327-7ebabca6f0fd#?env%5BBesu%20node%20on%20local%20host%5D=W3sia2V5IjoicnBjLWh0dHAtaG9zdCIsInZhbHVlIjoibG9jYWxob3N0IiwiZW5hYmxlZCI6ZmFsc2V9LHsia2V5IjoicnBjLWh0dHAtcG9ydCIsInZhbHVlIjoiODU0NSIsImVuYWJsZWQiOmZhbHNlfV0=).
### Download collection
#### Download collection
Alternatively you can [download the JSON collection file](/postman/postman_collection.json).