Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

How to Architect a Hybrid Token Sale (Private/Public Phases)

A technical guide for building a single smart contract that manages both permissioned private and permissionless public fundraising phases.
Chainscore © 2026
introduction
GUIDE

How to Architect a Hybrid Token Sale (Private/Public Phases)

A hybrid token sale combines private and public distribution phases to optimize capital raising, community building, and price discovery. This guide explains the architectural components and smart contract patterns required to build a secure and compliant sale.

A hybrid token sale architecture strategically splits a token distribution into distinct phases, typically a private sale for accredited investors and a public sale for the broader community. This model allows projects to secure early funding and strategic partnerships in the private round, while using the public round to foster decentralization and broad token ownership. Key architectural goals include maintaining separate vesting schedules, implementing different pricing tiers, and ensuring a seamless user experience across phases. The smart contract system must enforce these rules transparently and securely on-chain.

The core of the architecture is a sale management contract that orchestrates the entire process. This contract holds the total sale allocation, defines phase parameters (start/end times, hard caps, price), and manages the whitelist for the private round. It interacts with a vesting contract to schedule token releases for private investors and team allocations. For the public sale, a fair launch mechanism like a Liquidity Bootstrapping Pool (LBP) or a fixed-price sale with a Dutch auction can be implemented to manage demand and price discovery. Using modular, audited contracts from libraries like OpenZeppelin for access control and security is a best practice.

Implementing phase-specific logic is critical. For the private sale, your contract must include a whitelist verification function, often using Merkle proofs for gas efficiency, as shown in the code snippet below. It should also handle different purchase methods, accepting both stablecoins (USDC, DAI) and the native chain currency (ETH, MATIC). The contract must calculate the correct token amount based on the phase's predefined price and enforce individual and phase-wide investment caps.

solidity
function purchasePrivateSale(uint256 amount, bytes32[] calldata merkleProof) external payable {
    require(isPrivateSaleActive, "Private sale not active");
    require(verifyWhitelist(msg.sender, merkleProof), "Not whitelisted");
    require(amount <= privateSaleHardCap, "Exceeds phase cap");
    // Process payment and mint/allocate tokens
}

Transitioning between phases requires careful state management. The sale contract should have pausable and upgradeable features (using proxies like UUPS) to handle emergencies or parameter adjustments before the public round begins. Once the private sale concludes, the contract must lock the private sale allocation and prepare the liquidity pool. A portion of the raised funds is typically paired with a percentage of the token supply to create initial liquidity on a DEX like Uniswap v3, with the LP tokens sent to a timelock contract to signal long-term commitment.

Security and compliance are paramount. Beyond standard audits, consider implementing a vesting cliff (e.g., 6-12 months) for private sale tokens to prevent immediate dumping post-public sale. Use a multisig wallet or DAO treasury to control the raised funds. For regulatory compliance, integrate with identity verification providers like Circle's Verite for the private round to ensure investor accreditation. Transparently documenting the tokenomics, vesting schedules, and fund allocation in the project's documentation builds trust with participants.

Finally, a successful hybrid sale requires robust off-chain infrastructure. This includes a secure investor portal for whitelist management, real-time dashboards to track sale progress, and integration with oracles like Chainlink for accurate price feeds if using dynamic pricing. Post-sale, the architecture should support seamless token claim functionality for both private investors (according to their vesting schedule) and public sale participants. Planning for this full lifecycle from the start ensures a smooth, professional token launch that aligns incentives between the project team, early backers, and the public community.

prerequisites
FOUNDATIONAL KNOWLEDGE

Prerequisites

Before architecting a hybrid token sale, you need a solid grasp of the core blockchain concepts and tools that form its foundation.

A hybrid token sale requires a strong technical foundation. You must understand smart contract development using Solidity (or your chosen language) and be proficient with a development framework like Hardhat or Foundry. This includes writing, testing, and deploying contracts. Familiarity with the ERC-20 token standard is non-negotiable, as your sale will mint or distribute tokens adhering to this specification. You should also understand key concepts like gas optimization, access control patterns (like OpenZeppelin's Ownable), and secure coding practices to prevent common vulnerabilities.

You'll need to decide on and set up your development environment. This includes choosing a blockchain network for deployment, such as Ethereum Mainnet, an Ethereum L2 like Arbitrum or Optimism, or another EVM-compatible chain. You must configure your project to interact with this network using tools like Alchemy or Infura for node access. Essential development dependencies include the OpenZeppelin Contracts library for secure, audited base contracts (e.g., for ERC-20, vesting, and access control) and a testing suite like Waffle or the built-in tools in Hardhat/Foundry.

Beyond pure development, you need to architect the economic and legal parameters of your sale. This involves defining clear tokenomics: total supply, allocation for private/public rounds, vesting schedules for team and investor tokens, and cliff periods. You must understand the regulatory considerations for your target jurisdictions, which may influence sale structure (e.g., use of SAFT agreements for private rounds). Planning for post-sale liquidity provisioning, often via a DEX like Uniswap, and understanding the associated mechanics (e.g., creating a pair, providing initial liquidity) is also a critical prerequisite.

contract-state-machine
ARCHITECTURE GUIDE

Designing the Unified Sale State Machine

A unified state machine coordinates private and public sale phases into a single, secure smart contract, simplifying user experience and treasury management.

A unified sale state machine consolidates multiple fundraising phases—like a private round and a public sale—into a single smart contract. This contrasts with deploying separate contracts for each phase, which fragments treasury management and complicates the user journey. The core architectural challenge is designing a finite state machine that transitions cleanly between phases (e.g., NOT_STARTED -> PRIVATE_SALE -> PUBLIC_SALE -> FINALIZED) while enforcing distinct rules for each. Key state variables include the current salePhase, total fundsRaised, and per-phase caps. This approach provides a single source of truth for the sale's progress and total raise.

The state machine's logic must enforce phase-specific access controls and pricing. For a private phase, you typically implement a merkle proof verification to allow only whitelisted addresses to contribute, often at a discounted rate. Transitioning to the public phase involves disabling the merkle root check and potentially updating the token price. Critical guards prevent invalid transitions; for example, the contract should revert if someone tries to move from PUBLIC_SALE back to PRIVATE_SALE. Using OpenZeppelin's ReentrancyGuard and implementing explicit onlyOwner modifiers for state transitions are essential security practices.

Here is a simplified skeleton of the core state management logic in Solidity:

solidity
enum SalePhase { NOT_STARTED, PRIVATE, PUBLIC, FINALIZED }
SalePhase public currentPhase;
bytes32 public privateMerkleRoot;
uint256 public publicPrice;
uint256 public privatePrice;

function contributePrivate(bytes32[] calldata merkleProof) external payable {
    require(currentPhase == SalePhase.PRIVATE, "Wrong phase");
    require(_verifyMerkleProof(merkleProof), "Not whitelisted");
    require(msg.value == privatePrice, "Incorrect amount");
    // Process contribution
}

function setPhasePublic() external onlyOwner {
    require(currentPhase == SalePhase.PRIVATE, "Must be in private phase");
    currentPhase = SalePhase.PUBLIC;
}

Accounting and token distribution are centralized within the unified contract. You must track contributions separately per phase to enable different vesting schedules or token release logic. A mapping like mapping(address => ContributorInfo) private contributions can store the amount, phase, and any claimed status. Upon sale finalization, the contract owner can withdraw the pooled ETH in a single transaction. For token distribution, the contract can hold the total token allocation and have a claim function that users call post-sale, with logic that calculates their entitlement based on their phase of participation. This eliminates the need for users to interact with multiple contracts to claim tokens.

Security considerations are paramount. The contract must be robust against front-running during phase transitions and ensure funds are safeguarded. Use pull-over-push for withdrawals to avoid reentrancy issues. Clearly document the state transition triggers (manual owner call, timestamp, or raise cap) and make them transparent on the frontend. Auditing the state machine logic, especially the conditions for moving between phases and the finalization step that locks the contract, is critical. A well-architected unified sale reduces operational overhead and provides a seamless, auditable fundraising mechanism for projects launching on Ethereum, L2s, or other EVM-compatible chains.

core-components
ARCHITECTURE

Core Contract Components

A hybrid token sale requires distinct smart contract modules to manage private allocations, public sales, and vesting. This section details the essential components.

01

Sale Configuration & Storage

The core contract stores immutable sale parameters and mutable state. Key data structures include:

  • Hard caps for private and public phases
  • Token prices (often in ETH/USDC) and accepted payment currencies
  • Start/end times for each phase
  • Total tokens allocated for sale
  • Real-time counters for tokens sold and funds raised

This module acts as the single source of truth, preventing configuration drift between phases.

02

Access Control & Phase Management

A state machine governs phase transitions (e.g., NOT_STARTED, PRIVATE, PUBLIC, FINISHED) with strict access control modifiers. Functions like buyPrivate or buyPublic are gated by:

  • onlyDuringPhase(Phase.PRIVATE)
  • onlyWhitelisted for private sales
  • nonReentrant guards

Use OpenZeppelin's Ownable or a role-based system like AccessControl to restrict admin functions for starting phases or pausing the sale.

04

Vesting Schedule Contract

Tokens from private sales are typically locked and released linearly. A separate vesting contract is deployed for each investor or batch. It handles:

  • Cliff period (e.g., 6 months with 0% release)
  • Linear vesting over a defined duration (e.g., 18 months)
  • Token claim function allowing users to withdraw unlocked amounts

Use a factory pattern to deploy individual vesting contracts, referencing the main sale contract for the token address.

05

Funds & Token Distribution

This module handles the secure movement of assets. Critical functions include:

  • Collecting payments in ETH or stablecoins to a designated treasury wallet.
  • Dispensing sale tokens to buyers immediately (public sale) or to their vesting contracts (private sale).
  • A withdrawFunds function for the owner to retrieve raised capital after the sale concludes.

Always use Pull-over-Push for withdrawals to avoid reentrancy and ensure the contract does not hold tokens indefinitely.

06

Security & Emergency Features

Incorporate safeguards to protect user funds and ensure contract integrity.

  • Pausable functionality to halt buys in case of critical bugs (use OpenZeppelin's Pausable).
  • Timelock for critical admin actions like changing the treasury address.
  • Cap enforcement to guarantee the sale cannot exceed its hard caps.
  • Refund mechanism (optional) for a failed sale, allowing users to reclaim their payment.

These features are non-negotiable for building trust and mitigating operational risks.

ARCHITECTURE

Private vs. Public Phase Configuration

Key technical and economic parameters for structuring a hybrid token sale's distinct phases.

Configuration ParameterPrivate Sale PhasePublic Sale Phase

Target Audience

VCs, Strategic Partners, DAOs

Retail, Community, General Public

Access Control

Typical Discount/Vesting

20-50% discount, 12-36 month cliff/linear

0-15% discount, 0-12 month linear

Minimum Commitment

$25k - $100k+

$100 - $1k

Sale Mechanism

SAFT/SAFE, Direct Transfer

LBP, Dutch Auction, Fixed-Price Swap

Primary Legal Framework

SAFT, Investment Agreement

Terms of Service, User Agreement

KYC/AML Requirement

Often required

Typical Allocation Size

10-40% of total supply

5-20% of total supply

access-control-implementation
SMART CONTRACT ARCHITECTURE

Implementing Phase-Specific Access Controls

A technical guide to designing a secure, multi-phase token sale contract with distinct rules for private, public, and team vesting periods.

A hybrid token sale requires a contract architecture that can enforce different rules for different participant groups and time periods. The core design pattern involves using access control modifiers and state variables to manage phases. Common phases include a private sale with a whitelist and lower price, a public sale open to all, and a vesting period for team and advisor tokens. The contract must prevent actions from occurring outside their designated phase, such as blocking public purchases during the private sale or halting all sales after the finalization phase.

The foundation is a phase management system. Implement an enum for sale states (e.g., NotStarted, PrivateSale, PublicSale, Finalized) and a state variable to track the current phase. Critical functions like buyTokens should use a modifier, onlyDuringPhase(Phase _phase), to restrict access. For the private phase, integrate a merkle proof whitelist. This gas-efficient pattern allows you to verify a user's inclusion in a pre-defined list without storing all addresses on-chain. Use OpenZeppelin's MerkleProof library to validate proofs submitted by users.

Here is a basic structural example of the phase and whitelist logic:

solidity
enum SalePhase { NotStarted, PrivateSale, PublicSale, Finalized }
SalePhase public currentPhase;
mapping(address => uint256) public privateWhitelist;
bytes32 public merkleRoot;

modifier onlyDuringPhase(SalePhase _phase) {
    require(currentPhase == _phase, "Sale: Wrong phase");
    _;
}

function buyPrivateSale(bytes32[] calldata _merkleProof, uint256 _amount) external payable onlyDuringPhase(SalePhase.PrivateSale) {
    bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _amount));
    require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Invalid proof");
    // Process purchase
}

function buyPublicSale() external payable onlyDuringPhase(SalePhase.PublicSale) {
    // Process public purchase
}

For vesting, implement a separate contract or internal accounting system. A typical linear vesting schedule releases tokens over time from a cliff date. Use a mapping to track each beneficiary's total allocated amount, amount released, and start timestamp. A release() function calculates the vested amount based on the elapsed time since the start. This function should be callable by the beneficiary, ensuring a pull-based mechanism that is more gas-efficient and secure than automatic pushes. Always include safety features like an emergency pause function (with timelock and multi-signature control) and a way for the owner to advance the sale phase securely.

Security is paramount. Common pitfalls include: incorrect phase transitions allowing purchases after finalization, whitelist bypasses due to flawed merkle tree generation, and vesting calculation errors from improper timestamp handling. Thoroughly test all state transitions and edge cases. Use established libraries like OpenZeppelin for access control (Ownable, AccessControl) and security utilities. Finally, consider implementing a hard cap per phase and individual purchase limits to prevent whale dominance and ensure fair distribution during the public sale.

pricing-and-caps-logic
GUIDE

How to Architect a Hybrid Token Sale (Private/Public Phases)

A hybrid token sale combines private investment rounds with a public launch, requiring careful design of pricing tiers and allocation caps to balance incentives and fairness.

A hybrid token sale architecture separates capital raising into distinct, sequential phases, typically a private sale for early investors followed by a public sale or launch. The core challenge is designing a pricing structure that rewards early risk while ensuring a fair public entry point. This is managed through a tiered pricing model, where the token price increases with each subsequent round. For example, a common structure might be: Seed Round at $0.05, Strategic Round at $0.10, and Public Sale at $0.15. Each tier has a hard-coded salePrice in the smart contract, preventing manipulation.

Allocation caps are critical for managing supply distribution and investor influence. Each tier has a maximum token allocation, often enforced by a maxPurchaseAmount per wallet or a total cap for the round. A Whitelist or merkle tree proof is typically used for private phases to gate access. Smart contracts must track cumulative purchases using a mapping like mapping(address => uint256) public contributions; to enforce per-wallet limits across phases. Without caps, a single entity could dominate the sale, harming decentralization and long-term token health.

The transition between phases must be automated and trustless. A common pattern uses a sale state variable (e.g., enum SaleState { Paused, Private, Public }) controlled by the contract owner or a timelock. The contract can automatically advance the state based on a block timestamp or when a tier's cap is reached. For security, funds raised in earlier rounds are often held in escrow within the contract until a successful public sale concludes, using a pattern like OpenZeppelin's Escrow or PullPayment to prevent premature access.

Implementing a linear vesting schedule for private sale tokens aligns long-term incentives. While public sale tokens may be liquid at launch, private investor tokens often unlock over 12-24 months with a cliff. This is managed off-chain via a vesting contract or using on-chain solutions like Sablier or Superfluid. The sale contract mints or transfers tokens to a vesting contract address, which then drips tokens to beneficiaries. This prevents large, immediate sell pressure (a "dump") on public markets post-launch, protecting retail participants.

Always conduct thorough testing and audits. Use forked mainnet environments with tools like Foundry or Hardhat to simulate the full sale lifecycle, including phase transitions, cap enforcement, and edge cases like early cap completion. Key security considerations include: preventing price manipulation, ensuring accurate access control, and safeguarding raised funds. Public verification of the contract code and sale parameters on block explorers like Etherscan builds essential trust with your community.

funds-and-token-distribution
TOKEN DISTRIBUTION

How to Architect a Hybrid Token Sale (Private/Public Phases)

A hybrid token sale combines a private round for strategic investors with a public sale, requiring careful smart contract design to manage vesting, pricing, and compliance.

A hybrid token sale structure is the industry standard for launching a new token, separating capital raises into distinct private and public phases. The private sale targets venture capital, strategic partners, and angel investors, offering discounted tokens with extended vesting schedules (e.g., 12-24 months with a cliff). The public sale, often conducted via a Fair Launch model, a Liquidity Bootstrapping Pool (LBP), or a fixed-price sale, aims for broader community distribution. The primary architectural challenge is managing these separate tranches within a single, secure, and auditable smart contract system while ensuring regulatory compliance for each investor type.

The core of the architecture is a Vesting Treasury contract. This contract holds the total supply of unsold and allocated tokens and releases them according to predefined schedules. For private investors, you deploy a VestingWallet contract (or use OpenZeppelin's implementation) for each investor or batch. This contract linearly releases tokens after a cliff period (e.g., 6 months of no tokens, then linear release over 18 months). Public sale participants typically receive tokens immediately or with a very short lock-up. The sale contract must enforce hard caps, individual caps, and use a secure price oracle or bonding curve for the public phase.

Smart contract security is paramount. Use established libraries like OpenZeppelin for access control (Ownable, AccessControl), vesting (VestingWallet), and pausability. Implement a timelock on the owner's ability to change critical sale parameters. For the public sale, consider using a battle-tested contract like a Merkle distributor for allowlists or a vetted auction contract (e.g., from Balancer for an LBP). All funds raised (ETH, USDC, etc.) should be sent to a multi-signature wallet controlled by the project's core team, never stored in the sale contract itself after the sale concludes.

A critical step is the Token Generation Event (TGE) and initial liquidity provision. After the public sale ends, you must calculate the final token allocations, deploy the vesting schedules, and transfer the liquid tokens to public buyers. Subsequently, a portion of the raised funds (e.g., for an Initial DEX Offering) is paired with a portion of the token supply to create a liquidity pool on a DEX like Uniswap V3. Use a liquidity locker (e.g., Unicrypt) to transparently lock these LP tokens for a set period (often 1+ years) to build trust and prevent a rug pull scenario.

Key metrics and post-sale management include tracking vesting schedules with a dashboard for transparency. Use a tool like Llama or a custom subgraph to allow investors to view their vesting status. Plan for the tax implications of vesting releases for both the project and investors. Finally, ensure clear, ongoing communication with your community regarding unlock schedules and treasury management to maintain trust throughout the token's lifecycle.

HYBRID TOKEN SALE ARCHITECTURE

Common Implementation Issues and Solutions

Architecting a hybrid token sale with distinct private and public phases introduces complex smart contract logic and operational challenges. This guide addresses frequent developer pain points, from state management to security vulnerabilities.

A common failure is allowing unauthorized state changes or creating unreachable states. Implement a clear, linear state machine using an enum and modifier.

solidity
enum SaleState { Setup, PrivateSale, PublicSale, Finalized }
SaleState public state;

modifier atState(SaleState _state) {
    require(state == _state, "Wrong sale state");
    _;
}

function startPublicSale() external onlyOwner atState(SaleState.PrivateSale) {
    state = SaleState.PublicSale;
    // Emit event, set timestamps, etc.
}

Critical checks: Ensure functions like buyTokens include the atState modifier. Never allow regressing to a previous state (e.g., from PublicSale back to PrivateSale) as it can invalidate prior participant allocations and create arbitrage opportunities.

HYBRID TOKEN SALE ARCHITECTURE

Frequently Asked Questions

Common technical questions and solutions for structuring a token sale with distinct private and public phases.

The primary difference is the access control and validation logic. A private sale contract typically uses a whitelist (e.g., a Merkle tree root stored on-chain) to verify participant eligibility during the buy function. A public sale contract often removes this restriction but may implement a hard cap per wallet or a global purchase limit to prevent sybil attacks. Architecturally, both often inherit from a base sale contract that handles common logic like token distribution, vesting schedules, and fund collection (ETH, USDC, etc.). This base contract pattern, using OpenZeppelin's Ownable and ReentrancyGuard, ensures reusable and secure code.

conclusion
IMPLEMENTATION

Conclusion and Next Steps

You have now explored the core architectural components of a hybrid token sale. This final section consolidates the key principles and outlines concrete steps for moving from design to deployment.

A successful hybrid sale architecture balances security, compliance, and user experience. The core design patterns you should implement include: a single Sale contract with distinct phase logic, a vesting module for team and investor tokens, a secure multi-signature treasury for raised funds, and a robust access control system using OpenZeppelin's Ownable or AccessControl. Always prioritize contract upgradability via proxies for post-sale adjustments, and ensure all price calculations and allocations are handled on-chain to prevent manipulation.

Your immediate next steps involve rigorous testing and security auditing. Begin by writing comprehensive unit and integration tests using frameworks like Hardhat or Foundry, simulating all sale phases and edge cases. Subsequently, engage a reputable smart contract auditing firm such as ChainSecurity, Trail of Bits, or CertiK. An audit is non-negotiable for establishing trust. Concurrently, prepare the necessary front-end interfaces for each participant: a whitelist portal for the private round and a public sale dashboard, ensuring they interact correctly with your contract's mint and claim functions.

Finally, plan your deployment and operational checklist. Deploy contracts to a testnet (like Sepolia or Goerli) for final integration testing with your front-end and backend systems. Key operational tasks include: configuring the multisig wallet addresses for the treasury and admin roles, pre-minting and allocating tokens to the vesting contract, and setting the precise startTime and endTime for each phase. Remember to verify and publish your source code on block explorers like Etherscan. A well-architected and transparent sale is a foundational step toward long-term project credibility and success.

How to Architect a Hybrid Token Sale (Private/Public Phases) | ChainScore Guides