---
eip: 1753
label: ERC-1753
title: Smart Contract Interface for Licences
status: Stagnant
type: Standards Track
category: ERC
created: 2019-02-06
official: https://eips.ethereum.org/EIPS/eip-1753
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1753.md
canonical: https://eips.huatuo.xyz/zh/eip-1753/
lang: zh
tldr: 一个已停滞的提案，把政府式的执照和许可证作为链上记录发放，带有有效期、由主管机关控制的签发和撤销，以及可选的自行购买。
tags: [licence, permit, government, registry, stagnant]
---

# ERC-1753: Smart Contract Interface for Licences

> This Ethereum Improvement Proposal (EIP) proposes an Ethereum standard for the issuance of licences, permits and grants (Licences).

**TL;DR:** 一个已停滞的提案，把政府式的执照和许可证作为链上记录发放，带有有效期、由主管机关控制的签发和撤销，以及可选的自行购买。

## 它解决什么问题？

执照（许可、授权）是做某些本来被禁止的事情的临时、有限的权限：在国家公园露营、商业捕鱼、驾驶已登记的车辆。它们的签发和核查往往依赖纸质流程：申请表、手动录入注册系统、纸质证书，以及为了查询任何信息而去办公室。

ERC-1753 提出了一个简单的智能合约接口，使签发机关可以在链上授予、撤销和验证执照，持有人则可以通过钱包出示。作者在研究澳大利亚的执照法规后开发了它，并以卡卡杜国家公园露营许可和新南威尔士州商业捕鱼执照作为参考案例。

## 它如何运作

每个合约代表一种执照。它保存：

- 一份**主管机关（authority）**列表：被允许签发和撤销的地址；
- 每个持有人的记录，带有**有效期**（`validFrom`、`validTo`）。

| 函数 | 用途 |
| --- | --- |
| `name()`、`totalSupply()` | 执照名称和已签发数量 |
| `grantAuthority(who)` / `revokeAuthority(who)` / `hasAuthority(who)` | 管理谁可以签发 |
| `issue(who, validFrom, validTo)` | 授予一个日期范围内的执照 |
| `revoke(who)` | 取消执照 |
| `hasValid(who)` | 当前是否有有效的执照？ |
| `purchase(validFrom, validTo)` | 持有人通过支付费用直接购买执照 |

调用者必须处理返回 `false` 的函数，而不能假定一定成功。每个地址在每个合约中最多持有一份执照。

## 示例代码

一个修正过的最小许可合约（EIP 中的参考实现把有效期的比较写反了）：

```solidity
// 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;
    }
}
```

## 需要注意

- 状态为 **Stagnant**。
- 规范很精简，规定也较为宽松：方法列表声明了没有返回类型的 `hasAuthority`，参考代码中的 `purchase` 调用的是仅限主管机关的 `issue`，这对普通用户会失败。请把参考实现当作草图。
- 执照与地址绑定，但并不是可转让的代币；对于可交易的许可，基于 [ERC-721](/eip-721/) 的设计是更常见的选择。
- 真实的执照制度涉及个人数据（姓名、联系方式）。应把这些留在链下，只存储验证所需的内容。
- 链上记录是否具有法律效力取决于司法辖区和签发机关；该标准并未涉及这一点。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1753
