Blockchain Auction Contract Development

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1 servicesAll 1306 services
Blockchain Auction Contract Development
Medium
~3-5 business days
FAQ
Blockchain Development Services
Blockchain Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1215
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1043
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823

Development of Blockchain Auction Contracts

A blockchain auction is not just "accept bids and determine the winner". The openness of EVM state makes auction mechanics vulnerable to manipulations impossible in traditional systems. Front-running of bids via MEV, gas wars in the final seconds, griefing through ETH lockup of outbidders — each of these vectors requires an architectural solution, not just a require check.

Auction Mechanics: English vs Dutch

English Auction (ascending price)

Classic: price rises, the last bid wins. For NFTs and tokens — the most common format. The main technical problem is last-minute sniping and front-running.

In unprotected Ethereum auctions, a bot sees the final bid transaction in the mempool and inserts its own with a high gas priority fee. Solution — time extension: if a bid arrives in the final N minutes before the deadline, the auction extends automatically:

if (block.timestamp > auctionEnd - timeBuffer) {
    auctionEnd = block.timestamp + timeBuffer;
    emit AuctionExtended(auctionId, auctionEnd);
}

timeBuffer is typically 10-15 minutes. This is exactly how the Nouns DAO auction is structured — one of the most technically correct public implementations.

Dutch Auction (descending price)

Price starts high and decreases over time. Participant pays the current price and immediately receives the asset. Used for token sales (Gnosis Protocol, some NFT drops).

Key parameter is the price decline curve. Linear curve:

function getCurrentPrice() public view returns (uint256) {
    if (block.timestamp >= endTime) return reservePrice;
    uint256 elapsed = block.timestamp - startTime;
    uint256 totalDuration = endTime - startTime;
    uint256 priceDrop = startPrice - reservePrice;
    return startPrice - (priceDrop * elapsed / totalDuration);
}

Exponential curve is more realistic for market pricing, but more expensive in gas due to exp() — usually approximated via lookup table or piecewise linear.

Problems We Solve

Gas wars and griefing via refund

In standard English Auction implementation, the previous bid is returned when outbid:

// Dangerous pattern
payable(previousBidder).transfer(previousBid);

If previousBidder is a contract with a fallback that always revert, the entire auction is blocked. This is a classic DoS via gas griefing.

Solution — pull payment pattern: instead of automatic return, store pending withdrawals in a mapping and let the user withdraw ETH themselves:

mapping(address => uint256) public pendingReturns;

function bid() external payable {
    // ...
    pendingReturns[previousBidder] += previousBid;
    // new bid accepted, old one not returned automatically
}

function withdraw() external {
    uint256 amount = pendingReturns[msg.sender];
    if (amount == 0) revert NothingToWithdraw();
    pendingReturns[msg.sender] = 0; // clear before transfer (reentrancy guard)
    (bool ok,) = payable(msg.sender).call{value: amount}("");
    if (!ok) revert TransferFailed();
}

Commitment scheme against front-running

For auctions where bid secrecy matters until closing (sealed-bid auction), use commit-reveal:

  1. Commit phase: participant sends keccak256(abi.encode(bid, salt, address)) — hash of the bid
  2. Reveal phase: participant reveals the actual bid and salt, contract verifies the hash
  3. Winner is determined only after reveal

Limitation: participant can fail to reveal if they understand they lost. Solution — deposit a bond during commit, which is burned if absent from reveal (anti-griefing bond).

Reentrancy in multi-lot auctions

With parallel auctions (marketplace with multiple lots), reentrancy via ETH refund is especially dangerous. Use ReentrancyGuard from OpenZeppelin or strictly follow checks-effects-interactions pattern:

// Checks
require(bid > currentHighestBid + minBidIncrement);
// Effects — update state BEFORE external calls
highestBid = bid;
highestBidder = msg.sender;
pendingReturns[previousBidder] += previousAmount;
// Interactions — only after
emit BidPlaced(msg.sender, bid);

Stack and Tools

We develop in Solidity 0.8.x with Foundry. We test with mainnet fork via vm.createFork — this lets us verify interaction with real NFT contracts (ERC-721, ERC-1155) and Chainlink price feeds for bid denomination.

Fuzzing via forge fuzz is mandatory for price calculation functions — especially for Dutch Auction with decline curves where there's risk of integer overflow at extreme timestamp values.

NFT auctions standardly support ERC-721 and ERC-1155 via IERC721.safeTransferFrom / IERC1155.safeTransferFrom. The auction contract acts as escrow — holds the NFT from listing to completion and transfers to the winner.

Work Process

Analysis. Define auction type, assets (NFT/tokens/real assets), target chain (Ethereum mainnet, Polygon, Arbitrum), bid privacy requirements.

Design. Choose bid return mechanics (pull vs push), anti-griefing mechanisms, time extension parameters. If multiple auction types — design modular architecture with base contract.

Development and Testing. Foundry tests with 95%+ coverage. Mandatory: fork tests with real mainnet state, fuzz tests on price functions, invariant tests to verify invariants (sum of all pending returns ≤ contract balance).

Deployment. Verification on Etherscan/Polygonscan. For NFT marketplace auction — integrate with frontend via wagmi/viem.

Timeline Guidelines

Single auction contract (English or Dutch): 3-5 days including tests. Multi-lot marketplace with both auction types and commit-reveal: 2-3 weeks.