Ethereum Smart Contract Development: From Solidity to Production dApp
Smart contracts are the foundation of decentralized applications on Ethereum.
Setting Up Your Development Environment
npx hardhat init
npm install @nomicfoundation/hardhat-toolbox ethersWriting a Marketplace Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
contract Marketplace is AccessControl, ReentrancyGuard {
struct Listing { address seller; uint256 price; bool active; }
uint256 private listingCounter;
mapping(uint256 => Listing) public listings;
function createListing(uint256 price) external returns (uint256) {
listingCounter++;
listings[listingCounter] = Listing(msg.sender, price, true);
return listingCounter;
}
function buyListing(uint256 id) external payable nonReentrant {
Listing storage l = listings[id];
require(l.active && msg.value == l.price);
l.active = false;
payable(l.seller).transfer(msg.value);
}
}Testing with Hardhat
import { expect } from 'chai'
import { ethers } from 'hardhat'
describe('Marketplace', function () {
it('Should create a listing', async function () {
const Factory = await ethers.getContractFactory('Marketplace')
const marketplace = await Factory.deploy()
await marketplace.createListing(ethers.parseEther('1.0'))
const listing = await marketplace.listings(1)
expect(listing.price).to.equal(ethers.parseEther('1.0'))
})
})Frontend Integration with wagmi
Connect your contract to Next.js using wagmi hooks for read/write operations and RainbowKit for wallet connection.
The Bottom Line
The Dapp Starter Kit from BreafIO provides a complete frontend with wallet connection and contract hooks. The NFT Marketplace Pro includes marketplace integration. The DAO Governance App provides governance patterns. The Blockchain Explorer tracks on-chain data, and the Web3 Auth Kit handles authentication.
Related Template
Try this production-ready starter kit to build your project faster.
Total Templates
24
+6 this month
Total Downloads
18.3K
+4.2K
Avg Rating
4.7 ★
+0.2
Active Users
2,450
+380
Available Templates
DeFi Lending
Full lending/borrowing dApp
NFT Marketplace
ERC-721 marketplace with auctions
DAO Governance
Voting & treasury management
Token Launchpad
Fair launch + vesting schedules
Staking dApp
Staking with reward pools
Crowdfunding
Cross-chain crowdfunding
dApp Starter Kit
Build dApps from zero to launch
Ready to Build?
Get started with our production-ready starter kits and ship your project faster.
Browse Starter Kits