A method for user identification and license fee measurement of smart contract based on blockchain
The method employs a RegCenter smart contract to manage user identification and license fee measurement for smart contracts, effectively addressing the challenges of user identification and fee calculation while balancing source code disclosure and intellectual property protection.
Patent Information
- Application Number
- PCT/CN2023/118734
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-09-14
- Publication Date
- 2025-02-20
AI Technical Summary
Existing technologies face challenges in effectively identifying smart contract users and quantifying the usage intensity to ensure reasonable license fee calculation, especially given the need to balance source code disclosure with intellectual property protection.
A method is introduced that utilizes a 'registration center' (RegCenter) smart contract to manage user identification and license fee measurement. This involves a 'many-to-one' key-value mapping for user numbers and a 'one-to-one' mapping for base point balances, enabling user registration, query, and royalty rate management.
The method effectively identifies smart contract users, accurately calculates usage intensity, and ensures consistent and complete license fee measurement, thereby addressing the balance between source code disclosure and intellectual property protection.
Smart Images

Figure CN2023118734_20022025_PF_FP_ABST
Abstract
Description
A method for user identification and license fee measurement of smart contract based on blockchainTechnical Field
[0001] The present invention is the second generation blockchain technology relates to the field of blockchain technology and characterized by distributed computing, cryptography, and Ethereum Virtual Machine, which can be automatically run on multiple distributed network nodes using virtual machine in the same sequence (hereinafter referred to “smart contract”).Background Art
[0002] Blockchain is a kind of distributed ledger technology, provides data sharing, verification, storage and calculation function through distributed network. The blockchain features with non-tamperable, traceable, safe and reliable, and is suitable for various scenarios, such as electronic evidence storage.
[0003] Smart contract is an automatic execution function that expresses an agreement between parties in the form of codes. It implements the addition, deletion, modification, and query operations of state variables on the blockchain through specific algorithmic logic. The bytecode compiled from the source code is persistently stored on the blockchain as special state data. Each time it is called to change state of the operation instructions of the blockchain (hereinafter referred to as "transaction instructions"), it is written to the blocks as a chain of database operation instructions in the order of occurrence, which cannot be tampered with, can be executed by multi-party verification, and extends one-dimensionally over time. The smart contract encodes the commercial, financial and legal agreements of all parties, and uses its publicity, non-tamperable and automatic execution characteristics to realize multi-party trust, collaboration and automatic transactions, eliminating the possibility of obligor breach of contract when the obligee exercises rights nature, and makes the formation, execution and breach of contract remedy process of commercial contracts without any third-party supervision, arbitration or human intervention.
[0004] The second generation blockchain possesses a specific account system, which can be divided into two types, "external account" and "contract account":
[0005] "External account" refers to an account controlled by external account owner using electronic signature technology with the core of an asymmetric encryption algorithm. The external account system of the blockchain system ensures that all smart contract operation command triggered outside the chain are electronically signed by the external account owner through external vendors such as electronic wallets. In this way, the operation commands issued by the external account can be effectively identified, and that the account address (hereinafter referred to as the "external account address") and the data can be effectively verified the content of the instruction have not been added, modified or lost.
[0006] "Contract account" refers to an account that is automatically generated when a smart contract is deployed to a virtual machine environment, and whose control logic is defined by the smart contract. The contract account can receive and send transaction instructions, triggering the execution of its internal code each time it receives a transaction instruction from an external account or other contract accounts. The address of the contract account on the blockchain (hereinafter referred to as the "contract account address") is unique and consistent with the external account address in byte length and technical specifications.
[0007] The contract account system of the second generation blockchain can realize the full-process tracking and identification of reading and writing operation instructions between smart contracts on the chain, so that the smart contract on the chain can effectively identify the reading and writing operation instructions it receives. The account address of the transaction initiating account, thereby further realizing user identification and permission verification of the distributed ledger system.Technical Problem
[0008] With the rapid development of blockchain, smart contracts have become an important technical means to realize various application scenarios. However, in the actual application process, the source code (or compiled bytecode) of the smart contract must be disclosed and publicized among the node operators and transaction participants. It is impossible to use traditional source code encryption and login access control. Centralized solutions such as remote user registration and user identification to realize user identification and intellectual property usage fee measurement have to face the following problems and challenges:
[0009] First, how to effectively identify the identity of smart contract users?
[0010] Second, how to quantify the calculation of the number or intensity of smart contract in order to ensure the calculation and collection of its license fees shall be reasonable?
[0011] Existing technology has not yet provided an effective solution to balance smart contract source code disclosure and intellectual property protection. Therefore, the new method related to the blockchain and smart contracts shall be invented to addressed the problem aforementioned.Technical Solution
[0012] The present invention provides a method for user identification and license fee measurement of smart contract based on blockchain, which can solve the contradiction between the publicity of the source code of the smart contract and its user confirmation and fee measurement. The present invention proposes the following technical solutions:
[0013] The present invention adds a smart contract named as “registration center” (the “RegCenter”) in the interaction within the external account, the contract account and the target smart contract ("Target Contract(s)") to realize the identification of the instruction-issuing account and the accurate calculation of the license fee. Specifically, the static logic of the present invention includes:
[0014] Deploy a RegCenter, which includes: a "many-to-one" key-value mapping with the account address as the search key and the user number as the search value ("UserNo Mapping" ); a "one-to-one" key-value mapping with the user number as the retrieval key and the base point balance as the retrieval value ("BasePoint Mapping"); a user registration function ("RegUser Function"), which automatically generates the user numbers in accordance with the source account address and stores them in the UserNo Mapping when it is called by any external account or contract account for the first time; a user search function ("GetUser Function" ), which searches the corresponding user number in accordance with the input account address, and transfers the a specific number of base points to the author user in the BasePoint Mapping. The input parameters defined by the Application Programming Interface (“API”) of the GetUser Function include: account address, a required parameters, is used to search and retrieve whether the user exists and user number; author user number, an optional parameter, is only used when the target contract managed by the RegCenter comes from multiple authors and to distinguish different smart contract developers; Royalty rate, an optional parameter, is only used when different license fee measurement royalty rates in accordance with different target contracts.
[0015] The design of the RegCenter allows external accounts and smart contracts of blockchain to obtain a unique "user number" with their account address as the "key" through the registration process. At the same time, the RegCenter uses this "user number" as the writing operation tag of target contract (see definition in below), to search the user number corresponding to the account based on the user query request sent by the target contract, and transfer the royalty rate of the user ("requesting user") to the author of target contract. In this way, the target contract users can be identified, the target contract usage quantity can be accurately calculated, and the basis for the target contract license fee can be generated.
[0016] The target smart contract is a smart contract on one or more chains, which is used to realize specific contract functions and set the writing operation permission for each user. The user number query function(“QueryUser Function”) preset in the target contract will automatically send a user number query request that conforms to the API definition of the GetUser Function to the RegCenter after receiving a writing operation instruction from an external account or contract account. The target contract confirms whether the user has the permission to perform writing operations based on the information issued from RegCenter. If the permission is granted, the writing operation will be performed, otherwise execution will be denied.Advantageous Effects
[0017] The present invention provides a method for user identification and license fee measurement of smart contract based on blockchain. This method sends a user query request to the RegCenter through the QueryUser Function preset in the target contract. The RegCenter searches the user number and transfers the base points from the requesting user to the author user, and then realizes the measurement of the license fee contained in the target contract through the user identification process. The method includes the following steps:
[0018] Step 1: the author of target contract and the user call the RegUser Function of RegCenter, register and obtain the corresponding user number with respective account address.
[0019] Step 2: after the target contract is deployed, when receiving a specific writing operation instruction from an external account or contract account, the QueryUser Function in the target contract is automatically triggered and executed, and a user query request is issued to the RegCenter, calling the GetUser Function.
[0020] In the present invention, the target contract will automatically carry the contract account address under the control of the blockchain when sending a user query request to the RegCenter.
[0021] Step 3: RegCenter automatically triggers and executes the GetUser Function after receiving the user query request, inquires in the UserNo Mapping the corresponding user number of the external account that sends the writing operation instruction. If the user number does not exist, then the failure message will be sent to the target contract; if the user number exists, Royalty rate of the user’s base point balance will be deducted from the user’s base point balance in accordance with its definition, and the use of the Royalty rate in the author’s user base point balance will increase, and finally the user number will be sent to the target contract.
[0022] In the present invention, the search operation and the transferring operation are atomic, transactional, and inseparable, that is, either succeed or fail simultaneously. This ensures the consistency and completeness of user identification and license fee measurement.
[0023] Step 4: after receiving the feedback of user number of the RegCenter, the target contract verifies whether the user possesses specific writing operation permission in accordance with the preset verification function.
[0024] Figure 1 is a static logical structure diagram of the present invention;
[0025] Figure 2 is a flow chart of the present invention.
[0026] To better clarify the purpose of the feature and advantage of the present invention, concrete codes are provided below.
[0027] / / SPDX-License-Identifier: UNLICENSED
[0028] / * *
[0029] * Copyright 2021-2023 LI LI of JINGTIAN & GONGCHENG.
[0030] * All Rights Reserved.
[0031] * * /
[0032] pragma solidity ^0.8.8;
[0033] / / RegCenter
[0034] contract RegCenter {
[0035] / / BasePoint Mapping: user number => base point balance
[0036] mapping(uint256 => uint) private _balanceOf;
[0037] / / User number registration mapping: account address => user number
[0038] mapping(address => uint) private _userNo;
[0039] / / User number Calculation
[0040] uint private _counterOfUsers;
[0041] / / Address of the owner of RegCenter
[0042] address private _owner;
[0043] constructor() {
[0044] / / Setting the owner of RegCenter as account holder
[0045] _owner = msg.sender;
[0046] }
[0047] / / RegUser Function;
[0048] function regUser() external {
[0049] / / Check: message from the account, never used for registration;
[0050] require(_userNo[msg.sender] == 0, "used key");
[0051] / / User number calculator plus one;
[0052] _counterOfUsers++;
[0053] / / Adopt the user number calculator as “User number”, setting the
[0054] minimum as ”1”;
[0055] _userNo[msg.sender] = _counterOfUsers;
[0056] }
[0057] / / GetUser Function
[0058] function getUserNo(address targetAddr, uint unitPrice, uint author)
[0059] external returns (uint) {
[0060] uint target = _userNo[targetAddr];
[0061] if (target > 0) {
[0062] / / Basic points are deducted from the "requesting user" to the "author user" based on the exercise Royalty rate.
[0063] if (_balanceOf[target] >= unitPrice) {
[0064] _balanceOf[target] -= unitPrice;
[0065] _balanceOf[author] += unitPrice;
[0066] } else revert("balance of target user is insufficient");
[0067] } else revert ("target address not registered");
[0068] return target;
[0069] }
[0070] / / Add a backup account to the user number: in accordance with the existing account instruction, add other accounts as the search key of the same user number, forming a "many-to-one" relationship.
[0071] function setBackupKey(address backupKey) external {
[0072] / / Check: Alternate key account, never used for registration;;
[0073] require (_userNo[backupKey] == 0, "used key");
[0074] uint user = _userNo[msg.sender];
[0075] if (user > 0) _userNo[backupKey] = user;
[0076] else revert ("msg.send not registered");
[0077] }
[0078] / / RegCenter owner charge the specific user “base points”
[0079] function mintPointsTo(uint user, uint amount) external {
[0080] require (msg.sender == _owner, 'only owner may mint points');
[0081] _balanceOf[user] = amount;
[0082] }
[0083] }
[0084] / / targeted smart contract
[0085] contract TargetContract {
[0086] RegCenter private _rc;
[0087] uint private _author;
[0088] uint private _data;
[0089] uint private _generalCounsel;
[0090] / / When deploying the target contract, preset the RegCenter address, the author's user number, and the user number of the presumed special permission user (general counsel);
[0091] constructor (address rc, uint author, uint gc) {
[0092] _rc = RegCenter(rc);
[0093] _author = author;
[0094] _generalCounsel = gc;
[0095] }
[0096] / / GetUser Function
[0097] function _msgSender(uint unitPrice) private returns(uint) {
[0098] return _rc.getUserNo(msg.sender, unitPrice, _author);
[0099] }
[0100] / / Specific writing operation: Assume that only the general counsel has the permission to set DATA. Therefore, before writing the operation, search the RegCenter to see whether the requesting user's number is equal to the general counsel’s number.
[0101] function setData(uint input) external {
[0102] require(_msgSender(200) == _generalCounsel, 'only general counsel may set data');
[0103] _data = input;
[0104] }
[0105] }
Claims
1. A method for user identification and license fee measurement of smart contracts based on blockchain, characterized by using the capability of Ethereum Virtual Machine (“EVM”) account system to identify and verify the account address of message sender, and through the algorithm defined by a smart contract named as “Registration Center” (the “RegCenter”) and an Application Programming Interface (“API”) embedded therein, simultaneously realizes the double purposes of user identification and license fee measurement of the target smart contracts (the “Target Contract(s)”). The method includes:Deploy the RegCenter to generate, assign, search and retrieve a specific user number to one or several EVM account(s), and automatically adjust and calculate the amount of license fees indicating by the balance amount of base points (the “Base Point(s)”) calculated as per the requests to the API of user number search;Embed a user number query function inside each of the writing operation functions of the Target Contracts, which is used to automatically call the API of user number to search of the RegCenter before the execution of the specific writing operation instructions, based on the user number retrieved from RegCenter the target smart contracts may further verify whether the message sender account has the permission for the specific writing operation.
2. The method of claim 1, with respect to the data structure and algorithm, wherein the RegCenter, is characterized by including:A user number mapping(the “UserNo Mapping”) with the account address as the retrieval key and the user number as the retrieval value;A Base Point balance mapping(the “BasePoint Mapping”) with the user number as the retrieval key and the base point balance as the retrieval value;A user registration function (the “RegUser Function”), which automatically generates user numbers as per the message sender account address and stores them in the UserNo Mapping when it is called for the first time by any external account or contract account;A user search function (the “GetUser Function”), which searches in the UserNo Mapping for the corresponding user number in accordance with the input account address, and transfers a specific amount of Base Points from the target contract user to the author user in the BasePoint Mapping.
3. The method of claim 1, with respect to the data structure and algorithm, wherein the Target Contracts, is characterized by including a user number query function (the “QueryUserFunction”), which can be automatically triggered to send a user query request conforming to the API of the GetUser Function to the RegCenter before performing each of the writing operations that requires front end identification check.
4. The method described in claims 1 to 3, with respect to the API definition and input parameters of the GetUser Function, is characterized by including:Account address, a required parameter, is used to search and retrieve whether the user exists and the respective user number thereof;Author user number, an optional parameter, is only used when the Target Contracts managed by the RegCenter composed by multiple authors, and to distinguish different smart contract developers;Royalty rate, an optional parameter, is only used when different writing operations of the Target Contracts need to define different license prices.
5. The method of claim 1, with respect to identifying and verifying the user of Target Contracts, is characterized by including the following steps:Step 1: The author and user of the Target Contracts call the RegUser Function of the RegCenter respectively, register and obtain the user number corresponding to their account address;Step 2: After deploying the Target Contract, when receiving a specific writing operation instruction from an external account or contract account, the QueryUser Function in the Target Contract will be automatically triggered to send a user query request to the RegCenter to call the GetUser Function;Step 3: After receiving the user query request, the RegCenter automatically triggers and executes the GetUser Function, searching in the UserNo Mapping for the user number of the Target Account that sent the writing operation instruction to the Target Contract. If no corresponding user number is found, it sends failure message to the Target Contract; if it finds the user number (the “Target UserNo”) corresponding to the Target Contract Account, a sum of Base Points will be deducted from the target user’s balance in the BasePoint Mapping, and be added to the author’s balance, and the Target UserNo will be responded to the Target Contract;Step 4: After receiving the Target UserNo from the RegCenter, the Target Contract verifies whether the Target Account has specific writing operation authorities according to its predefined rules and procedures concerned.
Citation Information
Patent Citations
Ciphertext retrieval fair payment method and system based on block chain
CN110599147A
Identity management method and device on blockchain
CN112364311A
Charging method and device for smart contract calling of block chain, and storage medium
CN115883267A
User identification and intelligent contract permission fee metering method based on block chain technology
CN117113306A
Distributed Ledger Device and Distributed Ledger Method for Token Issuance and User Identification Management Based on Block Chain
KR101878870B1