Table of contents
In a nutshell, Blockchain nodes keep a copy of the blockchain and offer an API that applications and users can use to query data from the blockchain or submit transactions.
Nodes can run different clients but the most common one is GoEthereum, or Geth.
Let's review how to install it and run some API queries.
GoEthereum is wrtiten in the Go programming language so that's actually required. To check if it's already isntalled in your system, run
go version in your terminal.
go command is not found, you can download and install it from here.
To install Geth, we'll also need Homebrew, which you can also install by running the command indicated in its homepage.
With Go and Homebrew installed, run the following commands to add the ethereum source to homebrew and install it.
brew tap ethereum/ethereum brew install ethereum
Once done, you can run
geth help to get a list of available commands.
If you want to install it in Windows or other systems, follow this installation guide
Other node clients
Using GoEthereum to query the node
In order to use Geth, we actually need a blockchain node to connect to. There are multiple node providers, but my go-to is Chainstack which has a free tier (✅), supports a ton of different blockchain protocols (✅), and offers nodes in multiple regions across the globe (✅) 😊
It's also super easy to use. Follow these links to:
Once we have our blockchain node access details, we can connect our local Geth client using
geth attach https://your-node-url/1234567890.
Once connected you can see all the available methods by running
web3.eth. You can, for example:
- query the current block number with
- get all the transactions from a specific block with
- get the details of a specific transaction with
- check the balance of a wallet with