What is B Zero X?

B Zero X is a revolutionary DeFi protocol that combines proof-of-work mining with Uniswap v4 liquidity provision, creating a sustainable ecosystem for yield generation through mining rewards and liquidity staking.

Protocol Overview

B Zero X represents the next evolution in decentralized finance, integrating proof-of-work consensus mechanisms with advanced liquidity provisioning strategies. Built on top of Uniswap v4's hook system, our protocol enables users to earn rewards through multiple mechanisms while maintaining decentralization and security.

Key Features

  • Proof-of-Work Mining: Mine B0x tokens using computational power, ensuring fair distribution
  • Uniswap v4 Integration: Advanced hooks for optimized liquidity provisioning
  • Token Conversion: Seamless conversion between B0x and 0xBitcoin
  • Token Bridging: Use Ethereum or Base Blockchain and bridge between them
  • Staking Rewards: Earn continuous rewards through liquidity provision
  • Permissionless Access: No gatekeepers, fully decentralized protocol

Architecture

The B Zero X protocol consists of several interconnected smart contracts that work together to provide a comprehensive DeFi experience. The core components include mining contracts, liquidity management, and reward distribution systems.

Proof of Work Mining
Mine B0x tokens using computational power, ensuring true decentralization and fair distribution without pre-mines or ICOs.
Uniswap v4 Integration
Leverage advanced hooks to optimize liquidity provisioning and maximize yield generation through automated strategies.
Token Conversion
Seamlessly convert between B0x and 0xBitcoin tokens with a never ending 100% reverseable and option conversion!
Staking Rewards
Earn continuous rewards by staking your tokens in our optimized liquidity pools with dynamic APY.

Uniswap v4 Staking Pool

Advanced liquidity staking mechanism built on Uniswap v4's hook architecture for optimized yield generation.

Pool Architecture

Our Uniswap v4 staking pools utilize custom hooks to enhance liquidity provision with additional liquidity optimizations for fees per swap.

Features

  • Adjustable Fee for Uniswap Pool
  • Dynamic fee optimization
  • Multi Token Support
  • Start new staking periods seemlessly
  • 45 Day Staking Periods
  • Variable Decaying Withdraw Fee to prevent abuse

Supported Pairs

  • B0x/0xBitcoin

Proof of Work Contract

Decentralized mining mechanism for B0x token distribution using computational proof-of-work consensus.

Mining Algorithm

B Zero X uses a modified proof-of-work algorithm optimized for fair distribution and energy efficiency. The mining difficulty adjusts automatically to maintain consistent block times.

Technical Specifications

  • Algorithm: Keccak256-based hash function
  • Block Time: ~10 minutes average
  • Difficulty Adjustment: Every 2016 epochs or 14 days + 1 mint or 256 mints and 7 days + 1 mint
  • Max Supply of B0x: 32,500,000 B0x tokens
  • Max Mined Supply (0xBTC + B0x Mining): 21,000,000 B0x tokens
  • Halving: Every 210,000 Epochs

Mining Process

Miners compete to solve cryptographic puzzles by finding nonces that produce hash values meeting the current difficulty target. Successful miners receive newly minted B0x tokens as rewards. The Uniswap v4 Liquidity Staking Contract also recieves 1:1 what miners make.

Mainnet Deployments

COMING SOON! Production smart contract addresses and deployment details for the Ethereum mainnet.

Contract Addresses

B0x Token
Main B0x ERC-20 token contract
0x0123123123213
B0x Mining Contract
Proof-of-work mining implementation
0x0123123123213
LP Rewards Pool
Liquidity provider reward distribution
0x0123123123213
Uniswap v4 Hook
Custom hook for enhanced functionality
0x0123123123213

Testnet Deployments

Test network contract addresses for development and testing purposes.

Base Sepolia Testnet

B0x Token
B0x on Base Sepolia Testnet
0xb379A851AC41bcDF0c2564b88916B10E5A08daAe
🔍 View on BaseScan
0xBitcoin Token
0xBTC on Base Sepolia Testnet
0x4b20b6e9b678b111Dcc365EaD92b3277B178FB74
🔍 View on BaseScan
Proof of Work / Mining
Mining Address on Base Sepolia Testnet
0x925C42A57328FD8a7b07ecA444A34963e07C8999
🔍 View on BaseScan
B0x Token Uniswap LP Staking
Liquidity Pool Staking Contract on Base Sepolia
0x3eA249809f032b1F5AE7B1Dd4986490d05eE2dC2
🔍 View on BaseScan
B0x Uniswap Router
Router on Base Sepolia Testnet
0xc728AF6267315b5CB7669D7DC4F87f5174adabE8
🔍 View on BaseScan
Position Finder Pro
Finds Uniswap and Staking Positions
0x3418c003F43FbA5Ce8f69041a49EF7cb4d1d6a58
🔍 View on BaseScan
Hook Address for Uniswap
Hook for Uniswap on Base Sepolia
0x794B1409ef4b40a90eC8AF62EaF4c8bf275e5000
🔍 View on BaseScan
RightsTo0xBitcoin Token
RightsTo0xBTC on Base Sepolia Testnet
0x4A437511e57f69507386B5866D48668884F63cbB
🔍 View on BaseScan
UniswapV4PoolCreator
Creates our Uniswap Dynamic Fee Custom Hook Address Pool For B0x/0xBTC
0x24984FF72AA6bB298Ea7F369E36116F054642697
🔍 View on BaseScan

🚀 B0x Token Miner Setup

Complete guide to get your miner up and running

📋 Prerequisites

1
Update Graphics Drivers: Install the latest NVIDIA graphics drivers from the official NVIDIA website
2
Install .NET 6.0: Download and install .NET 6.0 Runtime from Microsoft's official site

⬇️ Download Miner

Choose your operating system and download the appropriate miner:

🪟 Windows Miner

For Windows 10/11 users

Download Windows Miner

🐧 Ubuntu Miner

For Ubuntu 20+ users

Download Ubuntu Miner

⚙️ Configuration Setup

3
Extract Files: After downloading, extract the .zip file contents to your desired location.
4
Configure Settings: Navigate to the B0x Token Miner folder and open B0xToken.conf file. Edit the following settings:
"minerAddress": "0xF2E00a6DbA02eD1115e5BEf3CcD7B5dD47141dDC", "privateKey": "0xf7a41f2d35af57da25aa46c3e0ac4fd7e83bd900d45851750026d2afe4e10190",
⚠️ Important: Replace with your Base Sepolia Blockchain account that has Base Sepolia ETH in it. Using this exposed key will result in loss of funds. ESPECIALLY TRUE ON MAINNET - using the included testnet key will result in loss of funds, you must supply your own private key and address for mining!

Optional Configuration Parameters:

"mintToAddress": "",

mintToAddress: Optional. If you want tokens minted to a different address. Overpayment ETH will also go to this address.

"MaxSolvesperMint": 15, "MinSolvesperMint": 3,

MaxSolvesperMint: Maximum number of solves before submitting a transaction.
MinSolvesperMint: Minimum number of solves before submitting (lower is better).

"Difficulty_Multiplier": 1,

Difficulty_Multiplier: Work at higher difficulties for more reward per mint. Suggested: 2-5 at start, then 1 after 1000 difficulty.

"minSecondsPerAnswer": 0, "maxUSDperToken": -0.02055,

maxUSDperToken: Maximum USD you plan to spend per B0x token (negative means it costs money to mint - this is normal).

Network Configuration (Testnet):

"web3api": "https://sepolia.base.org", "contractAddress": "0x925C42A57328FD8a7b07ecA444A34963e07C8999", "chainID": 84532,

💰 Get Test ETH & Bridge to Base Sepolia

5
Get Sepolia ETH: First, get Sepolia ETH from the faucet, then bridge it to Base Sepolia.
⏱️ Wait Time: After bridging, wait approximately 5 minutes for Base Sepolia ETH to appear in your wallet.

🚀 Start Mining

🪟

Windows Instructions

  1. Double-click AStartMiner.bat
  2. The system will verify all components are installed correctly
  3. The miner should start automatically!
  4. Check the logs for easy monitoring
🐧

Ubuntu Instructions

  1. Right-click on 1RunThisToMineB0xToken.sh
  2. Select "Properties" "Permissions"
  3. Enable "Allow executing file as program"
  4. Double-click the file and select "Run in terminal"

Alternative: Open terminal in the directory and run:
./1RunThisToMineB0xToken.sh

🎉 Congratulations!

You're now mining B0x Tokens!

Monitor the logs to track your mining progress and earnings.

🏆 B0x LP Rewards Contract

Uniswap V4 NFT Position Staking with Multi-Token Rewards System

🎯 Contract Overview

Purpose: Stake Uniswap V4 LP NFTs to earn multi-token rewards
Supported Pairs: B0x/0xBitcoin Full-Range Positions Only
Timelock System: Withdrawal penalties from 20% to 3% over 15 days
⚠️ MAINNET DEPLOYMENT NOTES
  • Update addressWETH for each chain deployment
  • Update zeroXBTC address for each chain
  • Update addressUSDC for target chain
  • Update stateView contract address
  • Update uniswapv4PositionManager address
  • Remove maxTime logic and constraints
  • Set owner to cold storage address
  • Set duration_of_rewards to 45 days

📋 Contract Details

Contract Type: Uniswap V4 NFT Position Staking
Network: Base Sepolia Testnet
Position Manager:
0x4B2C77d209D3405F41a037Ec6c77F7F5b8e2ca80
State View:
0x571291b572ed32ce6751a2Cb2486EbEe8DEfB9B4
Permit2:
0x000000000022D473030F116dDEE9F6B43aC78BA3

🎮 Core Staking Functions

stakeUniswapV3NFT(uint256 tokenId)
Stakes a Uniswap V4 NFT position for rewards
stakeFORUniswapV3NFT(address forWhom, uint256 tokenId)
Stakes NFT position for another address
withdraw(uint tokenId)
Withdraws staked NFT with timelock penalties
exit(uint256 startIndex, uint256 count)
Exits multiple positions and claims rewards

Position Management

increaseLiquidityOfPosition(...)
Adds liquidity to existing staked position
decreaseLiquidityOfPosition(...)
Removes liquidity with timelock penalties
collectFeesForNFT(uint tokenID)
Collects trading fees from position for staking contract. Fees go to the staking contract to then be distributed.

🏅 Reward System

Multi-Token Rewards

B0x Tokens
Main reward token from mining
1:1 ratio with mining distribution
0xBitcoin
Secondary reward token
From LP Fees
WETH
B0x Mining fee rewards
1:1 ratio with mining distribution

Reward Distribution

Distribution Period: 5 minutes (60*5 seconds)
Reward Rate: 40% of available balance per period
USDC Special: Tiered distribution: 1.25% 3.75% over time

⏰ Timelock & Penalties

20%
Initial Penalty
3%
Final Penalty (15 days)
1%
Long-term (150+ days)
Full Range
Required Position Type

Penalty Schedule

0-15 days: Linear decrease from 20% to 3%
15-30 days: 2% penalty
30-45 days: 1.5% penalty
45+ days: 1% penalty (minimum)

🔧 Advanced Features

  • NFT Position Tracking: Maps token IDs to sequential positions
  • Liquidity Management: Increase/decrease without unstaking
  • Fee Collection: Automatic fee harvest to contract
  • Multi-Token Support: Add custom reward tokens (USDC fee)
  • Slippage Protection: Built-in price movement protection
  • Timelock Reset: Adding liquidity resets withdrawal timer
  • Batch Operations: Exit multiple positions at once
  • ETH Conversion: Automatic ETH to WETH conversion

Position Requirements

Tick Range: -887220 to +887220 (Full Range)
Tick Spacing: 60 (required)
Hook Address: Must match HookAddress_Important
Currency Pair: B0x/0xBitcoin only

🔍 View Functions

getRewardOwedStats()
Complete reward overview with token metadata
getMaxRedeemableTokens(uint tokenID, address owner)
Calculate max withdrawable amounts with penalties
getCurrentMultiplierTimelock(uint TokenID, address owner)
Get current penalty multiplier
getContractTotals()
Total liquidity and token amounts staked
getPriceRatio()
Current B0x/0xBitcoin price ratio
getStakedTokenIds(address user, uint start, uint count)
Get user's staked NFT token IDs

⚙️ Configuration Functions

Reward Management (Owner)

addRewardToken(IERC20 token)
Add new reward token for free
removeRewardToken(IERC20 token)
Remove reward token besides Protected Core Tokens
setPOW_Contract(address pow)
Set PoW contract (one-time, 120-day window)

Reward Management (Everyone)

addRewardToken(IERC20 token)
Add new reward token for a USDC fee
setRewardParams(IERC20 token)
Starts new Rewards Period 45 days.

Protected Core Tokens

Cannot Remove: WETH, 0xBTC, B0x, USDC

How to Stake

Learn how to create Uniswap v4 NFT positions and stake them to earn rewards on B Zero X.

Prerequisites

Sepolia Base ETH Required: You need Sepolia ETH to pay for gas fees and to bridge to Base Sepolia.

If you don't have any Sepolia Base ETH, go to how to bridge How to Bridge.

Uniswap v4 Position created in dapp: You need to create a Uniswap v4 Position in the dAPP..

If you haven't created a position yet, follow the Create Position Guide

Complete Staking Process

1

Visit the dApp

Go to https://testnet.bzerox.org

2

Connect Your Wallet

Connect your wallet using Rabby, Metamask, or WalletConnect to the dApp site.

3

Get Required Tokens Testnet

You need both 0xBitcoin and B Zero X tokens. To get some of each, visit the swap page faucet page at https://testnet.bzerox.org/?testnet-faucet

4

Create a Position

Go to the Create a Position page at https://testnet.bzerox.org/?create

Enter your desired amount of B0x or 0xBitcoin - the system will automatically fill in the appropriate amount for the other side.

5

Approve and Create

Approve the tokens and create your position.

6

Stake Your Position

After your position is created, go to the Staking section at https://testnet.bzerox.org/?staking

Find the position you want to stake and stake it!

Important Note: There is a withdrawal penalty that starts at 20% and decreases to 3% after 15 days. This is to prevent abuse of the staking system.

🎉 Congratulations!

You are now staking a Uniswap v4 NFT Position!

Find yourself in the stats at https://testnet.bzerox.org/?staking-rich-list

How to Swap

Swap between B0x, 0xBitcoin, and other supported tokens using our integrated DEX.

Prerequisites

Sepolia Base ETH Required: You need Sepolia ETH to pay for gas fees and to bridge to Base Sepolia.

If you don't have any Sepolia Base ETH, go to how to bridge How to Bridge.

Testnet B0x & Testnet 0xBitcoin Required: You need Testnet Tokens to use inside the dAPP..

If you have no testnet tokens but have Sepolia Base ETH Go get Testnet Tokens here https://testnet.bzerox.org/?testnet-faucet

Swap Interface

Quick Swap Process

Visit the swap page at https://testnet.bzerox.org/?swap to exchange tokens needed for staking.

Supported Trading Pairs

  • B0x 0xBitcoin

How to Swap

1

Visit the dApp

Go to https://testnet.bzerox.org

2

Connect Your Wallet

Connect your wallet using Rabby, Metamask, or WalletConnect to the dApp site.

3

Go to Swap Page

Go to the swap page in the dAPP at https://testnet.bzerox.org/?swap to swap

4

Select Tokens

Choose input and output tokens from the dropdown menus

5

Enter Amount

Specify the amount you want to swap

6

Review Rate

Check the exchange rate and fees before proceeding

7

Confirm Transactions

Sign and submit the approve and swap transactions through your wallet

Advanced Features

  • Slippage Protection: Set maximum acceptable slippage
  • Gas Optimization: Optimized gas usage for swaps

How to Bridge

Bridge tokens between different networks using our cross-chain infrastructure.

Bridge Interface

Prerequisites

Sepolia ETH Required: You need Sepolia ETH to pay for gas fees and to bridge to Base Sepolia.

If you don't have any Sepolia ETH, get some from the Google Sepolia ETH Faucet.

Quick Bridge Process

Visit the bridge page at https://testnets.superbridge.app/?fromChainId=11155111&toChainId=84532 to transfer Ethereum across networks.

Supported Networks

  • Ethereum Sepolia Sepolia Ethereum Mainnet
  • Base Sepolia Base Sepolia Network

Supported Tokens

  • Sepolia Ethereum

How to Bridge

2

Connect Your Wallet

Connect your wallet using Rabby, Metamask, or WalletConnect to the Superbridge interface.

3

Verify Networks

Ensure you're bridging from Ethereum Sepolia to Base Sepolia (or vice versa)

4

Select Networks

Choose source and destination chains from the network dropdown menus. Should be Sepolia ETH to Base Sepolia ETH

5

Choose Token

Select Ethereum from the token dropdown menu

6

Enter Amount

Specify the amount you want to bridge across networks

7

Review Details

Check the bridge route, fees, and estimated completion time

8

Confirm Bridge

Sign and submit the bridge transaction through your wallet and wait for confirmation

8

Use the dAPP

Now you can use the Base Sepolia dAPP! Get Testnet Tokens @ https://testnet.bzerox.org/?tesnet-faucet and then create a position using https://dev.testnet.bzerox.org/#create-position

Bridge Fees

0% Bridge Fees

No additional fees are charged for bridging tokens between supported networks.

Bridge Times

To L2 Networks (Base) ~10 minutes
From L2 to Ethereum ~7 days (challenge period)

Important Notes

  • Network Security: Ensure you're connected to the correct network before bridging
  • Transaction Finality: Wait for full confirmation before switching networks
  • Gas Costs: You'll need native tokens (ETH) on both networks for gas fees
  • Challenge Period: L2 to L1 bridges require a 7-day waiting period for security

How to Convert

Convert between B0x and 0xBitcoin tokens using our conversion mechanism.

Prerequisites

Sepolia Base ETH Required: You need Sepolia ETH to pay for gas fees and to bridge to Base Sepolia.

If you don't have any Sepolia Base ETH, go to how to bridge How to Bridge.

Testnet B0x & Testnet 0xBitcoin Required: You need Testnet Tokens to use inside the dAPP..

If you have no testnet tokens but have Sepolia Base ETH Go get Testnet Tokens here https://testnet.bzerox.org/?testnet-faucet

Conversion Mechanism

B Zero X provides a seamless conversion mechanism between B0x and 0xBitcoin tokens at a fixed exchange rate, enabling interoperability between the ecosystems.

Conversion Rate

1 B0x + 1 RightsTo0xBitcoin Token = 1 0xBitcoin

Fixed 1:1 ratio ensures fair and predictable conversions between tokens.

Conversion Types

1 B0x + 1 RightsTo0xBTC

1 0xBitcoin

1 0xBitcoin

1 B0x + 1 RightsTo0xBTC

How to Convert

1

Visit the dApp

Go to https://testnet.bzerox.org

2

Connect Your Wallet

Connect your wallet using Rabby, Metamask, or WalletConnect to the dApp.

3

Navigate to Convert

Find the Convert Tab in the dApp. Go to https://testnet.bzerox.org/?convert

4

Select Conversion Type

Choose whether you want to convert (B0x + RightsTo0xBTC) 0xBitcoin or 0xBitcoin (B0x + RightsTo0xBTC)

5

Enter Amount

Specify the amount you want to convert (remember the 1:1 ratio)

6

Review Transaction

Check the conversion details, gas fees, and confirm you have the required tokens

7

Execute Conversion

Sign and submit the conversion transaction through your wallet

Requirements

  • For B0x 0xBitcoin: Hold RightsTo0xBitcoin and B0x Tokens
  • For 0xBitcoin B0x: Hold 0xBitcoin tokens
  • Gas Fees: Have enough ETH to pay for transaction gas

Technical Implementation

// Convert (RightsTo0xBitcoin + B0x) to 0xBitcoin await b0xContract.withdrawFromV2toV1(amountOf0xBTC); // Convert 0xBitcoin to (RightsTo0xBitcoin + B0x) await b0xContract.depositFromV1toV2(amount);

Use Cases

  • Ecosystem Access: Access 0xBitcoin ecosystem features and services
  • Platform Participation: Participate in B Zero X ecosystem activities
  • Arbitrage Opportunities: Take advantage of price differences across platforms
  • Portfolio Management: Diversify and rebalance your token holdings
  • Staking Flexibility: Convert tokens based on staking opportunities

Important Notes

  • Fixed Rate: Conversion rate is always 1:1, no slippage concerns
  • Instant Conversion: Conversions are processed immediately upon confirmation
  • No Fees: Only gas fees apply, no additional conversion fees
  • Reversible: Conversions can be done in both directions as needed

How to Create Position in dApp

Create and manage liquidity positions in the B Zero X decentralized application.

Prerequisites

Sepolia Base ETH Required: You need Sepolia ETH to pay for gas fees and to bridge to Base Sepolia.

If you don't have any Sepolia Base ETH, go to how to bridge How to Bridge.

Testnet B0x & Testnet 0xBitcoin Required: You need Testnet Tokens to use inside the dAPP..

If you have no testnet tokens but have Sepolia Base ETH Go get Testnet Tokens here https://testnet.bzerox.org/?testnet-faucet

Position Management

Quick Position Creation

Visit the position creation page at https://testnet.bzerox.org/?create to create your liquidity position.

Available Pool

0xBTC/B0x Liquidity Pool

Currently supporting the main trading pair between 0xBitcoin and B0x tokens.

How to Create a Position

1

Visit the dApp and click the Create Position Tab or follow this direct link

Go to https://testnet.bzerox.org/?create

2

Connect Your Wallet

Connect your wallet using Rabby, Metamask, or WalletConnect to the dApp.

3

Navigate to Create Position

Go to the "Create Position" tab in the dApp at https://testnet.bzerox.org/?create

4

Select Pool

Choose your desired liquidity pool: 0xBTC/B0x

5

Select Token Amounts

Select the amount of tokens you wish to supply to the liquidity pool (both 0xBTC and B0x)

6

Approve Tokens

Approve deposit tokens for the liquidity pool contract to access your tokens

7

Add Liquidity

Deposit tokens to create your position and receive LP tokens representing your share

Position Types

Full Range Position

Provide liquidity across all prices

This is the only position type our Staking Contract currently allows. Your liquidity will be active across the entire price range.

Managing Your Positions

  • Increase Liquidity: Add more tokens to increase your position size and potential rewards
  • Decrease Liquidity: Partially or fully exit your position to collect fees and principal
  • Collect Fees: Harvest trading fees earned from your liquidity provision
  • Monitor Performance: Track your position's performance and impermanent loss

Position Analytics

Track your position performance with these tools:

Uniswap Analytics Position metrics and performance
Stats Site Detailed statistics and charts
Historical Charts Performance over time

Important Considerations

  • Impermanent Loss: Providing liquidity may result in impermanent loss if token prices diverge significantly
  • Token Requirements: You need both 0xBTC and B0x tokens to create a position
  • Gas Fees: Multiple transactions are required (approvals + deposit), each requiring gas fees
  • Market Risk: LP tokens are subject to market volatility of the underlying assets

Benefits of Providing Liquidity

  • Trading Fees: Earn a portion of trading fees from the pool
  • Staking Rewards: Stake your LP tokens for additional rewards
  • Protocol Support: Help improve liquidity and reduce slippage for all users
  • Passive Income: Generate yield on your token holdings

Next Steps

After creating your position, consider:

  • Staking your LP tokens for additional rewards
  • Monitoring your position performance regularly
  • Setting up alerts for significant price movements

🚀 B0x Mining Contract

Proof of Work Mining on Base Network - Bitcoin-Style Distribution

🎯 Launch Information

Launch Date: Wednesday, Feb 5, 2025 4:00:00 PM GMT
Unix Timestamp: 1738771200
7-Day Activation Window: Must call openMining() within 7 days of launch
⚠️ MAINNET DEPLOYMENT CHECKLIST
  • Remove setDifficultyOnlyTestnet() function
  • Remove Ownable2 inheritance
  • Set correct startTime (currently testnet)
  • Fix static ETH price in getETHPricePrecise()
  • Set miningTarget to 2**234 (currently 2**252)
  • Make B0x_Mining_TOKEN_ADDRESS immutable
  • Set slowBlocks to 0 (currently 2048)
  • Update POOL_ADDRESS for Base mainnet

📋 Contract Details

Contract Address:
0x2345678901234567890123456789012345678901
Network: Base Sepolia Testnet
Token Address:
0x677F124CD209489F6621eebDFdA1E32c625214d4
Pool Address (USDC/ETH):
0xd0b53D9277642d899DF5C87A3966A349A798F224

⚡ Mining Parameters

25
Initial Max Block Reward
6.25
Initial Min Block Reward
600
Target Block Time (seconds)
2016
Blocks Per Adjustment
21M
Maximum Mined Supply (0xBTC + B0x)

Difficulty Parameters

Initial Target: 2**234 (0xBTC standard)
Maximum Target: 2**253
Minimum Target: 2**16
Max Adjustment: 4x easier/harder per period

💰 Economics & Distribution

Total Supply Breakdown (31,165,100 B0x)

10,835,900 B0x
0xBitcoin conversion (1:1 ratio)
100% of existing 0xBTC accepted
10,164,100 B0x
Proof-of-Work Mining
100+ years distribution
10,164,100 B0x
Liquidity Provider Rewards
1:1 ratio with PoW mining

Reward Halving Schedule

Era 1: 50 B0x per block
Era 2: 25 B0x per block
Era 3: 12.5 B0x per block
Pattern: Bitcoin-style halving every ~4 years

🔧 Core Mining Functions

mint(uint256 nonce, bytes32 challenge_digest)
Standard single-nonce mining function
multi_MintTo(address mintToAddress, uint256[] memory nonce, uint maxAnswers, uint minPreviousBlockTimeDifference)
Batch mining with multiple nonces
mintTokensArrayTo(...)
Advanced mining with ERC20 token distribution
mintNFT(...)
Special NFT rewards during slow blocks

View Functions

getChallengeNumber() - Current mining challenge
getMiningDifficulty() - Current difficulty
getMiningTarget() - Current mining target
getMiningReward() - Current block reward

⚙️ Advanced Features

  • Batch Mining: Submit multiple solutions in one transaction
  • ETH Rewards: Dynamic ETH distribution based on timing
  • Difficulty Scaling: Anti-FPGA measures via ETH payments
  • LP Rewards: Automatic distribution to liquidity providers
  • NFT Bonuses: Special NFT rewards during slow periods
  • Compensation System: Better solutions get exponentially more rewards
  • Dynamic Adjustment: Early difficulty adjustment during slow periods
  • Multi-Token Mining: Epoch-based unlock system for additional tokens

Economic Mechanisms

Minimum ETH Price: 0.0000005 ETH per token (~$0.00225)
Difficulty Scaling: Higher difficulty = exponentially higher ETH cost

🎯 Mining Strategy

Optimal Mining Conditions

  • Mine when blocks are slow (> 10 minutes) for higher rewards
  • Target difficulty adjustments for temporary easier mining
  • Use batch mining to optimize gas costs
  • Consider ETH cost scaling at higher difficulties
  • Time entries for maximum reward multipliers

Special Epochs

Epoch 2, 4, 8, 16... Additional ERC20 token rewards unlock
NFT Eligibility (Very rarely possible): blocksToReadjust() == 1 + slow block conditions

📊 Analytics & Monitoring

Key Metrics Functions

inflationMined()
Yearly inflation projections based on current rate
toNextEraDays()
Days until next reward halving
getBlockInfo()
Complete mining performance summary
TotalTotalsAndETHpriceAndCurrentMintTime()
Complete mining cost/reward preview

Performance Tracking

Slow Blocks: Blocks taking > 12 minutes to mine
Adjustment Trigger: 4x target time OR 2016 blocks completed
Early Adjustment: 256+ blocks AND 1.5x slow time average

🏛️ B0x Mainnet Contract

Main B0x ERC-20 Token with 0xBitcoin Conversion System on Ethereum

🎯 Contract Overview

Purpose: Main B0x token with bidirectional 0xBitcoin conversion
Network: Ethereum Mainnet (Security & Stability)
Conversion Rate: 1 0xBTC 1 B0x + 1 R0xBTC
⚠️ MAINNET DEPLOYMENT NOTES
  • MUST REMOVE getFaucetTokens_Testnet() function before launch
  • Hard code 0xBitcoin address for mainnet deployment
  • Update token name from "B ZERO X Test" to "B ZERO X"
  • Update symbol from "tB0x" to "B0x"
  • Remove test minting (1000 tokens for LP setup)
  • Verify 0xBitcoin address: 0xB6eD7644C69416d67B522e20bC294A9a9B405B31

📋 Token Information

Token Name: B ZERO X (Test: "B ZERO X Test")
Symbol: B0x (Test: "tB0x")
Decimals: 18 (vs 0xBTC's 8 decimals)
Total Supply: 31,175,100 B0x maximum
Initial Mint: 20,338,200 B0x (2 × 10,164,100 + 10,000 test)
0xBitcoin Address:
0xB6eD7644C69416d67B522e20bC294A9a9B405B31
Network: Base Sepolia Testnet

🔄 Conversion System

Bidirectional 0xBitcoin B0x Conversion

Deposit (V1V2)
1 0xBTC 1 B0x + 1 R0xBTC
depositFromV1toV2() function
Withdraw (V2V1)
1 B0x + 1 R0xBTC 1 0xBTC
withdrawFromV2toV1() function
Approval-Free
receiveApproval() integration
Direct 0xBTC B0x + R0xBTC conversion

Rights Token System

R0xBTC Contract: Auto-deployed child contract
Purpose: Required for 0xBitcoin conversion back
Supply: 10,835,900 R0xBTC (matches 0xBTC supply)

🎮 Core Functions

depositFromV1toV2(uint amount)
Convert 0xBitcoin to B0x + R0xBTC tokens
withdrawFromV2toV1(uint amountOf_0xBTC_ToReceive)
Convert B0x + R0xBTC back to 0xBitcoin
receiveApproval(address from, uint256 tokens, address token, bytes data)
Approval-free conversion from 0xBitcoin
getFaucetTokens_Testnet()
🚨 TESTNET ONLY - Must remove for mainnet

Standard ERC-20 + Permit

permit(owner, spender, value, deadline, v, r, s)
Gasless approvals via EIP-2612 signatures
transfer, approve, transferFrom
Standard ERC-20 functions
increaseAllowance, decreaseAllowance
Safe approval adjustment functions

💰 Token Economics

10,835,900
Max 0xBTC Convertible
10,164,100
Mining Allocation
10,164,100
LP Rewards Allocation
1:1
Conversion Ratio

Supply Distribution

0xBitcoin Conversion: 10,835,900 B0x (available on-demand)
Mining Rewards: 10,164,100 B0x (Base network PoW)
LP Staking Rewards: 10,164,100 B0x (1:1 with mining)
Test Tokens: 10,000 B0x (remove for mainnet)

🔧 Technical Architecture

  • ERC-20 Permit: Gasless approvals via signed messages
  • Decimal Conversion: Auto-handles 818 decimal conversion
  • Child Contract: Auto-deploys R0xBTC rights token
  • Immutable References: 0xBTC and R0xBTC addresses locked
  • Approval Integration: Works with 0xBTC's approveAndCall
  • Burn/Mint Rights: R0xBTC managed by main contract
  • No Ownership Transfer: Immutable owner for security
  • Safe Math: OpenZeppelin's safe arithmetic operations

Decimal Handling

0xBitcoin: 8 decimals (Bitcoin standard)
B0x & R0xBTC: 18 decimals (Ethereum standard)
Conversion Factor: Multiply by 10^10 (0xBTC → B0x)

🔍 Contract Interfaces

IRightsTo0xBitcoin Interface

withdrawToken(uint256 _amount, address _to)
Mint R0xBTC tokens to specified address
burnToken(uint256 _amount, address _from)
Burn R0xBTC tokens from specified address

Child Contract: RightsTo0xBitcoinToken

Inheritance: ERC20Permit + Ownable3
Owner: B0x_Mainnet contract (immutable)
Supply: 10,835,900 R0xBTC maximum

⚙️ Usage Examples

Convert 0xBitcoin to B0x

// Approve B0x contract to spend your 0xBTC 0xBTC.approve(b0xContract, amount); // Convert to B0x + R0xBTC b0xContract.depositFromV1toV2(amount); // Result: Receive amount*10^10 B0x + amount*10^10 R0xBTC

Convert Back to 0xBitcoin

// Must have both B0x and R0xBTC tokens // Specify amount in 0xBTC terms (8 decimals) b0xContract.withdrawFromV2toV1(amountOf0xBTC); // Contract burns your B0x + R0xBTC // Sends you 0xBTC tokens

Gasless Approval (Permit)

// Sign permit message off-chain // Submit permit + transfer in one transaction b0xContract.permit(owner, spender, value, deadline, v, r, s);

🛡️ Security Features

  • Immutable Owner: No ownership transfer possible
  • Validated Transfers: Require() statements for all transfers
  • Address Validation: Checks for correct 0xBTC contract
  • Decimal Safety: Proper conversion handling
  • Child Contract Control: Only parent can mint/burn R0xBTC
  • Standard Compliance: Full ERC-20 + EIP-2612 compliance
  • No Reentrancy: Simple transfer patterns prevent attacks
  • OpenZeppelin Base: Battle-tested contract foundations

Access Control

Public Functions: Conversion, transfers, approvals
Owner-Only (R0xBTC): withdrawToken(), burnToken()
Immutable References: 0xBTC address, R0xBTC address

🎫 RightsTo0xBitcoinToken Contract

Rights Token for B0x 0xBitcoin Conversion System

🎯 Contract Overview

Purpose: Required token for converting B0x back to 0xBitcoin
Deployment: Auto-deployed by B0x_Mainnet constructor
Ownership: Controlled by B0x_Mainnet contract (immutable)
⚠️ IMPORTANT NOTES
  • This contract is auto-deployed by B0x_Mainnet constructor
  • Owner is immutable - set to B0x_Mainnet contract address
  • Only the parent B0x_Mainnet contract can mint/burn tokens
  • Users receive R0xBTC automatically when converting from 0xBitcoin
  • Both B0x AND R0xBTC required to convert back to 0xBitcoin

📋 Token Information

Token Name: Rights To 0xBitcoin Token
Symbol: R0xBTC
Decimals: 18
Total Supply: 10,835,900 R0xBTC maximum
Parent Contract: B0x_Mainnet (immutable owner)
Network: Base Sepolia Testnet

🎮 Core Functions

withdrawToken(uint256 _amount, address _to) onlyOwner
Mint R0xBTC tokens to specified address
burnToken(uint256 _amount, address _from) onlyOwner
Burn R0xBTC tokens from specified address

Standard ERC-20 + Permit Functions

transfer(address to, uint256 amount)
Standard token transfer
approve(address spender, uint256 amount)
Standard approval function
permit(owner, spender, value, deadline, v, r, s)
Gasless approvals via EIP-2612 signatures
balanceOf(address account)
Check R0xBTC balance

🔄 Conversion Mechanism

Rights Token Role in Conversion System

Receive R0xBTC
When converting 0xBTC B0x
1 0xBTC = 1 B0x + 1 R0xBTC
Spend R0xBTC
When converting B0x 0xBTC
1 B0x + 1 R0xBTC = 1 0xBTC
Proof of Rights
R0xBTC proves conversion rights
Prevents infinite 0xBTC minting

Automatic Token Management

Minting: Auto-minted when 0xBTC deposited to B0x_Mainnet
Burning: Auto-burned when converting B0x back to 0xBTC
Transfer: Freely transferable ERC-20 token

⚡ Technical Architecture

ERC20Permit
Inheritance
Ownable3
Access Control
Child
Contract Type
Immutable
Owner Status

Contract Features

  • Auto-Deployment: Created by B0x_Mainnet constructor
  • Immutable Owner: Cannot transfer ownership (security)
  • ERC-20 Compliant: Standard token functionality
  • Permit Support: Gasless approvals via signatures
  • Controlled Supply: Only parent contract can mint/burn
  • Decimal Matching: 18 decimals like B0x token
  • Interface Compliance: Implements IRightsTo0xBitcoin

🔧 Owner-Only Functions

withdrawToken() - Mint R0xBTC

function withdrawToken(uint256 _amount, address _to) external onlyOwner { _mint(_to, _amount); } // Called by B0x_Mainnet when user deposits 0xBTC // Mints R0xBTC tokens to user's address

burnToken() - Burn R0xBTC

function burnToken(uint256 _amount, address _from) external onlyOwner { _burn(_from, _amount); } // Called by B0x_Mainnet when user withdraws to 0xBTC // Burns R0xBTC tokens from user's address

Access Control

Owner: B0x_Mainnet contract address (set in constructor)
Immutable: No ownership transfer functions available

🔍 Usage Examples

How Users Interact

Direct Interaction: Users rarely call R0xBTC functions directly
Automatic Management: B0x_Mainnet handles all minting/burning
Standard Operations: Users can transfer, approve, check balances

Conversion Flow

// Step 1: User deposits 0xBTC to B0x_Mainnet b0xMainnet.depositFromV1toV2(amount); // Step 2: B0x_Mainnet calls (automatically): rightsContract.withdrawToken(amount * 10**10, userAddress); // Result: User receives B0x + R0xBTC // Step 3: User converts back (needs both tokens): b0xMainnet.withdrawFromV2toV1(amount); // Step 4: B0x_Mainnet calls (automatically): rightsContract.burnToken(amount * 10**10, userAddress); // Result: User receives 0xBTC, loses B0x + R0xBTC

🛡️ Security Model

  • Controlled Access: Only B0x_Mainnet can mint/burn
  • Immutable Owner: Prevents ownership takeover
  • Supply Control: Cannot create tokens without backing 0xBTC
  • Standard Security: OpenZeppelin battle-tested base
  • No Admin Functions: Minimal attack surface
  • Automatic Operations: Reduces human error risk
  • Rights Verification: Prevents unauthorized 0xBTC withdrawal

Economic Security

Backing Requirement: R0xBTC only minted when 0xBTC deposited
Conversion Proof: Must burn R0xBTC to withdraw 0xBTC
Supply Limit: Maximum 10,835,900 R0xBTC (matches 0xBTC supply)

📊 Interface Implementation

IRightsTo0xBitcoin Interface

interface IRightsTo0xBitcoin
Defines the required functions for rights management

Inherited Contracts

ERC20Permit: Standard token + gasless approvals
Ownable3: Access control with immutable owner
EIP712: Structured data signing for permits

Constructor Parameters

constructor() ERC20("Rights To 0xBitcoin Token", "R0xBTC", 18, 10_835_900 * 10**18) ERC20Permit("Rights To 0xBitcoin Token") { // Owner set to msg.sender (B0x_Mainnet contract) // Total supply: 10,835,900 * 10^18 // No initial minting - tokens created on-demand }

B0x Token Position Finder Pro

Advanced utility contract for discovering and analyzing Uniswap V4 positions. Built for B0x Token ecosystem with comprehensive position finding and staking analysis capabilities.

Contract Overview

Purpose: Advanced position discovery and analysis for Uniswap V4
Protocol: Uniswap V4 with B0x Token integration
Features: Position finding, staking analysis, fee tracking
IMPORTANT NOTES
  • Advanced contract for experienced DeFi users
  • Requires understanding of Uniswap V4 mechanics
  • Position Manager and State View integration required
  • Gas optimization through batch operations
  • Comprehensive fee tracking and liquidity analysis

Contract Information

Contract Name: positionFinderPro
Position Manager: 0x4B2C77d209D3405F41a037Ec6c77F7F5b8e2ca80
State View: 0x571291b572ed32ce6751a2Cb2486EbEe8DEfB9B4
Network: Base Sepolia Testnet
Protocol: Uniswap V4

Core Functions

findUserTokenIds(address user, uint256 startId, uint256 endId, address Token0, address Token1, address HookAddress)
Finds all NFT positions owned by a user within specified token ID range for a specific pool
findUserTokenIdswithMinimum(address user, uint256 startId, uint256 endId, address Token0, address Token1, address HookAddress, uint minTokenA)
Filters user positions by minimum token amount threshold
findAllUsersTokenIDSinStaking(uint256 startId, uint256 endId, address Token0, address Token1, address HookAddress, uint minTokenA)
Discovers all staked NFT positions within token ID range that meet minimum requirements
getIDSofStakedTokensForUserwithMinimum(address user, address Token0, address Token1, uint256 minAmount0, uint256 startIndex, uint256 count, address HookAddress)
Retrieves user's staked positions with minimum token requirements

Utility Functions

getMaxUniswapIDPossible()
Returns maximum possible Uniswap NFT ID
getMaxStakedIDforUser(address user)
Returns total number of staked positions for user
getAmount0ForLiquidity(uint160 sqrtPriceAX96, uint160 sqrtPriceBX96, uint128 liquidity)
Calculates token0 amount from liquidity
getAmount1ForLiquidity(uint160 sqrtPriceAX96, uint160 sqrtPriceBX96, uint128 liquidity)
Calculates token1 amount from liquidity

Technical Architecture

Uniswap V4
Protocol
Gas Optimized
Efficiency
Batch Operations
Query Type
Immutable Refs
Contract Design

Key Features

  • Position Discovery: Find user positions across token ID ranges
  • Liquidity Analysis: Calculate token amounts from liquidity positions
  • Fee Tracking: Monitor unclaimed fees and fee growth
  • Staking Integration: Full NFT staking contract integration
  • Mathematical Precision: Accurate tick to price conversions
  • Pool Identification: PoolKey hashing for unique identification
  • Batch Queries: Efficient multi-position data retrieval

Staking Analysis

Staking Contract Integration

getStakedTokenIdsAllInfoRange(address user, uint256 startIndex, uint256 count)
Comprehensive staking information for position ranges

Staking Features

Penalty Tracking: Withdrawal penalties based on staking duration
Position Ownership: Track original owners of staked NFTs
Batch Processing: Efficient queries for multiple staked positions
Time Analysis: Staking timestamps and duration calculations

Mathematical Functions

Price and Liquidity Calculations

// Tick to sqrt price conversion function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160) // Liquidity to token amount conversions function getAmount0ForLiquidity(uint160 sqrtPriceAX96, uint160 sqrtPriceBX96, uint128 liquidity) function getAmount1ForLiquidity(uint160 sqrtPriceAX96, uint160 sqrtPriceBX96, uint128 liquidity) // Fee calculations function getFeesOwed(IStateView.PoolId poolId, uint256 tokenId) function mulDiv(uint256 a, uint256 b, uint256 denominator)

Constants and Precision

MIN_TICK: -887220 (minimum price tick)
MAX_TICK: 887220 (maximum price tick)
Q96: 2^96 (price calculation precision)
Q128: 2^128 (fee calculation precision)

Usage Examples

Finding User Positions

// Find all positions for user in token range (uint256[] memory tokenIds, uint256[] memory amountA, uint256[] memory amountB, uint128[] memory liquidity, int128[] memory feesA, int128[] memory feesB, PoolKey[] memory pools, uint256[] memory info) = positionFinder.findUserTokenIds( userAddress, startTokenId, endTokenId, token0Address, token1Address, hooksAddress );

Filtering by Minimum Amount

// Find positions with minimum token A amount (uint256[] memory qualifyingTokens, ...) = positionFinder.findUserTokenIdswithMinimum( userAddress, startId, endId, token0, token1, hooks, minimumTokenA );

Security Model

  • Immutable References: Position Manager and State View addresses fixed
  • Read-Only Operations: No state-changing functions for users
  • Gas Optimized: Efficient batch operations reduce transaction costs
  • Precision Math: Accurate calculations prevent rounding errors
  • Error Handling: Proper checks for non-existent tokens
  • Standard Integration: Compatible with Uniswap V4 interfaces

Integration Safety

Position Manager: Trusted Uniswap V4 contract integration
State View: Real-time pool data with safety checks
Staking Contract: Controlled access through interface

UniV4Hook - Dynamic Fee Management

Uniswap V4 hook contract implementation for dynamic liquidity provider fee management. Enables real-time fee adjustments for optimized pool performance within the B0x Token ecosystem.

Contract Overview

Purpose: Dynamic fee management for Uniswap V4 pools
Protocol: Uniswap V4 Hook Integration
Features: Real-time fee updates, pool initialization, ownership management
IMPORTANT NOTES
  • Hook contract requires valid address generation through Hook Miner
  • Only pool manager can trigger hook functions
  • Owner-only functions for fee management and ownership transfer
  • Maximum fee cap of 90% with minimum of 0.01%
  • Initial pool fee set to 2% upon initialization

Contract Information

Contract Name: UniV4Hook
Pool Manager: 0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408
Hook Type: afterInitialize Only
Network: Base Sepolia Testnet
Protocol: Uniswap V4

Core Functions

afterInitialize(address sender, PoolKey_Hook calldata key, uint160 sqrtPriceX96, int24 tick)
Hook function called after pool initialization. Sets initial 2% fee and validates caller
getCurrentPoolFee(PoolKey_Hook memory poolKey)
Returns the current fee tier for a given pool key
getCurrentPoolFeeByPoolID(bytes32 poolId)
Returns the current fee tier for a given pool ID
getHookPermissions()
Returns hook permissions structure (afterInitialize: true, all others: false)
toId(PoolKey_Hook memory poolKey)
Generates unique pool ID from pool key parameters using keccak256

Administrative Functions

transferOwner(address newOwner)
Transfers contract ownership to a new address (owner-only)
forceUpdateLPFee(PoolKey_Hook calldata key, uint24 newFee)
Owner-only function to manually update LP fees for a specific pool (0.01% - 90% range)

Hook Architecture

After Initialize
Hook Type
Dynamic Fees
Core Feature
Owner Controlled
Access Model
Pool Manager
Integration

Key Features

  • Dynamic Fee Management: Real-time LP fee adjustments from 0.01% to 90%
  • Pool Initialization: Automatic 2% fee setup for new pools
  • Access Control: Owner-only administrative functions
  • Pool Tracking: Comprehensive fee tracking per pool ID
  • Event Logging: Fee changes and ownership transfers logged
  • ETH Reception: Contract can receive ETH payments
  • Validation: Proper hook selector validation

Fee Management

Fee Configuration

Initial Fee: 20000 (2.00%)
Minimum Fee: 100 (0.01%)
Maximum Fee: 900000 (90.00%)
Fee Format: Hundredths of a bip (10000 = 1%)

Pool State Tracking

mapping(bytes32 => uint24) poolCurrentFees
Tracks current fee for each pool by pool ID
uint24 public currentFee
Last updated fee for the liquidity pool managed by this hook

Hook Permissions

Enabled Hooks

afterInitialize: true // Called after pool creation beforeInitialize: false beforeAddLiquidity: false afterAddLiquidity: false beforeRemoveLiquidity: false afterRemoveLiquidity: false beforeSwap: false afterSwap: false beforeDonate: false afterDonate: false beforeSwapReturnDelta: false afterSwapReturnDelta: false afterAddLiquidityReturnDelta: false afterRemoveLiquidityReturnDelta: false

PoolKey Structure

struct PoolKey_Hook { address currency0; // First token (smaller address) address currency1; // Second token (larger address) uint24 fee; // Fee tier in hundredths of bip int24 tickSpacing; // Price granularity address hooks; // Hook contract address }

Usage Examples

Initialize Pool with Hook

// Pool automatically gets 2% initial fee PoolKey_Hook memory key = PoolKey_Hook({ currency0: token0Address, currency1: token1Address, fee: 0, // Will be set by hook tickSpacing: 60, hooks: hookAddress }); // Hook sets initial fee to 20000 (2%)

Update Pool Fee

// Owner can update fee between 0.01% and 90% uint24 newFee = 30000; // 3% hook.forceUpdateLPFee(poolKey, newFee); // Check current fee uint24 currentFee = hook.getCurrentPoolFee(poolKey);

Transfer Ownership

// Transfer hook ownership address newOwner = 0x1234...; hook.transferOwner(newOwner); // Verify new owner address owner = hook.owner();

Events

Fee Management Events

event NewFeeRate(uint24 newFee, uint24 oldFee)
Emitted when LP fee is updated with old and new fee values
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Emitted when contract ownership is transferred

Error Conditions

Invalid Caller: "Only PoolManager can call" (for hook functions)
Unauthorized: "Only owner can call" (for admin functions)
Invalid Fee: "Max is 90% fee rate" (fee validation)
Zero Address: "New owner cannot be zero address"

Security Model

  • Access Control: Owner-only administrative functions with proper validation
  • Pool Manager Validation: Only official Uniswap V4 Pool Manager can call hooks
  • Fee Bounds: Strict limits on fee ranges (0.01% - 90%)
  • Hook Selector Validation: Proper return of function selectors
  • Address Validation: Zero address checks for ownership transfers
  • Immutable References: Pool Manager address cannot be changed
  • ETH Reception: Safe receive function for contract payments

Integration Requirements

Hook Address: Must be generated through Hook Miner for validation
Pool Manager: Immutable reference to official Uniswap V4 contract
Owner Setup: Constructor sets initial owner (included in salt generation)
Permission Model: Only afterInitialize hook enabled for minimal attack surface

HookMiner - Uniswap V4 Hook Address Generator

Advanced mining contract for generating valid Uniswap V4 hook addresses that pass address validation. Uses CREATE2 deterministic deployment with salt mining to find addresses matching required hook flags.

Contract Overview

Purpose: Generate valid hook addresses for Uniswap V4 deployment
Method: CREATE2 salt mining with flag validation
Features: Address prediction, salt discovery, deterministic deployment
IMPORTANT NOTES
  • Hook addresses must pass Uniswap V4 validation to be deployable
  • Only specific bit patterns in addresses are accepted as valid hooks
  • Salt mining may require significant computational effort
  • Contract admin is set permanently during HookMiner deployment
  • Deployed hooks use CREATE2 for deterministic addresses

Contract Information

Contract Name: HookMiner
Hook Type: UniV4Hook (afterInitialize only)
Deployment Method: CREATE2 Deterministic
Network: Base Sepolia Testnet
Protocol: Uniswap V4

Core Functions

findValidSalt(uint256 startSalt, uint256 maxAttempts)
Searches for a salt value that generates a valid hook address within attempt limit
deployHook(uint256 salt)
Deploys UniV4Hook contract using valid salt with CREATE2 deployment
isValidHookAddress(address hook)
Validates if an address has exactly the required hook flags (afterInitialize only)
computeAddress(uint256 salt, bytes memory bytecode, bytes memory args)
Predicts the deployment address for given salt and bytecode

State Variables

address public ADMINOFHOOK
Admin address set during deployment, becomes owner of all deployed hooks
uint160 constant ALL_HOOK_MASK
Bitmask for all possible hook flags (16383 = (1 << 14) - 1)
uint160 constant DESIRED_FLAGS
Required flags for valid hooks (AFTER_INITIALIZE_FLAG = 1 << 12)

Hook Validation System

Address Mining
Generation Method
Flag Validation
Address Check
CREATE2
Deployment Type
Deterministic
Address Nature

Hook Flag Requirements

  • After Initialize: Flag must be set (bit 12 = 4096)
  • All Other Flags: Must be unset for validation to pass
  • Address Pattern: Lower 14 bits must equal 4096 exactly
  • Validation Logic: (address & ALL_HOOK_MASK) == DESIRED_FLAGS
  • Bit Position: After initialize flag at position 1 << 12
  • Mask Value: ALL_HOOK_MASK = 16383 (covers all 14 flag bits)
  • Required Pattern: Only afterInitialize bit set, all others clear

Salt Mining Process

Mining Algorithm

1. Start with initial salt value 2. Generate bytecode + constructor args 3. Compute CREATE2 address for current salt 4. Check if address has valid hook flags 5. If valid: return salt and address 6. If invalid: increment salt and repeat 7. Continue until maxAttempts reached

Address Computation

// CREATE2 address calculation keccak256(abi.encodePacked( bytes1(0xff), // CREATE2 prefix address(this), // Deployer (HookMiner) salt, // Salt value keccak256(bytecode + args) // Init code hash ))

Mining Parameters

Success Probability: 1 in 16,384 addresses (1/2^14)
Expected Attempts: ~8,192 iterations on average
Worst Case: Up to maxAttempts iterations

Deployment Workflow

Step-by-Step Process

1. Deploy HookMiner
Deploys the miner contract, sets msg.sender as ADMINOFHOOK
2. Find Valid Salt
Call findValidSalt() to discover a salt that generates valid hook address
3. Deploy Hook
Use deployHook() with discovered salt to deploy actual UniV4Hook contract
4. Verify Address
Confirm deployed hook address passes isValidHookAddress() validation

Constructor Arguments

Hook Owner: ADMINOFHOOK address (set during HookMiner deployment)
Bytecode: type(UniV4Hook).creationCode
Encoded Args: abi.encode(address(ADMINOFHOOK))

Usage Examples

Mine for Valid Salt

// Find a valid salt starting from 0, max 50000 attempts (uint256 validSalt, address predictedAddress) = hookMiner.findValidSalt(0, 50000); // Verify the address is valid bool isValid = hookMiner.isValidHookAddress(predictedAddress); require(isValid, "Generated address is not valid");

Deploy Hook with Valid Salt

// Deploy the hook using discovered salt address deployedHook = hookMiner.deployHook(validSalt); // Verify deployment succeeded and address matches require(deployedHook == predictedAddress, "Address mismatch"); require(hookMiner.isValidHookAddress(deployedHook), "Deployed hook invalid");

Pre-compute Hook Address

// Predict address before deployment bytes memory bytecode = type(UniV4Hook).creationCode; bytes memory args = abi.encode(adminAddress); address predicted = hookMiner.computeAddress(salt, bytecode, args); // Check if predicted address would be valid if (hookMiner.isValidHookAddress(predicted)) { // Safe to deploy with this salt }

Flag System Details

Hook Flag Mapping

// All possible hook flags (commented out unused flags) // uint160 constant BEFORE_INITIALIZE_FLAG = 1 << 13; // 8192 uint160 constant AFTER_INITIALIZE_FLAG = 1 << 12; // 4096 ✓ // uint160 constant BEFORE_ADD_LIQUIDITY_FLAG = 1 << 11; // 2048 // uint160 constant AFTER_ADD_LIQUIDITY_FLAG = 1 << 10; // 1024 // uint160 constant BEFORE_REMOVE_LIQUIDITY_FLAG = 1 << 9; // 512 // uint160 constant AFTER_REMOVE_LIQUIDITY_FLAG = 1 << 8; // 256 // uint160 constant BEFORE_SWAP_FLAG = 1 << 7; // 128 // uint160 constant AFTER_SWAP_FLAG = 1 << 6; // 64 // uint160 constant BEFORE_DONATE_FLAG = 1 << 5; // 32 // uint160 constant AFTER_DONATE_FLAG = 1 << 4; // 16 // uint160 constant BEFORE_SWAP_RETURNS_DELTA_FLAG = 1 << 3; // 8 // uint160 constant AFTER_SWAP_RETURNS_DELTA_FLAG = 1 << 2; // 4 // uint160 constant AFTER_ADD_LIQUIDITY_RETURNS_DELTA_FLAG = 1 << 1; // 2 // uint160 constant AFTER_REMOVE_LIQUIDITY_RETURNS_DELTA_FLAG = 1 << 0; // 1

Validation Mathematics

ALL_HOOK_MASK: 16383 (binary: 11111111111111)
DESIRED_FLAGS: 4096 (binary: 01000000000000)
Valid Pattern: Address & 16383 must equal 4096
Success Rate: 1/16384 ≈ 0.0061% chance per attempt

Security Model

  • Deterministic Deployment: CREATE2 ensures predictable addresses
  • Address Validation: Strict flag checking prevents invalid deployments
  • Admin Control: ADMINOFHOOK set once during deployment, immutable
  • Revert Protection: Deployment fails if hook address validation fails
  • Gas Efficiency: Assembly-optimized address computation
  • No State Changes: Mining functions are view-only for gas efficiency
  • Bytecode Integrity: Uses type().creationCode for accurate bytecode

Deployment Risks

Salt Collision: Extremely unlikely due to keccak256 distribution
Mining Failure: Reverts if no valid salt found in maxAttempts range
Gas Costs: Mining may require significant gas for computation
Admin Setup: ADMINOFHOOK cannot be changed after deployment

UniswapV4PoolCreator - B0x Pool Factory

Specialized pool creation contract for B0x Token integration with Uniswap V4. Automatically sets optimal pricing ratios and initializes pools with dynamic fee structures for the B0x ecosystem.

Contract Overview

Purpose: Create Uniswap V4 pools with B0x token pricing
Price Ratio: 20 B0x = 1 other token (0.05 ratio)
Features: Decimal adjustment, price calculation, pool initialization
IMPORTANT NOTES
  • Must adjust poolManager for mainnet launch
  • Economic ratio hardcoded: 20 B0x tokens = 1 other token
  • Automatic decimal adjustment for different token configurations
  • Uses dynamic fee flag (0x800000) for hook-managed fees
  • Pool Manager address must match deployment network
  • Supports hook contracts or address(0) for no hooks

Contract Information

Contract Name: UniswapV4PoolCreator
Pool Manager: 0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408
B0x Token: Set during deployment (immutable)
Network: Base Sepolia Testnet
Protocol: Uniswap V4

Core Functions

createNewPool(address tokenA, address tokenB, address hookContract)
Creates new Uniswap V4 pool with B0x pricing, sorting tokens and calculating optimal price ratios
calculateDecimalAdjustedPrice(address token0, address token1, uint8 decimals0, uint8 decimals1)
Calculates price ratio accounting for token decimals with 20:1 B0x economic model
sqrtPriceX96FromPriceRatio(uint256 priceRatio18Decimal)
Converts 18-decimal price ratio to Uniswap's sqrtPriceX96 format
encodeDynamicFee()
Returns dynamic fee flag (0x800000) for hook-controlled fee management

Debug Functions

debugDecimalAdjustedPrice(address tokenA, address tokenB)
Returns detailed price calculation breakdown with explanations
debugPriceCalculation(address tokenA, address tokenB)
Shows step-by-step price calculation with numerator/denominator breakdown

Pricing Architecture

20:1 Ratio
B0x Economic Model
Decimal Adjusted
Price Calculation
Dynamic Fees
Fee Structure
SqrtPriceX96
Uniswap Format

Price Calculation Logic

  • Economic Ratio: 20 B0x tokens = 1 other token (price = 0.05)
  • Token Sorting: Automatic address-based sorting for Uniswap compatibility
  • Decimal Adjustment: Accounts for different token decimal configurations
  • Precision: 18-decimal intermediate calculations for accuracy
  • Format Conversion: Converts to Uniswap's sqrtPriceX96 standard
  • Mathematical Safety: Babylonian square root with overflow protection
  • Bidirectional Logic: Handles B0x as token0 or token1 correctly

Price Calculation Details

Scenario 1: B0x as Token0

// When B0x is the smaller address (token0) // Uniswap price = token1/token0 = other/B0x = 0.05 uint256 numerator = 10**decimals1 * 1e18; // Other token units uint256 denominator = 20 * 10**decimals0; // 20 B0x units priceRatio = numerator / denominator; // = 0.05 in 18-decimal

Scenario 2: B0x as Token1

// When B0x is the larger address (token1) // Uniswap price = token1/token0 = B0x/other = 20 uint256 numerator = 20 * 10**decimals1 * 1e18; // 20 B0x units uint256 denominator = 1 * 10**decimals0; // 1 other token unit priceRatio = numerator / denominator; // = 20 in 18-decimal

SqrtPriceX96 Conversion

// Convert 18-decimal price ratio to Uniswap format uint256 sqrtPrice = sqrt(priceRatio18Decimal); // Babylonian method uint160 sqrtPriceX96 = (sqrtPrice * (2 ** 96)) / 1e9; // X96 format

Pool Configuration

PoolKey Structure

IPoolManager.PoolKey memory key = IPoolManager.PoolKey({ currency0: Currency2.wrap(token0), // Smaller address currency1: Currency2.wrap(token1), // Larger address fee: encodeDynamicFee(), // 0x800000 (dynamic) tickSpacing: 60, // Standard spacing hooks: hookContract // Hook or address(0) });

Configuration Parameters

Fee Structure: Dynamic (0x800000) - controlled by hooks
Tick Spacing: 60 (standard granularity)
Currency Type: Currency2 wrapper for addresses
Hook Support: Optional hook contract or address(0)

Mathematical Functions

Square Root Implementation

function sqrt(uint256 x) internal pure returns (uint256) { if (x == 0) return 0; uint256 z = (x + 1) / 2; uint256 y = x; while (z < y) { y = z; z = (x / z + z) / 2; // Babylonian method } return y; }

Precision Management

Intermediate Precision: 18 decimals (1e18) for calculations
Final Format: X96 format (2^96 scaling factor)
Scaling Adjustment: Divide by 1e9 during X96 conversion
Overflow Protection: Safe casting to uint160 for sqrtPriceX96

Usage Examples

Create B0x/0xBTC Pool

// Deploy pool creator with B0x token address UniswapV4PoolCreator creator = new UniswapV4PoolCreator(b0xTokenAddress); // Create pool with hook contract address hookAddress = 0x1234...; // Or address(0) for no hooks creator.createNewPool( b0xTokenAddress, zeroXBTCAddress, hookAddress ); // Pool automatically gets 20:1 B0x ratio pricing

Debug Price Calculation

// Get detailed price breakdown ( address token0, address token1, uint8 decimals0, uint8 decimals1, uint256 calculatedPriceRatio, string memory explanation ) = creator.debugDecimalAdjustedPrice(tokenA, tokenB); // Check calculation steps ( string memory scenario, uint256 numerator, uint256 denominator, uint256 priceRatio, uint256 expectedSqrtPriceX96 ) = creator.debugPriceCalculation(tokenA, tokenB);

Manual Price Conversion

// Convert custom price ratio to X96 format uint256 customRatio = 50 * 1e18; // 50:1 ratio in 18-decimal uint160 sqrtPriceX96 = creator.sqrtPriceX96FromPriceRatio(customRatio); // Get dynamic fee flag uint24 dynamicFee = creator.encodeDynamicFee(); // Returns 0x800000

Events and Errors

Events

event PoolCreated(address indexed token0, address indexed token1, address indexed hookContract, uint160 sqrtPriceX96)
Emitted when a new pool is successfully created with pricing information

Custom Errors

error InvalidTokenAddress()
Thrown when token address validation fails
error InvalidHookContract()
Thrown when hook contract validation fails
error IdenticalTokens()
Thrown when both token addresses are the same
error ZeroAddress()
Thrown when zero address is provided for tokens or B0x

Integration Examples

Different Decimal Scenarios

// Scenario 1: B0x (18 decimals) + USDC (6 decimals) // If B0x < USDC (token0 = B0x, token1 = USDC) // Price = USDC/B0x = 0.05 // numerator = 10^6 * 1e18 = 1e24 // denominator = 20 * 10^18 = 2e19 // priceRatio = 1e24 / 2e19 = 50000000000000000 (0.05 in 18-decimal) // Scenario 2: WETH (18 decimals) + B0x (18 decimals) // If WETH < B0x (token0 = WETH, token1 = B0x) // Price = B0x/WETH = 20 // numerator = 20 * 10^18 * 1e18 = 2e37 // denominator = 1 * 10^18 = 1e18 // priceRatio = 2e37 / 1e18 = 2e19 (20 in 18-decimal)

Hook Integration Pattern

// 1. Deploy hook miner and find valid hook address HookMiner miner = new HookMiner(); (uint256 salt, address hookAddress) = miner.findValidSalt(0, 50000); address deployedHook = miner.deployHook(salt); // 2. Deploy pool creator UniswapV4PoolCreator creator = new UniswapV4PoolCreator(b0xAddress); // 3. Create pool with hook creator.createNewPool(b0xAddress, otherTokenAddress, deployedHook);

Security Model

  • Input Validation: Comprehensive checks for zero addresses and identical tokens
  • Immutable References: Pool Manager and B0x token addresses set during deployment
  • Mathematical Safety: Overflow protection in price calculations
  • Token Sorting: Automatic sorting prevents invalid pool creation
  • Decimal Handling: Proper decimal adjustment prevents precision errors
  • Standard Compliance: Follows Uniswap V4 pool creation specifications
  • Debug Functions: View-only functions for price verification

Deployment Considerations

Network Verification: Pool Manager address must match target network
B0x Token Setup: B0x address is immutable after deployment
Hook Compatibility: Supports any valid hook contract or no hooks
Price Model: 20:1 ratio hardcoded, cannot be modified

Hook Address & Dynamic Fee Flag

Understanding hook addresses, dynamic fees, and their role in the HookMiner system.

Hook Address System

Hook addresses in Uniswap V4 encode which lifecycle callbacks (hooks) a contract can engage with, using the lower 14 bits of the address. Additionally, pools can enable dynamic fee behavior via a special fee flag during initialization.

Hook Address Format (Lower 14 Bits)

  • Bit 13: beforeInitialize
  • Bit 12: afterInitialize
  • Bit 11: beforeAddLiquidity
  • Bit 10: afterAddLiquidity
  • Bit 9: beforeRemoveLiquidity
  • Bit 8: afterRemoveLiquidity
  • Bit 7: beforeSwap
  • Bit 6: afterSwap
  • Bit 5: beforeDonate
  • Bit 4: afterDonate
  • Bit 3: beforeSwapReturnsDelta
  • Bit 2: afterSwapReturnsDelta
  • Bit 1: afterAddLiquidityReturnsDelta
  • Bit 0: afterRemoveLiquidityReturnsDelta

HookMiner Desired Flags

Only the afterInitialize flag is set:

  • Bit: 12
  • Decimal: 4096
  • Hex: 0x1000

Dynamic Fee Signal

Separately, our Pools can indicate support for dynamic fees by using a special fee flag at initialization:

  • Fee Value: 8,388,608
  • Hex: 0x800000

If the pool is initialized with this fee, it becomes a dynamic fee pool, irrespective of hook bits

Example Valid Hook Address

Example address containing only the afterInitialize flag:
0x794B1409ef4b40a90eC8AF62EaF4c8bf275e5000

This address has only bit 12 set (0x1000), which matches our desired flag configuration.

Hook Miner

Specialized Uniswap V4 Hook Miner for B0x Token

Hook Miner Concept

Hook mining combines salt and addresses to get the correct Uniswap v4 Hook created for our pool.

How It Works

  • Setup the Hook Miner Contract to have the correct variables
  • Find the valid salt of the Uniswap v4 Hook Address
  • Deploy the contract with that Salt #
  • Custom Uniswap V4 Hook is created and can be used with Uniswap v4 Pools!

Benefits

  • Automatic Hook Maker
  • Sets fee automatically on creaation
  • Synergy between mining and DeFi

B0x 0xBitcoin Conversion

Technical details of the conversion mechanism between B0x and 0xBitcoin tokens.

Conversion Architecture

The conversion system enables seamless exchange between B0x and 0xBitcoin ecosystems, maintaining a 1:1 peg while preserving the unique properties of each token.

Technical Implementation

contract B0x_Mainnet { function depositFromV1toV2(uint amount) public { require(ERC20(_0xBitcoin_Address).transferFrom(msg.sender, address(this), amount), "Must transfer 0xBitcoin"); IRightsTo0xBitcoin(_RightsTo0xBitcoin_Address).withdrawToken(amount * 10 ** 10, msg.sender); _mint(msg.sender, amount * 10 ** 10); } function withdrawFromV2toV1(uint amountOf_0xBTC_ToRecieve) public { IRightsTo0xBitcoin(_RightsTo0xBitcoin_Address).burnToken(amountOf_0xBTC_ToRecieve * 10**10, msg.sender); _burn(msg.sender, amountOf_0xBTC_ToRecieve * 10 ** 10); /// @notice Success status of the 0xBitcoin transfer bool success = ERC20(_0xBitcoin_Address).transfer(msg.sender, amountOf_0xBTC_ToRecieve); require(success, "Transfer failed of 0xBTC out of contract"); } }

Conversion Features

  • 1:1 Ratio: Fixed exchange rate
  • Instant Conversion: No waiting periods
  • Gas Optimized: Minimal transaction costs
  • Reversible: Convert back anytime as long as you keep RightsTo0xBitconi Token and B0x Token or 0xBitcoin Token

RightsTo0xBitcoin Token

Rights tokens that provide conversion privileges between B0x and 0xBitcoin.

Rights Token System

RightsTo0xBitcoin tokens represent conversion rights within the B Zero X ecosystem, providing holders with special access and benefits.

Token Properties

  • Symbol: R0xBTC
  • Decimals: 18
  • Total Supply: 10.9M
  • Transferable: Yes

Rights and Benefits

  • No Conversion fees
  • Use B0x and 0xBitconi in Staking Liquidity Rewards

How to Obtain

  • Convert 0xBitcoin
  • Buy them on Uniswap
  • Secondary market purchases

0xBitcoin Token

Information about 0xBitcoin token and its integration with B Zero X protocol.

0xBitcoin Overview

0xBitcoin is the first mineable ERC-20 token on Ethereum, implementing a proof-of-work consensus mechanism similar to Bitcoin. B Zero X integrates with 0xBitcoin to provide cross-ecosystem benefits and enhanced utility.

Token Details

  • Symbol: 0xBTC
  • Decimals: 8
  • Max Supply: 10,900,000 0xBTC
  • Mining Algorithm: No Longer Mineable

Integration Benefits

  • Seamless conversion with B0x
  • Enhanced liquidity pools
  • Cross-ecosystem mining rewards
  • Unified governance participation

Use Cases in B Zero X

  • Liquidity provision in 0xBTC/B0x pools
  • Conversion to B0x for staking participation
  • Staking for enhanced rewards
  • Cross-chain bridging opportunities

Team Information

Meet the core team behind B Zero X protocol development and community management.

Core Team Members

Our team combines extensive experience in blockchain development, DeFi protocols, and community building to deliver innovative solutions in the decentralized finance space.

U

Untouchable2k

Technical Lead

Senior blockchain engineer specializing in protocol optimization, security auditing, and mining infrastructure development.

P

PirateDC

Community Manager

Community strategist and project coordinator focused on ecosystem growth and user engagement across multiple platforms.

C

Crnxhh

Core Developer

Blockchain developer and protocol architect with expertise in smart contract development and Proof of Work Mining mechanisms.

Team Expertise

Blockchain Development

Smart contract architecture, protocol design, and security implementation across multiple networks.

DeFi Protocols

Liquidity mining, staking mechanisms, and yield optimization strategies in decentralized finance.

Community Building

Community engagement, educational content creation, and ecosystem growth strategies.

Mining Infrastructure

Proof-of-work implementation, difficulty adjustment algorithms, and mining optimization.

Contact the Team

The team is most active on Discord where they provide technical support, answer questions, and engage with the community. For business inquiries or partnership opportunities, reach out through LinkedIn or Twitter.

Note: All team members are available in the B Zero X Discord server for real-time community support and technical discussions.