# Building Web3 Applications on Decentralized Edge Computing:  A Hong Kong Case Study

## Introduction

The evolution of cloud computing is taking an exciting turn towards decentralization, particularly in the Web3 space. In this technical exploration, we'll dive into how we leveraged a decentralized edge computing platform across Hong Kong and the Greater Bay Area (GBA) to deploy and test Web3 applications.

Infrastructure Setup:\
Our decentralized cloud infrastructure consists of three crucial nodes:
-----------------------------------------------------------------------

1. **IPFS Node**: Handles decentralized storage
2. **Optimistic (OP) Node**: Manages Layer 2 to Layer 1 operations
3. **Ethereum Node**: Interfaces with the Ethereum blockchain

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FXLRASHgelLKWSc8oGBeH%2Fimage.png?alt=media&#x26;token=af265625-596c-47e7-96f6-a0cdd267c3b3" alt=""><figcaption></figcaption></figure>

#### 3 x compute nodes builded from A-Field Tech Cloud Console

{% hint style="info" %}
Each node has both private and public network addresses. Backend transactions occur within the private network, while the public addresses are used for frontend access.
{% endhint %}

## Setup - Architecture

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FV4xoWQKo1IeRUHOrZ5md%2Fimage.png?alt=media&#x26;token=610ae249-5e0b-4d9d-984c-842165ea5dd5" alt=""><figcaption></figcaption></figure>

## Setup - High Level Flowchart

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2Fkg67dRCorEnUOX5IakBi%2Fimage.png?alt=media&#x26;token=b49122bc-c444-4820-a310-ae51affebd21" alt=""><figcaption></figcaption></figure>

## Test Case Analysis:

1. **Upload Flow:**&#x20;

* Frontend initiates file upload&#x20;
* Backend processes the file and interfaces with IPFS
* IPFS generates and returns a unique hash&#x20;
* Smart contract on op-sepolia chain records the transaction
* Process completes with frontend confirmation&#x20;

2. **Verification Flow:**&#x20;

* User inputs IPFS hash via frontend
* Backend queries OP-node for timestamp verification&#x20;
* Timestamp data is formatted and returned to frontend&#x20;
* Provides proof of existence and timing verification

## The Setup

#### We have 3 nodes ready, and we can deploy the Smart Contract via the OP node

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FzTQjxz33OMduMJo3W5ua%2Fimage.png?alt=media&#x26;token=021dcb15-23fe-4286-a61c-401e24482c13" alt=""><figcaption></figcaption></figure>

#### Next, we set up a test frontend HTML page & frontend script on our testing server to implement file [upload and verification functions](#test-case-analysis).

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2Fb0MgJpRx8om9djgdb3T7%2Fimage.png?alt=media&#x26;token=e982cc66-adc5-4a3e-af56-04d30272b507" alt=""><figcaption></figcaption></figure>

#### Frontend script&#x20;

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FZy4fivlHqtsLg0RyucCg%2Fimage.png?alt=media&#x26;token=5edb7634-43a3-4e46-a20d-294ebf4e070b" alt=""><figcaption></figcaption></figure>

#### Then, we prepared a backend script that configures the essential connections: the IPFS node location, the deployed smart contract address, and the OP (Optimism) node endpoint.

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FAy5sOYq3rquP7ayRHsnV%2Fimage.png?alt=media&#x26;token=c9d83da0-48be-4871-8a0f-69cd0d24efd5" alt=""><figcaption></figcaption></figure>

#### Next, on our Ethereum node, we enabled the HTTP ports to listen for and monitor incoming transactions.

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2F9Q5XwKkEwgX8zkFgLkoD%2Fimage.png?alt=media&#x26;token=d0a5b688-88fd-4ca9-b2f3-4345c48a5e30" alt=""><figcaption></figcaption></figure>

#### Then, on our Optimism node, we enabled HTTP ports for the OP-Sepolia chain and configured it to connect to our Ethereum node through the private network.

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FaOqPMYP2iFq4S3GeLEal%2Fimage.png?alt=media&#x26;token=d78910f7-bc64-49ea-ad2d-31251fd2dbc2" alt=""><figcaption></figcaption></figure>

#### For the IPFS node configuration, we set up the API listening address and configured the gateway address using our public IP, allowing file uploads from the internet. The gateway enables external access to the IPFS node.

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FV0WhAoUXnLiMRNJtbrUz%2Fimage.png?alt=media&#x26;token=07d6eaed-2cc4-44ad-8ad9-5d5f6ebf3c54" alt=""><figcaption></figcaption></figure>

## Testing 1 Results

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2Fs6fzZ9M1hrg92xxatgqF%2Fimage.png?alt=media&#x26;token=594af6cd-8ad1-436a-a509-bbd6d332dcbc" alt=""><figcaption></figcaption></figure>

The file upload process worked successfully:

1. The file was uploaded to IPFS
2. The transaction passed through our smart contract
3. The Optimism node relayed the Layer 2 (L2) to Layer 1 (L1) operations to the Ethereum node
4. The system successfully returned the IPFS hash

## Testing 2 Results

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FyQ9MxLh26mE6eliyZj1E%2Fimage.png?alt=media&#x26;token=87f94821-7fc6-4804-b05d-3432a141db44" alt=""><figcaption></figcaption></figure>

We completed the verification process:

1. Copied the returned IPFS hash
2. Sent the verification request to the blockchain through the Optimism node to the Ethereum node
3. Successfully received the timestamp confirmation from the blockchain

### Key Advantages:

1. **Geographic Distribution**: With 30+ edge locations, applications benefit from reduced latency and improved regional access
2. **Decentralized Architecture:** True to Web3 principles with distributed storage and computation
3. **Regional Focus:** Optimized for Hong Kong and GBA markets to reach global network
4. **Development Flexibility:** Supports local development environments that can seamlessly transition to production

## Conclusion

This infrastructure demonstrates how decentralized edge computing can effectively support Web3 applications while maintaining the benefits of traditional cloud services. The setup provides a robust foundation for dApps requiring high availability, low latency, and regional compliance.

## Our Web 3 Use Cases

<figure><img src="https://1188029870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBUyOiZPbX6em9olmY0K%2Fuploads%2FCiEoziTsHNiAbqIIaJm8%2Fimage.png?alt=media&#x26;token=a1ef3d7d-de0f-420e-99af-d5c6f6f5485a" alt=""><figcaption></figcaption></figure>

### Decentralized Document Verification System

* Use Case: Legal document authentication in Hong Kong's financial sector
* Implementation:
  * Documents uploaded through the Upload flow
  * IPFS ensures immutable storage
  * Smart contract on op-sepolia maintains verification records
  * Verification flow provides timestamp proof
* Benefits: Reduces document fraud, provides audit trail, complies with regulatory requirements

### NFT Marketplace with Regional Focus

* Use Case: Digital art marketplace for GBA artists
* Implementation:
  * Artwork files stored via IPFS
  * Metadata and ownership recorded on-chain
  * OP node ensures cost-effective transactions
  * Verification system confirms authenticity
* Benefits: Lower gas fees, faster transactions, regional content delivery

### Supply Chain Traceability

* Use Case: GBA manufacturing verification
* Implementation:
  * QR codes linked to IPFS hashes
  * Timestamp verification for production milestones
  * Smart contracts managing supply chain states
  * Edge nodes ensuring real-time data availability

### Digital Identity Management

* Use Case: Cross-border identity verification in GBA
* Implementation:
  * Encrypted identity documents stored on IPFS
  * Verification flow for identity checks
  * Smart contracts managing access control
  * Edge compute ensuring data sovereignty

### Decentralized Content Distribution

* Use Case: Video streaming platform for Hong Kong content creators
* Implementation:
  * Content stored on IPFS
  * Edge nodes optimizing content delivery
  * Smart contracts managing access rights
  * Verification system for copyright protection
* Benefits: Reduced bandwidth costs, improved loading times, content authenticity


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.a-fieldtech.com/a-fieldtech-docs/tech-blog/this-is-the-a-field-tech-tech-blog/building-web3-applications-on-decentralized-edge-computing-a-hong-kong-case-study.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
