EIPs Explained

ERC-1753 · Stagnant · ERC · 2019-02-06

ERC-1753: Smart Contract Interface for Licences

A stagnant proposal for issuing government-style licences and permits as on-chain records with validity dates, authority-controlled issue and revoke, and optional self-purchase.

What problem does it solve?

A licence (permit, grant) is a temporary, limited authority to do something that would otherwise be prohibited: camping in a national park, commercial fishing, driving a registered vehicle. Issuing and checking them is often paper-based: application forms, manual data entry into registries, paper certificates, and office visits to look anything up.

ERC-1753 proposes a simple smart-contract interface so an issuing authority can grant, revoke and verify licences on chain, and holders can show them from a wallet. The authors developed it after reviewing Australian licensing regulations, using a Kakadu National Park camping permit and a New South Wales commercial fishing licence as reference cases.

How it works

Each contract represents one kind of licence. It keeps:

  • a list of authorities: addresses allowed to issue and revoke;
  • per-holder records with a validity window (validFrom, validTo).
Function Purpose
name(), totalSupply() Licence name and number issued
grantAuthority(who) / revokeAuthority(who) / hasAuthority(who) Manage who may issue
issue(who, validFrom, validTo) Grant a licence for a date range
revoke(who) Cancel a licence
hasValid(who) Is there a currently valid licence?
purchase(validFrom, validTo) Holder buys a licence directly by paying a fee

Callers must handle functions that return false rather than assume success. Each address holds at most one licence per contract.

Sample code

A corrected minimal permit (the reference implementation in the EIP has the validity comparison reversed):

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract CampingPermit {
    struct Permit { uint64 validFrom; uint64 validTo; }

    string public constant name = "Example Camping Permit";
    uint256 public totalSupply;
    uint256 public constant FEE = 0.01 ether;   // illustrative

    address public immutable owner;
    mapping(address => bool) public hasAuthority;
    mapping(address => Permit) private _permits;

    constructor() { owner = msg.sender; }

    modifier onlyOwner() { require(msg.sender == owner, "owner"); _; }
    modifier onlyAuthority() { require(hasAuthority[msg.sender], "authority"); _; }

    function grantAuthority(address who) external onlyOwner { hasAuthority[who] = true; }
    function revokeAuthority(address who) external onlyOwner { hasAuthority[who] = false; }

    function issue(address who, uint64 from, uint64 to) external onlyAuthority { _issue(who, from, to); }
    function revoke(address who) external onlyAuthority { delete _permits[who]; }

    function hasValid(address who) external view returns (bool) {
        Permit memory p = _permits[who];
        return p.validFrom <= block.timestamp && block.timestamp <= p.validTo;
    }

    function purchase(uint64 from, uint64 to) external payable {
        require(msg.value == FEE, "fee");
        _issue(msg.sender, from, to);
    }

    function _issue(address who, uint64 from, uint64 to) internal {
        require(from <= to, "range");
        _permits[who] = Permit(from, to);
        totalSupply += 1;
    }
}

Things to know

  • Status is Stagnant.
  • The spec is minimal and loosely specified: the method list declares hasAuthority without a return type, and purchase in the reference code calls an authority-only issue, which would fail for ordinary users. Treat the reference as a sketch.
  • Licences are bound to an address but are not transferable tokens; for tradeable permits an ERC-721-based design is a more common choice.
  • Real licensing schemes involve personal data (names, contact details). Keep that off chain and store only what verification needs.
  • Whether an on-chain record has legal effect depends on the jurisdiction and the issuing authority; the standard does not address that.

#licence #permit #government #registry #stagnant

Details

Authors
Lucas Cullen (@BitcoinBrisbane), Kai Yeung (@CivicKai), Anna Crowley <[email protected]>, Caroline Marshall <[email protected]>, Katrina Donaghy <[email protected]>
Status
Stagnant
Type
Standards Track / ERC
Created
2019-02-06

Machine-readable: Markdown · JSON