From b14bbd2190583a668a4c46003e15c460ca538ea9 Mon Sep 17 00:00:00 2001 From: Nadezhda Popova Date: Tue, 14 Jan 2025 16:06:09 +0200 Subject: [PATCH 1/4] chore: blockscout example project Signed-off-by: Nadezhda Popova --- tools/blockscout-example/README.md | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/blockscout-example/README.md diff --git a/tools/blockscout-example/README.md b/tools/blockscout-example/README.md new file mode 100644 index 000000000..6322e7657 --- /dev/null +++ b/tools/blockscout-example/README.md @@ -0,0 +1,46 @@ +# Running the Relay with Blockscout + +## Step 1: Set Up the Relay with Localnode + +1. Ensure you have the **localnode** running with our relay. +2. In the `.env` file of the local node set the following variable to true: + + ```env + BATCH_REQUESTS_ENABLED=true +4. Run the project: + ```bash + npm run start +3. Stop the **hedera-explorer** process currently listening on port **8080**. You can do this using one of the following methods: + - If you are using Docker: + ```bash + docker stop hedera-explorer + ``` + - Alternatively: + ```bash + sudo lsof -i :8080 + sudo kill + ``` +## Step 2: Set Up Blockscout +1. Clone Blockscout repo + ```git + git clone git@github.com:blockscout/blockscout.git +2. Set these variables in `common-blockscout.env`: + ```env + ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:7546/ + ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:7546/ + NETWORK=Hedera + COIN_NAME=HBAR + COIN=HBAR + NFT_MEDIA_HANDLER_ENABLED=false +3. Make these changes in `docker-compose.yml` --> in `services` find `backend` and for the `environment` set the following: + ``` + environment: + ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:7546/ + ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:7546/ + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8546/ + CHAIN_ID: '298' +4. Build the project: + ```bash + cd ./docker-compose + docker-compose up --build +5. Open [http://localhost](http://localhost) \ No newline at end of file From ed6fe9b6948523d2c7031572076da4fe4590ce98 Mon Sep 17 00:00:00 2001 From: Nadezhda Popova Date: Wed, 15 Jan 2025 14:46:21 +0200 Subject: [PATCH 2/4] fixup! chore: blockscout example project Signed-off-by: Nadezhda Popova --- tools/blockscout-example/README.md | 47 +++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/tools/blockscout-example/README.md b/tools/blockscout-example/README.md index 6322e7657..68700dac0 100644 --- a/tools/blockscout-example/README.md +++ b/tools/blockscout-example/README.md @@ -2,28 +2,32 @@ ## Step 1: Set Up the Relay with Localnode -1. Ensure you have the **localnode** running with our relay. -2. In the `.env` file of the local node set the following variable to true: +1. In the `.env` file of the local node set the following variable to true: ```env BATCH_REQUESTS_ENABLED=true -4. Run the project: + ``` +2. In the `docker-compose.yml` file: +- add `BATCH_REQUESTS_ENABLED` to the envorment of the relay: + ``` + BATCH_REQUESTS_ENABLED: "${BATCH_REQUESTS_ENABLED}" + ``` + +- adjust the port of **hedera-explorer**: + ``` + ports: + - "9080:8080" + ``` + +3. Run the project: ```bash npm run start -3. Stop the **hedera-explorer** process currently listening on port **8080**. You can do this using one of the following methods: - - If you are using Docker: - ```bash - docker stop hedera-explorer - ``` - - Alternatively: - ```bash - sudo lsof -i :8080 - sudo kill - ``` + ``` ## Step 2: Set Up Blockscout 1. Clone Blockscout repo ```git git clone git@github.com:blockscout/blockscout.git + ``` 2. Set these variables in `common-blockscout.env`: ```env ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:7546/ @@ -32,6 +36,7 @@ COIN_NAME=HBAR COIN=HBAR NFT_MEDIA_HANDLER_ENABLED=false + ``` 3. Make these changes in `docker-compose.yml` --> in `services` find `backend` and for the `environment` set the following: ``` environment: @@ -39,8 +44,22 @@ ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:7546/ ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8546/ CHAIN_ID: '298' + ``` 4. Build the project: ```bash cd ./docker-compose docker-compose up --build -5. Open [http://localhost](http://localhost) \ No newline at end of file + ``` +5. Open [http://localhost](http://localhost) + +## API request example +[Blockscout JSON RPC & ETH Compatible RPC Endpoints](https://docs.blockscout.com/devs/apis/rpc) + +**curl example** for getting the balance of an address: + - blockscout doc: https://docs.blockscout.com/devs/apis/rpc/account#get-the-native-token-balance-for-an-address + - make sure to replace `instance_base_url` with `localhost` + - when testing different moduls make sure to give the correct value for `module` + - curl request: + ```bash + curl --location 'http://localhost/api?module=account&action=balance&address=0x05FbA803Be258049A27B820088bab1cAD2058871' + ``` From befae878517e2a298a61089a04de2a94b7fd97be Mon Sep 17 00:00:00 2001 From: Nadezhda Popova Date: Wed, 15 Jan 2025 15:40:01 +0200 Subject: [PATCH 3/4] fixup! fixup! chore: blockscout example project Signed-off-by: Nadezhda Popova --- tools/blockscout-example/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/blockscout-example/README.md b/tools/blockscout-example/README.md index 68700dac0..c40f64ddc 100644 --- a/tools/blockscout-example/README.md +++ b/tools/blockscout-example/README.md @@ -13,7 +13,7 @@ BATCH_REQUESTS_ENABLED: "${BATCH_REQUESTS_ENABLED}" ``` -- adjust the port of **hedera-explorer**: +- adjust the port of **hedera-explorer** in order to free up the default port on which blockscout is running: ``` ports: - "9080:8080" @@ -59,7 +59,8 @@ - blockscout doc: https://docs.blockscout.com/devs/apis/rpc/account#get-the-native-token-balance-for-an-address - make sure to replace `instance_base_url` with `localhost` - when testing different moduls make sure to give the correct value for `module` + - choose an `accountAddress` from one of the accounts that the local node generates upon starting - curl request: ```bash - curl --location 'http://localhost/api?module=account&action=balance&address=0x05FbA803Be258049A27B820088bab1cAD2058871' + curl --location 'http://localhost/api?module=account&action=balance&address={accountAddress}' ``` From c75bb23d5f14ec48367f5b2bc4c4211bc33384e3 Mon Sep 17 00:00:00 2001 From: Nadezhda Popova Date: Thu, 16 Jan 2025 17:18:08 +0200 Subject: [PATCH 4/4] fixup! fixup! fixup! fixup! chore: blockscout example project Signed-off-by: Nadezhda Popova --- tools/blockscout-example/README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/blockscout-example/README.md b/tools/blockscout-example/README.md index c40f64ddc..32e822db1 100644 --- a/tools/blockscout-example/README.md +++ b/tools/blockscout-example/README.md @@ -1,4 +1,15 @@ -# Running the Relay with Blockscout +# Blockscout + +BlockScout is an open-source blockchain explorer designed to provide users with a comprehensive interface for interacting with Ethereum-compatible networks, enhancing transparency and accessibility in blockchain ecosystems. It allows users to view and analyze blockchain data, including transactions, blocks, smart contracts, and token information, while providing real-time monitoring of transactions and block confirmations through a user-friendly interface and an API that enable both technical and non-technical users to easily interact with smart contracts and track various tokens and their transactions. + +- Documentation: https://docs.blockscout.com/ +- Repository: https://github.com/blockscout/blockscout/tree/master + +## Requirements +Local node repository needed +```bash +git clone git@github.com:hiero-ledger/hiero-local-node.git +``` ## Step 1: Set Up the Relay with Localnode @@ -7,7 +18,7 @@ ```env BATCH_REQUESTS_ENABLED=true ``` -2. In the `docker-compose.yml` file: +2. In the `docker-compose.yml` file in the local node: - add `BATCH_REQUESTS_ENABLED` to the envorment of the relay: ``` BATCH_REQUESTS_ENABLED: "${BATCH_REQUESTS_ENABLED}" @@ -58,7 +69,7 @@ **curl example** for getting the balance of an address: - blockscout doc: https://docs.blockscout.com/devs/apis/rpc/account#get-the-native-token-balance-for-an-address - make sure to replace `instance_base_url` with `localhost` - - when testing different moduls make sure to give the correct value for `module` + - when testing different modules make sure to give the correct value for `module` - choose an `accountAddress` from one of the accounts that the local node generates upon starting - curl request: ```bash