2.2 Fee Structure

Minting a handle:

Users can mint their handle for 2 years at the price of 1 year. It's important to note that handles with 5 to 18 characters are free to mint.

Minting a sub-handle

Users can mint their sub-handle for any duration. However, parent owners can mint sub-handles under their handle for only 1 year at no cost per transaction.

Handle and Sub-Handle Fees:


 // Initialize handle fees for character counts 1 to 4
        handleFees[1] = 1000000000000000000 wei; // 1 btc
        handleFees[2] = 250000000000000000 wei; // .25 btc
        handleFees[3] = 15000000000000000 wei; // 0.015 btc
        handleFees[4] = 5000000000000000 wei; // 0.005 btc

        // Initialize subhandle fees for character counts 1 to 4
        subhandleFees[1] = 500000000000000000 wei; // .5 btc
        subhandleFees[2] = 125000000000000000 wei; // 0.125 btc
        subhandleFees[3] = 7500000000000000 wei; // 0.0075 btc
        subhandleFees[4] = 2500000000000000 wei; // 0.0025 btc

        // Initialize handle and subhandle fees for character counts 5 to 14
        for (uint256 i = 5; i <= 14; i++) {
            handleFees[i] = 200000000000000 wei; // 0.0002 btc
            subhandleFees[i] = 200000000000000 wei; // 0.0002 btc
        }

        // Initialize handle and subhandle fees for character counts 15 to 18
        for (uint256 i = 15; i <= 18; i++) {
            handleFees[i] = 100000000000000 wei; // 0.0001 btc
            subhandleFees[i] = 100000000000000 wei; // 0.0001 btc
        }

Handle Fees

The contract employs a variable fee structure that considers character count, registration duration, and halving intervals. Registration fees for handles are collected to incentivize the StudyBitcoin team and to support maintenance and future development efforts. *Please note that Handles with 5 to 18 characters are free to mint but incur a fee for renewal. If the Handle expires, it gets burned and becomes free to mint again with a new token ID.

Sub-Handle Fees

Sub-handle registration fees are fully allocated to the parent handle owner. However, the parent handle owner can register a sub-handle under their handle free of charge for one year per transaction and renew it for up to one year per transaction.


function calculateFee(uint256 characterCount, uint256 registrationYears, bool isSubhandle) internal view returns (uint256) {
        // Validate the character count, ensuring it is within the allowed range.
        require(characterCount >= MINIMUM_CHARACTER_COUNT && characterCount <= MAX_CHARACTER_LENGTH, "Invalid character count");
        
        // Calculate the time elapsed since the contract was deployed.
        uint256 timeElapsed = block.timestamp - contractDeploymentTime;
        // Calculate the number of halving periods that have passed, approximately 8 years each.
        uint256 halvingCount = timeElapsed / HALVING_PERIOD;

        // Reset the cycle back to 1 after the 9th cycle, to maintain a 9-cycle pattern.
        uint256 currentCycle = (halvingCount % 9) + 1;
        
        // Determine the base fee based on whether it's a handle or subhandle registration.
        uint256 fee = isSubhandle ? subhandleFees[characterCount] : handleFees[characterCount];
        fee = fee * registrationYears; // Multiply the base fee by the number of registration years.

        // If the character count is 1 to 4, adjust the fee based on the current cycle.
        if (characterCount <= 4) {
            fee = fee / (2 ** (currentCycle - 1)); // Subtract 1 to start from cycle 1
        }

        return fee; // Return the calculated fee.
    }

Fees are halved every 8 years until the 9th cycle, after which they reset to the initial registration fees and continue halving in a loop. The initial fees for 5 to 18 characters remain the same throughout every cycle.

5 to 18 characters handles become more valuable than 4 characters with each cycle as the fees for 4 characters halve each time.

5 to 18 characters sub-handles become more valuable than 3-4 characters with each cycle as the fees for 3-4 characters halve each time;

this was by design.

Sub-Handle Permission Fees


/**
    * Toggles the permission for a subhandle under a parent handle.
    * @param parentHandleName The name of the parent handle.
    */
    function toggleSubhandlePermission(string memory parentHandleName) external payable {
        // Check if the parent handle name is not empty.
        require(bytes(parentHandleName).length > 0, "Invalid parent handle name");

        // Construct the full parent handle name with the suffix.
        string memory parentHandleWithSuffix = string(abi.encodePacked(parentHandleName, ".", string(HANDLE_SUFFIX)));

        // Get the parent handle storage from the mapping.
        Handle storage parentHandle = handles[parentHandleWithSuffix];
         // Check if the parent handle is registered.
        require(parentHandle.tokenId != 0, "Parent handle not registered");
        // Check if the caller is the owner of the parent handle.
        require(msg.sender == parentHandle.parentOwner, "Only the parent handle owner can toggle permission");

        // Get the parent handle permissions storage from the mapping.
        ParentHandle storage parentPermissions = parentHandleOwners[msg.sender][parentHandleWithSuffix];

        // Check if the permission is currently disabled.
        if (!parentPermissions.permissionEnabled) {
            // Charge a fee of 0.0029 btc to enable
            require(msg.value == 2900000000000000 wei, "Invalid fee amount");

            // Transfer the fee to the feeRecipient
            payable(feeRecipient).transfer(msg.value);
        }

        parentPermissions.permissionEnabled = !parentPermissions.permissionEnabled; // Toggle permission

        uint256 tokenId = parentHandle.tokenId; // Get the token ID of the parent handle.

        // Emit an event to notify of the permission toggle.
        emit SubhandlePermissionToggled(
            msg.sender,
            parentHandleWithSuffix,
            parentPermissions.permissionEnabled,
            tokenId
        );
    }

Permission defaults to 'off' upon minting. There's a fixed fee of 0.0029 rBTC to activate the sub-Handle mint, enabling other users to freely mint a sub-handle under a parent handle. Deactivation is free, but transferring the Parent Handle to another address will reset the status to 'off'.

Last updated