Develop Eth Dapp
How to Quickly Develop a DApp on the Ethereum Blockchain Developing a DApp (Decentralized Application) on Ethereum can be fast and efficient if you use the right stack and strategy. Here’s a step-by-step technical guide:
Choose the Right Ethereum Development Stack
- Smart Contract Language: Solidity
- Development Framework: Hardhat or Foundry
- Frontend Framework: React + Ethers.js
- Wallet Integration: MetaMask
- Test Network: Goerli or Sepolia
- Node Provider: Alchemy , Infura , or QuickNode
- Blockchain Explorer: Etherscan
Set Up the Development Environment
npx create-react-app my-dapp cd my-dapp npm install ethers npm install --save-dev hardhat npx hardhat
Write and Compile the Smart Contract
// contracts/SimpleStorage.sol pragma solidity ^0.8.0; contract SimpleStorage { uint256 public data; function set(uint256 _data) public { data = _data; } function get() public view returns (uint256) { return data; } }
🛠 Compile:
npx hardhat compile
Deploy the Contract to Testnet
Create a deployment script (scripts/deploy.js):
const hre = require("hardhat"); async function main() { const SimpleStorage = await hre.ethers.getContractFactory("SimpleStorage"); const storage = await SimpleStorage.deploy(); await storage.deployed(); console.log("Contract deployed to:", storage.address); } main().catch((error) => { console.error(error); process.exitCode = 1; });
Connect Frontend with Ethers.js
import { ethers } from "ethers"; import SimpleStorageABI from "./SimpleStorage.json"; const contractAddress = "YOUR_CONTRACT_ADDRESS"; async function connectWallet() { if (window.ethereum) { await window.ethereum.request({ method: "eth_requestAccounts" }); const provider = new ethers.providers.Web3Provider(window.ethereum); const signer = provider.getSigner(); const contract = new ethers.Contract(contractAddress, SimpleStorageABI.abi, signer); // Example: call contract function await contract.set(123); const value = await contract.get(); console.log("Stored value:", value.toString()); } }
Develop Sui DApp
Codebox
Here is a sui transaction quick demo
Get Sui Provider
const chainName = 'suiMainnet'; const GlobalWallet = { register: (wallet) => { GlobalWallet[chainName] = wallet } } const event = new CustomEvent('wallet-standard:app-ready', { detail: GlobalWallet }); window.dispatchEvent(event); const provider = GlobalWallet[chainName]
Connect the wallet
window.bitkeep.suiWallet.connect()
Construct Transaction Data
import {Transaction} from "@mysten/sui/transactions"; const address = window.bitkeep.suiWallet.account.address tx.setSender(address) tx.setGasBudget(100000) const [coin] = tx.splitCoins({GasCoin: true}, [BigInt(this.amount)]) tx.transferObjects([coin], this.toAddress);
Sign and BoardCast
const feature = provider.features['sui:signTransaction'].signTransaction; const signature = await feature({transaction: tx})
Last updated on