public/subjects/blockchain/local-node-info
nprimo 4fa5c876a7 docs: run prettify and move h1 to h2 2023-06-09 09:17:48 +01:00
..
README.md docs: run prettify and move h1 to h2 2023-06-09 09:17:48 +01:00
networkInfo.png docs(blockchain): add blockchain branch subjects to public 2022-12-12 17:45:58 +00:00

README.md

Local Node Info

To start, we will create a simple page that displays basic information from our local node.

Instructions

Create a web page, localNodeInfo.html that loads an ethereum library, connects to a local node at http://localhost:8545 and displays basic information :

  • In an element with (id=chainId), the number ID of the current network
  • In an element with blockNumber as id the number of blocks in the chain

image

Hint

You can use any library such as ethers.js or web3.js to connect to your local node.

Automated tests check for elements with specific IDs, the design is up to you.

Minimal structure:

<!DOCTYPE html>
<body>
  <span id="chainId"></span>
  <span id="blockNumber"></span>

  <script src="XXX"></script>
  <script type="module">
    // Your code
  </script>
</body>
</html>

Notions