Alert Source Discuss
🚧 Stagnant Standards Track: ERC

ERC-1491: 人力成本核算标准 (类似 Gas 但用于人类)

Authors Iamnot Chris (@cohabo)
Created 2018-10-12
Discussion Link https://github.com/freeworkculture/kazini/issues/11

简单概要

人力资本核算代币的标准接口。

摘要

以下标准允许在智能合约中实现 HUCAP 代币的标准 API。 该标准提供了发现、跟踪和转移人力资源激励层级的基本功能。虽然区块链架构通过透明性成功地实现了诚信的金融化; 相应地,真实世界的结果将与通过知识实现资本个体化的程度成正比。

动机

以太坊协议架构具有确定性的世界观,该世界观受限于提供意图和逻辑的人类领域的随机现实。 黄皮书正式将 EVM 定义为仅具有确定性参数和状态转换算子的状态机。 对另一个链上合约的 Oracle 请求和/或链下 HTTP 查找仍然构成多个确定性事务。

一个允许评估个人能力(与产出和整体知识库同时进行)的标准接口将降低市场搜索成本,并增加有意识的创新自主插入到区块链生态系统中。 我们提供简单的智能合约来定义和跟踪任意数量的 HUCAP 资产。 下面讨论了其他应用。

信念-欲望-意图模型是一个计划理论框架,用于在基于代理的建模系统中建立手段-目的的一致性。 区块链的密码安全架构可靠地扩展到基于区块链的 PKI Web信任层级。 ERC-20 代币标准允许以太坊上的任何代币被其他应用程序重用:从钱包到去中心化交易所。 ERC-721 代币标准允许钱包/经纪人/拍卖应用程序与以太坊上的任何 NFT 一起使用。 ERC-1155 Crypto Item 标准允许一个智能合约接口,在该接口中,可以用单个合约表示任意数量的 ERC-20 和 ERC-721 资产。

该标准受到迈克尔·布拉特曼 (Michael Bratman) 开发的人类实践推理的信念-欲望-意图 (BDI) 模型的启发,该模型是一种解释未来导向意图的方式。 BDI 代理是一种特殊的有界理性软件代理,具有特定的心理特征,即:信念 (Beliefs)、欲望 (Desires) 和意图 (Intentions) (BDI)。 该模型将承诺确定为欲望和意图之间的区别因素,以及导致 (1) 计划中的时间持久性和对时间的明确参考意义,(2) 在已经承诺的基础上制定进一步的计划,(3) 计划的层级性质的重要属性,因为总体计划在执行辅助计划时仍然有效。

BDI 软件模型试图解决计划和计划选择以及执行的问题。 其补充提供了足够的指标来指示手段-目的的一致性,并将成本基线归因于此类结果。

规范

主要接口

pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;

/**
    @title ERC-**** 人力资本核算标准
    @dev See https://github.com/freeworkculture/kazini/issues/11
    Note: the ERC-165 identifier for this interface is 0xf23a6e61.
 */

interface IERC_HUCAP {

    /**
        @notice Compute the index value of an Agents BDI in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function updateIndex() internal returns (bool);

    /**
        @notice Get the active/inactive and states of an Agent in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function iam() view public returns (bool iam_, IERC_HUCAP_TYPES.IS state_);

    /**
        @notice Fetch the bdi index value of an Agent in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function index() view public returns (uint8 index_);
    
    /**
        @notice Count of Public Keys in key ring of an Agent in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function ringLength() view public returns (uint ringlength_);

    /**
        @notice Get the PGP Public Key Id of an Agent in the ecosystem.
        @param "" Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */  
    function keyId() view public returns (bytes32 KEYID_);

     /**
        @notice Get the merit data of an Agent in the ecosystem.
        @param "" Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */   
    function merits() view public returns (
        uint experience_,
        bytes32 reputation_,
        bytes32 talent_,
        uint8 index_,
        bytes32 hash_);

    /**
        @notice Get the accreditation of an Agent in the ecosystem.
        @param "" Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function kbase() view public returns (IERC_HUCAP_TYPES.KBase kbase_);

    /**
        @notice Get the desire of an Agent in the ecosystem.
        @param _desire    Pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function desire(bytes1 _desire) view external returns (bytes32);

    /**
        @notice Get the intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function intention(bool _intention) view external returns  (bytes32);
    
    /**
        @notice Cycle the intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function flipIntention() external returns  (bool);
    

    /**
        @notice Get the user data of an Agent in the ecosystem.
        @param ""    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function getDoer() view external returns  (
        bytes32 fPrint,
        bool iam_,
        bytes32 email,
        bytes32 fName,
        bytes32 lName,
        uint age,
        bytes32 data_);

    /**
        @notice Get the belief data of an Agent in the ecosystem.
        @param _kbase    Source address
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function getBelief(IERC_HUCAP_TYPES.KBase _kbase) view external returns  (
        bytes32 country_,
        bytes32 cAuthority_,
        bytes32 score_);

    /**
        @notice Get the desire data of an Agent in the ecosystem.
        @param _desire    Pro-attitides
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function getDesire(bytes1 _desire) view external returns  (bytes32,bool);

    /**
        @notice Get the intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function getIntention(bool _intention) view external returns  (IERC_HUCAP_TYPES.IS,bytes32,uint256);

    /**
        @notice Sign the Public Key of an Agent in the ecosystem.
        @param _address    Address of key to sign, must belong to an Agent 
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function sign(address _address) public onlyOwner returns (uint, bool signed);

    /**
        @notice Sign the Public Key of an Agent in the ecosystem.
        @param ""    internal helper function to add key in keyring
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function sign() external onlyDoer returns (uint, bool signed);

    /**
        @notice Revoke the Public Key of an Agent in the ecosystem.
        @param _address    Address of key to revoke, must belong to an Agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function revoke(address _address) external onlyDoer returns (uint, bool revoked);

    /**
        @notice Revoke the Public Key of an Agent in the ecosystem.
        @param ""    internal helper function to remove key from keyring
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function revoke() external onlyDoer returns (uint, bool revoked);

    /**
        @notice Set the trust level for a Public Key of an Agent in the ecosystem.
        @param _level    Degree of trust
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function trust(Trust _level) returns (bool);

    /**
        @notice Increment the number of keys in the keyring of an Agent in the ecosystem.
        @param _keyd    Target key
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function incSigns(bytes32 _keyd) external ProxyKey returns (uint);

    /**
        @notice Decrement the number of keys in the keyring of an Agent in the ecosystem.
        @param _keyd    Target key
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function decSigns(bytes32 _keyd) external ProxyKey returns (uint);

    /**
        @notice Set the knowledge credentials of an Agent in the ecosystem.
        @param _kbase    Level of accreditation
        @param _country      Source country
        @param _cAuthority     Accreditation authority
        @param _score  Accreditation 
        @param _year Year of Accreditation
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(
        KBase _kbase,
        bytes32 _country,
        bytes32 _cAuthority,
        bytes32 _score,
        uint _year
        ) external ProxyBDI returns (bool qualification_);

    /**
        @notice Set the SNA metrics of an Agent in the ecosystem
        @param _refMSD    Minimum shortest distance
        @param _refRank      Rank of target key
        @param _refSigned     No of keys signed I have signed
        @param _refSigs  No. of keys that have signed my key
        @param _refTrust Degree of tructThrows on any error rather than return a false flag to minimize user errors
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(
        uint _refMSD,
        uint _refRank,
        uint _refSigned,
        uint _refSigs,
        bytes32 _refTrust
        ) external ProxyBDI returns (bool reputation_);

    /**
        @notice Set the talents of an Agent in the ecosystem
        @param _talent    Agent's talent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(bytes32 _talent) external ProxyBDI returns (bool talent_);

    /**
        @notice Set the desires of an Agent in the ecosystem
        @param _desire    Pro-attitude
        @param _goal      A goal is an instatiated pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(bytes1 _desire, Desire _goal) public onlyDoer returns (bool);

    /**
        @notice Set the intention of an Agent in the ecosystem
        @param _service    Conducting-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(Intention _service) public onlyDoer returns (bool);
    
    /**
        @notice Set the targeted intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @param _state      Agent stance       
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors

    */
    function intention(bool _intention, IERC_HUCAP_TYPES.IS _state) external returns  (IERC_HUCAP_TYPES.IS);

/* End of interface IERC_HUCAP */
}


用户定义类型扩展接口


interface IERC_HUCAP_TYPES {

/* Enums*/

    // Weights	   1,		2,		 4,		    8,		   16,	    32,		64,	    128    256
    enum KBase {PRIMARY,SECONDARY,TERTIARY,CERTIFICATION,DIPLOMA,LICENSE,BACHELOR,MASTER,DOCTORATE}
    
    
    enum IS { CLOSED, CREATOR, CURATOR, ACTIVE, INACTIVE, RESERVED, PROVER }

/* Structus */

        struct Clearance {
        bytes32 Zero;
        bytes32 Unknown;
        bytes32 Generic;
        bytes32 Poor;
        bytes32 Casual;
        bytes32 Partial;
        bytes32 Complete;
        bytes32 Ultimate;
    }
/* End of interface IERC_HUCAP_TYPES */
}

Web-of-trust 扩展接口

pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;

interface IERC_HUCAP_KEYSIGNING_EXTENSION {

    bytes32 constant public _InterfaceId_ERC165_        = "CREATOR 0.0118 XOR OF ALL FUNCTIONS IN THE INTERFACE";   // Complies to ERC165

//  KEY MASKING TABLE
//  bytes32 constant public MASK 			   		    = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
//  bytes32 constant public KEYID                       = 0xffffffffffffffffffffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56; // EXAMPLE PGP PUBLIC KEY ID
//  bytes32 constant public KEY_CERTIFICATION 		    = 0x01ffffffffffffff << 192; // “C”	Key Certification
//  bytes32 constant public SIGN_DATA   			    = 0x02ffffffffffffff << 192; // “S”	Sign Data
//  bytes32 constant public ENCRYPT_COMMUNICATIONS 	    = 0x04ffffffffffffff << 192; // “E”	Encrypt Communications
//  Clearance constant public Trust                     = 0x03ff << 192; // Trust: Unknown
                                                        // BYTES32 Value with 
                                                        // Public Key Id, masking
                                                        // Key Certification masking
                                                        // Split Key masking
                                                        // Generic masking
                                                        // Ordinary masking
                                                        //  Trust.Unknown masking
                                                        //  bytes32 constant public DOER = 0x11ff10ff100f03ffff00ffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56;

    bytes32 constant public KEY_CERTIFICATION 		    = 0x01ffffffffffffff << 192; // “C”	Key Certification
    bytes32 constant public SIGN_DATA   			    = 0x02ffffffffffffff << 192; // “S”	Sign Data
    bytes32 constant public ENCRYPT_COMMUNICATIONS 	    = 0x04ffffffffffffff << 192; // “E”	Encrypt Communications
    bytes32 constant public ENCRYPT_STORAGE  		    = 0x08ffffffffffffff << 192; // “E”	Encrypt Storage
    bytes32 constant public SPLIT_KEY   			    = 0x10ffffffffffffff << 192; // Split key
    bytes32 constant public AUTHENTICATION   		    = 0x20ffffffffffffff << 192; // “A”	Authentication
    bytes32 constant public MULTI_SIGNATURE			    = 0x80ffffffffffffff << 192; // Held by more than one person
    bytes32 constant public TRUST_AMOUNT                = 0xffffffffffff00ff << 192;
    bytes32 constant public BINARY_DOCUMENT             = 0xffff00ffffffffff << 192; // 0x00: Signature of a binary document.
    bytes32 constant public CANONICAL_DOCUMENT          = 0xffff01ffffffffff << 192; // 0x01: Signature of a canonical text document.
    bytes32 constant public STANDALONE_SIGNATURE        = 0xffff02ffffffffff << 192; // 0x02: Standalone signature.
    bytes32 constant public GENERIC                     = 0xffff10ffffffffff << 192; // 0x10: Generic certification of a User ID and Public-Key packet.
    bytes32 constant public PERSONA                     = 0xffff11ffffffffff << 192; // 0x11: Persona certification of a User ID and Public-Key packet.
    bytes32 constant public CASUAL                      = 0xffff12ffffffffff << 192; // 0x12: Casual certification of a User ID and Public-Key packet.
    bytes32 constant public POSITIVE                    = 0xffff13ffffffffff << 192; // 0x13: Positive certification of a User ID and Public-Key packet.
    bytes32 constant public SUBKEY_BINDING              = 0xffff18ffffffffff << 192; // 0x18: Subkey Binding Signature
    bytes32 constant public PRIMARY_KEY_BINDING         = 0xffff19ffffffffff << 192; // 0x19: Primary Key Binding Signature
    bytes32 constant public DIRECTLY_ON_KEY             = 0xffff1Fffffffffff << 192; // 0x1F: Signature directly on a key
    bytes32 constant public KEY_REVOCATION              = 0xffff20ffffffffff << 192; // 0x20: Key revocation signature
    bytes32 constant public SUBKEY_REVOCATION           = 0xffff28ffffffffff << 192; // 0x28: Subkey revocation signature
    bytes32 constant public CERTIFICATION_REVOCATION    = 0xffff30ffffffffff << 192; // 0x30: Certification revocation signature
    bytes32 constant public TIMESTAMP                   = 0xffff40ffffffffff << 192; // 0x40: Timestamp signature.
    bytes32 constant public THIRD_PARTY_CONFIRMATION    = 0xffff50ffffffffff << 192; // 0x50: Third-Party Confirmation signature.
    bytes32 constant public ORDINARY   				    = 0xffffffff100fffff << 192;
    bytes32 constant public INTRODUCER 				    = 0xffffffff010fffff << 192;
    bytes32 constant public ISSUER	   				    = 0xffffffff001fffff << 192;

//  EDGES MASKING TABLE
    Clearance internal TRUST = Clearance({
        Zero:       0x01ff << 192,
        Unknown:    0x03ff << 192,
        Generic:    0x07ff << 192,
        Poor:       0xF0ff << 192,
        Casual:     0xF1ff << 192,
        Partial:    0xF3ff << 192,
        Complete:   0xF7ff << 192,
        Ultimate:   0xFFff << 192
        });

    /**
    /// @notice Cycle through state transition of an Agent in the ecosystem.
    /// @param _address toggle on/off a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function flipTo(address _address) external onlyOwner returns (IS);

    /**
    /// @notice Turn Agent in the ecosystem to on/off.
    /// @param _address toggle on/off a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function toggle(address _address) external onlyOwner returns (bool);

    /**
    /// @notice Set the trust level of an Agent in the ecosystem.
    /// @param _level toggle on/off a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function trust(Trust _level) returns (bytes32 Trust);

    event LogCall(address indexed from, address indexed to, address indexed origin, bytes _data);

/* End of interface IERC_HUCAP_KEYSIGNING_EXTENSION */
}

人力资本核算扩展接口

pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;

interface IERC_HUCAP_TRACKUSERS_EXTENSION {

    /// @notice Instantiate an Agent in the ecosystem with default data.
    /// @param _address initialise a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    function initAgent(Doers _address) external onlyControlled returns (bool);

    /// @notice Get the data by uuid of an Agent in the ecosystem.
    /// @param _uuid Get the address of a unique uid
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function getAgent(bytes32 _uuid) view external returns (address);

    /// @notice Get the data of all Talents in the ecosystem.
    /// @param _address Query if address belongs to an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function iam(address _address) view public returns (bool);

    /// @notice Get the data of all Talents in the ecosystem.
    /// @param _address Query if address belongs to a doer
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function isDoer(address _address) view public returns (IS);

    /// @notice Get the number of doers that can be spawned by a Creators.
    /// The query condition of the contract
    //  @dev `anybody` can retrieve the count data in the contract
    */
    function getAgent(address _address)
    view public returns (bytes32 keyid_, IS state_, bool active_, uint myDoers_);

    /// @notice Get the data of all Talents in the ecosystem.
    /// @param _talent The talent whose frequency is being queried
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function getTalents(bytes32 _talent)
    view external returns  (uint talentK_, uint talentI_, uint talentR_, uint talentF_);

    /// @notice Increment a kind of talent in the ecosystem.
    /// @param The talent whose frequency is being queried
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function incTalent() payable public onlyDoer returns (bool);

    /// @notice Decrement a kind of talent in the ecosystem..
    /// @param The talent whose frequency is being queried
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function decTalent() payable public onlyDoer returns (bool);

    /// @notice Set the Public-Key Id of an Agent in the ecosystem.
    /// @param _address Set the Public-key Id of an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function setAgent(address _address, bytes32 _keyId) external onlyControlled returns (bytes32);

    /// @notice Transition the states of an Agent in the ecosystem.
    /// @param _address Set the stance of an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function setAgent(address _address, IS _state) external onlyControlled returns (IS);

    /// @notice Set the active status of an Agent in the ecosystem.
    /// @param _address Toggle the true/false status of an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function setAgent(address _address, bool _active) external onlyControlled returns (bool);

    /// @notice Set the data of all Intentions of Agents in the ecosystem.
    /// @param _serviceId Track number of offers available
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function setAllPromises(bytes32 _serviceId) external onlyControlled;

/* End of interface IERC_HUCAP_TRACKUSERS_EXTENSION */
}


理由

[WIP]

向后兼容性

[WIP]

测试用例

[WIP]

实现

[WIP]

版权

版权及相关权利通过 CC0 放弃。

Citation

Please cite this document as:

Iamnot Chris (@cohabo), "ERC-1491: 人力成本核算标准 (类似 Gas 但用于人类) [DRAFT]," Ethereum Improvement Proposals, no. 1491, October 2018. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1491.