Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC-6366, a proposal for managing access rights through 256-bit permission sets.
The following explanation translates, summarizes, and expands on the original proposal.
ERC-6366 was at the Review stage as of January 9, 2024.
I also cover a range of other EIPs.
Overview
This proposal introduces a permission management mechanism that can serve as an alternative to conventional access control lists (ACLs).
It represents an Ethereum address's permissions using a uint256 value. As discussed in ERC-6617, individual bits represent distinct access rights.
Bitwise operations and masks enable compact permission checks and flexible combinations of rights. This can be more efficient than repeatedly comparing strings or role hashes, depending on the storage model and access pattern. A bit set to one indicates that its associated permission is present; a bit set to zero indicates that it is absent.
An application can implement a permission-checking function that uses a mask to determine whether an address holds all the rights required for a particular operation. This representation provides a compact way to manage permission sets, although the overall security of the system still depends on its authorization and update rules.
Motivation
Smart contracts frequently define roles such as Owner, Operator, Manager, and Validator. These roles are assigned to accounts authorized to administer or operate particular contracts. When permissions are managed separately by multiple contracts, auditing and maintaining the combined authorization state can become difficult.
ERC-6366 proposes representing rights and roles through an account's permission token balance within an ecosystem. A shared permission representation can simplify integrations among related contracts.
For example, an account holding an owner role may possess the bitmask associated with that role. Applications using a common permission registry can coordinate or transfer rights according to the rules of that registry.
Permission sets are also easier to inspect when an account's rights can be retrieved through a common interface. This may improve auditability and reduce duplicated permission-management logic. Independent ecosystems still need agreement on permission meanings and trust assumptions before interpreting one another's permission tokens.
Specification
The following specification uses Solidity 0.8.7 or later syntax.
Core interface
Conforming contracts must implement IEIP6366Core.
Defining individual permissions as powers of two is recommended so that ERC-6617-compatible set operations can be used to examine relationships between permission sets.
interface IEIP6366Core {
/**
* MUST trigger when `_permission` are transferred, including `zero` permission transfers.
* @param _from Permission owner
* @param _to Permission receiver
* @param _permission Transferred subset permission of permission owner
*/
event Transfer(address indexed _from, address indexed _to, uint256 indexed _permission);
/**
* MUST trigger on any successful call to `approve(address _delegatee, uint256 _permission)`.
* @param _owner Permission owner
* @param _delegatee Delegatee
* @param _permission Approved subset permission of permission owner
*/
event Approval(address indexed _owner, address indexed _delegatee, uint256 indexed _permission);
/**
* Transfers a subset `_permission` of permission to address `_to`.
* The function SHOULD revert if the message caller’s account permission does not have the subset
* of the transferring permissions. The function SHOULD revert if any of transferring permissions are
* existing on target `_to` address.
* @param _to Permission receiver
* @param _permission Subset permission of permission owner
*/
function transfer(address _to, uint256 _permission) external returns (bool success);
/**
* Allows `_delegatee` to act for the permission owner's behalf, up to the `_permission`.
* If this function is called again it overwrites the current granted with `_permission`.
* `approve()` method SHOULD `revert` if granting `_permission` permission is not
* a subset of all available permissions of permission owner.
* @param _delegatee Delegatee
* @param _permission Subset permission of permission owner
*/
function approve(address _delegatee, uint256 _permission) external returns (bool success);
/**
* Returns the permissions of the given `_owner` address.
*/
function permissionOf(address _owner) external view returns (uint256 permission);
/**
* Returns `true` if `_required` is a subset of `_permission` otherwise return `false`.
* @param _permission Checking permission set
* @param _required Required set of permission
*/
function permissionRequire(uint256 _permission, uint256 _required) external view returns (bool isPermissioned);
/**
* Returns `true` if `_required` permission is a subset of `_actor`'s permissions or a subset of his delegated
* permission granted by the `_owner`.
* @param _owner Permission owner
* @param _actor Actor who acts on behalf of the owner
* @param _required Required set of permission
*/
function hasPermission(address _owner, address _actor, uint256 _required) external view returns (bool isPermissioned);
/**
* Returns the subset permission of the `_owner` address were granted to `_delegatee` address.
* @param _owner Permission owner
* @param _delegatee Delegatee
*/
function delegated(address _owner, address _delegatee) external view returns (uint256 permission);
}Transfer
event Transfer(address indexed _from, address indexed _to, uint256 indexed _permission);Overview
Emitted when permissions are transferred.
Details
The event records the movement of a permission subset from its holder to another address. Transfers involving a zero-valued permission set must also be recorded according to the interface.
Parameters
_from- The address transferring permissions.
_to- The address receiving permissions.
_permission- The transferred permission subset, represented as a uint256.
Approval
event Approval(address indexed _owner, address indexed _delegatee, uint256 indexed _permission);Overview
Emitted when an approve operation succeeds.
Details
The event records the permission subset that an owner authorizes a delegatee to exercise. It allows external observers to track changes to delegated permissions.
Parameters
_owner- The permission owner's address.
_delegatee- The address receiving the delegation.
_permission- The approved permission subset, represented as a uint256.
transfer
function transfer(address _to, uint256 _permission) external returns (bool success);Overview
Transfers a subset of permissions to a specified address.
Details
The operation should revert if the caller does not hold the requested permission subset or if the destination already holds permissions that overlap with that subset. These checks help prevent unauthorized transfers and duplicated permission assignments.
Arguments
_to- The recipient of the permissions.
_permission- The permission subset to transfer.
Return value
success- A Boolean indicating whether the transfer succeeded.
approve
function approve(address _delegatee, uint256 _permission) external returns (bool success);Overview
Approves a subset of permissions for a delegatee.
Details
A permission owner uses this function to authorize a delegatee. A subsequent approval for the same delegatee replaces the existing approved permission set with the newly specified value. The operation should revert if the approved set is not a subset of the owner's available permissions.
Arguments
_delegatee- The address receiving delegated permissions.
_permission- The approved permission subset.
Return value
success- A Boolean indicating whether approval succeeded.
permissionOf
function permissionOf(address _owner) external view returns (uint256 permission);Overview
Returns the permissions associated with an address.
Details
The function returns the permission set held by the specified owner, allowing callers to inspect its currently assigned rights.
Arguments
_owner- The address whose permissions are being queried.
Return value
permission- The owner's permission set, represented as a uint256.
permissionRequire
function permissionRequire(uint256 _permission, uint256 _required) external view returns (bool isPermissioned);Overview
Checks whether a permission set contains all required permissions.
Details
The function determines whether _required is a subset of _permission.
It provides a common mechanism for checking whether one set of rights contains another.
Arguments
_permission- The available permission set.
_required- The required permission set.
Return value
isPermissioned- A Boolean indicating whether all required permissions are present.
hasPermission
function hasPermission(address _owner, address _actor, uint256 _required) external view returns (bool isPermissioned);Overview
Checks whether a specified actor is authorized to exercise the required permissions.
Details
The function evaluates whether the actor satisfies the required permission set, either through the applicable ownership relationship or through permissions delegated by the specified owner. This provides a common interface for checking authorization.
Arguments
_owner- The permission owner's address.
_actor- The address attempting to perform the operation.
_required- The required permission set.
Return value
isPermissioned- A Boolean indicating whether the actor is authorized.
delegated
function delegated(address _owner, address _delegatee) external view returns (uint256 permission);Overview
Returns the permissions delegated to a particular address.
Details
The function returns the permission subset that the specified owner has delegated to the specified delegatee. Callers can use it to inspect an individual delegation relationship.
Arguments
_owner- The permission owner's address.
_delegatee- The address receiving delegated permissions.
Return value
permission- The delegated permission set, represented as a uint256.
Metadata interface
IEIP6617Meta is an optional metadata interface that compatible contracts are recommended to implement where appropriate.
Its purpose is to provide descriptions of individual permissions and important combinations of permissions. These descriptions help users and applications understand the meanings of a contract's basic access rights and commonly used permission sets.
The metadata interface does not recommend defining a separate description for every possible subset. The number of combinations grows rapidly, making exhaustive descriptions impractical.
Describing the basic permissions and significant combinations instead provides a more manageable and transparent representation of the contract's authorization model.
Error interface
The following IEIP6366Error interface is optional.
interface IEIP6366Error {
/**
* The owner or actor does not have the required permission
*/
error AccessDenied(address _owner, address _actor, uint256 _permission);
/**
* Conflict between permission set
*/
error DuplicatedPermission(uint256 _permission);
/**
* Data out of range
*/
error OutOfRange();
}AccessDenied
error AccessDenied(address _owner, address _actor, uint256 _permission);Overview
Indicates that an owner or actor lacks the required permissions.
Details
The error identifies a failed authorization check involving the specified owner, actor, and permission set. It can be used to communicate insufficient access rights.
Arguments
_owner- The permission owner's address.
_actor- The address attempting the operation.
_permission- The required permission set.
DuplicatedPermission
error DuplicatedPermission(uint256 _permission);Overview
Indicates an overlap or duplication between permission sets.
Details
The error can be raised when an operation would create a duplicate or conflicting permission assignment. It helps identify invalid permission updates.
Arguments
_permission- The permission set involved in the conflict.
OutOfRange
error OutOfRange();Overview
Indicates that supplied data is outside the permitted range.
Details
The error can be raised when an argument exceeds the range accepted by the relevant function or implementation. It identifies invalid input that prevents the requested operation from proceeding.
Rationale
The original proposal identifies this section as requiring further discussion.
Implementation
The reference implementation is available here.
https://eips.ethereum.org/assets/eip-6366/contracts/EIP6366Core.sol
Security considerations
The original proposal identifies security considerations as requiring further discussion.
Citation
Chiro (@chiro-hiro), Victor Dusart (@vdusart), "ERC-6366: Permission Token [DRAFT]," Ethereum Improvement Proposals, no. 6366, January 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6366.
Conclusion
This article covered ERC-6366, a proposed permission token interface that uses 256-bit values to represent, transfer, and delegate access rights.
If you have questions, feel free to reach out via Twitter DM.
I also publish on the following platforms.


