Blockchain 22 min read

Build a Decentralized HPC Token on Ethereum: Step‑by‑Step Web3.0 Tutorial

This article introduces Web 3.0 concepts, explains blockchain architecture and Ethereum fundamentals, then walks through creating an ERC‑20 HPC token, setting up a Geth client, writing and deploying Solidity contracts, and building a MetaMask‑enabled front‑end deployed on IPFS.

ELab Team
ELab Team
ELab Team
Build a Decentralized HPC Token on Ethereum: Step‑by‑Step Web3.0 Tutorial

Preface

Web 3.0, coined by Ethereum co‑founder Gavin Wood in 2014, refers to a decentralized online ecosystem built on blockchain and represents the next generation of the Internet.

Blockchain Overview

Blockchain Architecture

Blockchain is a decentralized distributed ledger composed of six layers: data, network, consensus, incentive, contract, and application.

Data Layer: stores blocks, each containing a block header, size, transaction count, and recent transactions. It uses a chain of blocks and a Merkle tree for tamper‑evidence.

Block and transaction data can be viewed on Bitcoin Explorer or Etherscan .

Network Layer: a peer‑to‑peer (P2P) network without central servers; nodes exchange and verify data.

Consensus Layer: enables distributed nodes to agree on block validity (e.g., PoW, PoS).

Proof‑of‑Work (PoW) requires miners to find a nonce so that the block hash is below a target; Bitcoin uses PoW, Ethereum migrated from PoW to PoS for faster, lower‑cost transactions.

Incentive Layer: rewards miners (e.g., Bitcoin block reward halves every four years, Ethereum rewards via gas fees).

Contract Layer: scripts and smart contracts give blockchain programmability. Bitcoin scripts are limited; Ethereum provides a Turing‑complete language (Solidity) running on the EVM.

Application Layer: hosts various blockchain applications (see “90+ #Ethereum Apps You Can Use Right Now”).

Ethereum Introduction

Accounts and Wallets

Ethereum has externally owned accounts (controlled by private keys) and contract accounts (no private key, contain contract code). Wallets manage keys, not funds.

Creating an external account generates a public‑private key pair; the address is the hash of the public key. Sig=Fsig(Fkeccak256(m) , k) Signature consists of (r, s). Verification checks the signature against the public key and returns true on success.

Ether and Gas

Ether (ETH) is the native currency; 1 ETH = 10¹⁸ wei. Gas is a separate unit used to pay transaction fees and limit resource consumption.

Client

Geth is the official Go implementation of an Ethereum client. It can run as a full node or a light node and provides JSON‑RPC APIs (e.g., web3.js).

Smart Contracts

Smart contracts are immutable programs stored on the blockchain. They are deployed via a special transaction to address 0x000…000. Solidity is the common language.

Tokens

Tokens are abstract assets on the blockchain. ERC‑20 defines fungible tokens; ERC‑721 defines non‑fungible tokens (NFTs).

Web 3.0 Overview

From Information Internet to Value Internet

Web 1.0 (1990‑2004) was a read‑only information network dominated by browsers and search engines. Web 2.0 introduced user‑generated content and centralized platforms. Web 3.0 aims for decentralization, permissionless access, native cryptocurrency payments, and trustless incentives.

Web 2.0 vs. Web 3.0 Development Paradigms

Web 2.0 requires login/registration, databases, and centralized servers for front‑end and back‑end code.

Web 3.0 uses wallet‑based login, stores front‑end assets on IPFS/arweave, runs business logic in on‑chain smart contracts, and accesses historical data via TheGraph.

Practical Example: Decentralized HPC Token Trading System

Install Client & Generate Accounts

Install Geth on macOS:

brew tap ethereum/ethereum
brew install ethereum

Create two test accounts with Clef:

mkdir -p geth-config/keystore
clef newaccount --keystore geth-config/keystore  # run twice

Start Clef and Geth (Goerli testnet, chain ID 5):

clef --keystore geth-config/keystore --configdir geth-config/clef --chainid 5
geth --datadir geth-config --signer=geth-config/clef/clef.ipc --goerli --syncmode light --http --http.api "eth,debug"

Attach to the node: geth attach http://127.0.0.1:8545 Obtain test ETH from a Goerli faucet.

Develop Smart Contract (Server‑Side Code)

Write an ERC‑20 contract in Solidity (e.g., HippoCoin.sol) and compile: solc --bin --abi HippoCoin.sol Deploy the contract using web3.js in the Geth console and test minting and transfers:

hpcContract = new eth.Contract(abi, '0x74fe09b3ba8adea31f6448f4c742e9148a262d9b')
hpcContract.mint('0xEC30B4dAec9B113E5009a2259e7A4f201aE1D709', 200000, {from: '0xEC30B4dAec9B113E5009a2259e7A4f201aE1D709'})
hpcContract.transfer('0xEC30B4dAec9B113E5009a2259e7A4f201aE1D709', 500, {from: '0xEE45cE18A60C2Df0B092185Ca4C0B483018FB07B'})

Develop Front‑End Page

Use MetaMask to sign transactions. Request the connected account:

export const requestMetamaskAccount = async () => {
  if (!ethereum) return;
  const accounts = await ethereum.request({ method: "eth_accounts" });
  if (accounts.length === 0) currentAccount = null;
  else if (accounts[0] !== currentAccount) currentAccount = accounts[0];
  return currentAccount;
};

Send a token transfer:

const contractAddress = '0x74FE09B3bA8AdEa31f6448f4c742e9148A262d9b';
const abiInterface = new utils.Interface(abi);
const functionData = abiInterface.encodeFunctionData("transfer", [toAddress, parseInt(amount)]);
const transactionParameters = {
  nonce: "0x00",
  gasPrice: "0x94810dee",
  gas: "0x8a82",
  to: contractAddress,
  from: account,
  value: "0x00",
  data: functionData,
  chainId: "0x5"
};
const txHash = await ethereum.request({ method: "eth_sendTransaction", params: [transactionParameters] });

Bundle static assets with webpack and deploy the page to IPFS.

References

《精通以太坊:开发智能合约和去中心化应用》

Various online articles and documentation listed in the original source.

smart contractsSolidityWeb3EthereumToken Development
ELab Team
Written by

ELab Team

Sharing fresh technical insights

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.