-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERC-1888: Transferable Certificate (Claim) #1888
Comments
So I could potentially lend one of my tokens to somebody, and then call it back to my wallet, for example renting out a sword for a set amount of time for an X amount of funds, the person renting the item knows they will have the item until the contract completes and I know I will get it back exactly when I should guaranteed or am I not understanding this correctly? |
@XanderXioMvB : it more allows for revoking the validity of the token issued (a sword), which can be done on a pre-defined condition (lend time) in a transparent smart contract. You would not be in control of the token once you transfer it out, yet the game could potentially implement a simple mechanism to issue a new token (a sword) with pre-defined validity to be able to lend it to someone, keeping your sward as a deposit. After the lending time has passed the lend token would lose its validity and you could get your sword back from the deposit. |
@bytniak what is the purpose of |
Thanks for noticing @kosecki123 ! I updated the description. In general |
Hi @bytniak, Is there a reason I'd like to store more than 32 bytes as |
Hi @JosephBagaric , |
@bytniak we run into this problem with I think the easiest way to overcome that would be to make |
Is there any kind of paper that shows the different topics and data formats? Could someone define his own topic and data format? |
@kosecki123 @JosephBagaric the @KaddieIII there is no reference to topics and data formats at the moment anyone can define his own topics and data formats. This could be subject to standardization at the later stage. |
@bytniak Has there been an update of the interface to the latest solidity ^0.8.0? function batchIssue(bytes[] _data, uint256[] _topics, uint256[] _value, bytes32[] _signatures) external returns(uint256[]);
|
The spec has been updated based on your comments. @JosephBagaric |
Thanks @bytniak. I've updated our contracts to the latest spec interface and solc complained about the following:
function batchIssue(...) external returns (uint256[] memory ids);
function getCertificate(uint256 _id) external view returns (address issuer, uint256 topic, bytes memory validityCall, bytes memory data);
|
Thanks @JosephBagaric! All the points has been fixed. |
Thanks @bytniak, this looks great and works great in our codebase. :) |
Hello Is there a repo with an ERC-1888.sol example? Thank you |
Sure. We have an audited ERC-1888 implementation at Energy Web Foundation: |
Closing this issue for housekeeping purposes. People are welcome to continue discussing in this thread, but for additional visibility an EIP should be created or the conversation should be migrated to https://ethereum-magicians.org/ |
Simple Summary
A standard interface for a transferable certificate (claim). That extends highly flexible ERC-1155 Multi-token standard.
Abstract
This standard extends the ERC-1155 Multi Token Standard, with transferable certificate. The standard describes functions for issuing and claiming of transferable certificates.
These certificates are attested by third parties (issuers).
Primarily thought to accommodate the real-life needs of a utility sector (electricity, gas, water, heat).
Motivation
Tokens once issued are immutable by design. We cannot simply burn (invalidate) someone else's tokens, without their explicit permission. This design principle is not suitable for use cases where the data source, due to its nature cannot be 100% trusted, yet someone has to take that responsibility for the system to operate (i.e. utility sector).
In some real-life cases, there will be always certifying authorities (issuers) responsible for providing such data to the blockchain, without being in ultimate control of all the system end-points (i.e. utility metering devices at end-user premises).
Inspired by the concept of ERC-735 claims, the certificate itself is a light transferable claim which validity can be revoked by the issuer. Trust is here transferred to the issuers of the certificates.
ERC-1888 is not specific to the utility sector, and many other applications can potentially benefit from its additional features extending ERC-1155.
Definitions
issuer
: is another smart contract, which issues a transferable certificate.certificate
: A certificate is an information an issuer has about the certificate (on top of the token balance). This contains the following:topic
: uint256 number which represents the topic of the certificate. (e.g. 1: origin-of-electricity, 2: electricity-with-origin) EXACT NUMBERING SCHEME TBDissuer
: The issuer is a contract address itself, at which the claim can be verified using the call validityData.validityData
: validity call data to issuer. Contains the signature of the function to verify the certificate as well as encoded parameters of the function to ultimately check the validity of the certificate.issuenceData
: The hash of the certificate data, sitting in another location, a bit-mask, or actual data based on the certificate topic.Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Smart contracts implementing the ERC-1888 standard MUST implement the ERC1888, ERC1155 and ERC165interfaces.
Certificate Structure
The certificates issued is bounded to the tokenId. Returns the certificate's properties.
Methods
issue
Requests the ADDITION or the CHANGE of a certificate from an
issuer
.MUST pass the
_to
and_value
toERC1155.safeTransferFrom
function.MUST pass
0x0
as_from
toERC1155.safeTransferFrom
function.MUST follow the ERC-1155 standard regarding minting new tokens.
issuer
of the certificate SCHOULD bemsg.sender
Caller CAN be approved to issue new certificates, on top of ERC1155 token minting permission
MUST check validity of the certificate before continuing with the token minting
(i.e.
issuer.staticcall(validityData)
should return(true, )
)Possible certificate topics:
01
: Utilities01
: Electricity01
: Origin ("Green certificates")02
: Origin + Electricity03
: Flexibility04
: Flexibility + Electricity05
: Efficiency ("White certificates")02
: Water03
: Gas04
: Heat(TODO: standardize and add more topics)
topic
SCHOULD define thedata
format(i.e topic = 010101, could standardize format of the
data
to (uint48 startTime, uint48 endTime, address origin))Returns id: minted ERC-1155 tokenId according to ERC-1155 implementation
MUST emit IssuanceSingle upon successful token minting
batchIssue
Requests the ADDITION or the CHANGE of a certificate from an
issuer
.MUST pass the
_to
and_value
toERC1155.safeBatchTransferFrom
function.MUST pass
0x0
as_from
toERC1155.safeBatchTransferFrom
function.MUST follow the ERC-1155 standard regarding minting new tokens.
issuer
of the certificate SCHOULD bemsg.sender
.Caller CAN be approved to issue new certificates, on top of ERC1155 token minting permission
Each certificate in the batch MUST be validated against the same requrements as in the
issue
method.Returns array of id: minted ERC-1155 tokenIds according to ERC-1155 implementation
MUST emit IssuanceBatch upon successful token minting
safeTransferAndClaimFrom
Claims (burns) certificate for the
_to
while transferring._from
and_to
addresses CAN be equal, which would result in self claimSCHOULD pass the
_from
,_to
,_id
,_value
,_data
toERC1155.safeTransferFrom
functionMUST decrease the balance of the
_to
address by_value
MUST increase the claimedBalance of the
_to
address by_value
_claimData
additional data with format specified by thetopic
to be logged in ClaimBatch eventSCHOULD throw if the token _id lost validity.
MUST emit TransferSingle upon successful token burning
MUST emit ClaimSingle upon successful token burning
safeBatchTransferAndClaimFrom
Claims (burns) multiple certificates for the
_to
while transferring._from
and_to
addresses CAN be equal, which would result in self claimSCHOULD pass the
_from
,_to
,_ids
,_values
,_data
toERC1155.safeBatchTransferFrom
functionMUST decrease the corresponding
_ids[i]
balance of the_to
address by_values[i]
MUST increase the corresponding
_ids[i]
claimedBalance of the_to
address by_values[i]
MUST throw is the lengths of the
_ids
,_values
,_cliamData
are different_claimData
additional data with format specified by the certificatetopic
to be logged in ClaimBatch eventSCHOULD throw if any of the token _ids lost validity
MUST emit TransferBatch upon successful token burning
MUST emit ClaimBatch upon successful token burning
getCertifiate
Returns a certificate by
_id
claimedBalanceOf
Returns an
_owner
's claimed balance by_id
.claimedBalanceOfBatch
Returns an array of
_owners[i]
's claimed balance by_ids[i]
.Events
IssuanceSingle
MUST be triggered when certificate was successfully created.
_issuer
MUST bemsg.sender
IssuanceBatch
MUST be triggered when certificate batch was successfully created.
_issuer
MUST bemsg.sender
ClaimSingle
Either ClaimSingle or ClaimBatch MUST be emitted when certificates are claimed.
_claimIssuer
MUST be initial owner of the certificate (_from
address in safeTransferAndClaimFrom)_claimData
CAN contain additional data with format specified by certificatetopic
ClaimBatch
Either ClaimSingle or ClaimBatch MUST be emitted when certificates are claimed.
_claimIssuer
MUST be initial owner of the certificate (_from
address in safeBatchTransferAndClaimFrom)_claimData
CAN contain additional data with format specified by certificatetopics[i]
Rationale
uri
is already part of ERC-1155 therefore it has been omitted from the certificate specificationSolidity Interface
References
Articles & Discussions
Standards
Implementations
Copyright
Copyright and related rights waived via CC0.
The text was updated successfully, but these errors were encountered: