- Protocol
We go with same old PA IssueModes:
class IssueMode(Enum):
NONE = 0x00
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L19
# No issuance allowed.
CUSTOM = 0x01
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L20
# Custom issue mode, verified by client aware of this.
ONCE = 0x02
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L21
# A single card_issue transaction allowed.
MULTI = 0x04
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L22
# Multiple card_issue transactions allowed.
MONO = 0x08
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L23
# All card transaction amounts are equal to 1.
UNFLUSHABLE = 0x10
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L24
# The UNFLUSHABLE issue mode invalidates any card transfer transaction except for the card issue transaction.
# Meaning that only the issuing entity is able to change the balance of a specific address.
# To correctly calculate the balance of a PeerAssets addres a client should only consider the card transfer
# transactions originating from the deck owner.
SUBSCRIPTION = 0x34 # SUBSCRIPTION (34 = 20 | 4 | 10)
# https://github.com/PeerAssets/rfcs/blob/master/0001-peerassets-transaction-specification.proto#L26
# The SUBSCRIPTION issue mode marks an address holding tokens as subscribed for a limited timeframe. This timeframe is
# defined by the balance of the account and the time at which the first cards of this token are received.
# To check validity of a subscription one should take the timestamp of the first received cards and add the address' balance to it in hours.
SINGLET = 0x0a # SINGLET is a combination of ONCE and MONO (2 | 8)
# Singlet deck, one MONO card issunce allowed
For NFT, appropriate issue mode would be SINGLET=0x0a
.
In ethereum world, NFTs with multiple issuance exist as well. No matter how silly that sounds.
That would be MONO=0x08
.
For start we should just do singlets.
- Data format
This is an example of internal representation in python:
class Deck:
version = version # protocol version
name = name # deck name
issue_mode = issue_mode # deck issue mode
number_of_decimals = number_of_decimals # sometime this is mandated by issue mode
metadata = asset_specific_data # optional metadata for the deck, for example link to a JPEG would go here
issuer = issuer
- Announce
A PeerAssets transaction encodes itās information in the transactionās inputs (
vin[]
), outputs (vout[]
)
and a special meta-data output (OP_RETURN
).
A txn where:
* `vin[0]`: The owner of the Asset. Ownership of the asset is proven by proving ownership over the Public Key Hash (PKH) or Script Hash (SH) originating `vin[0]`.
* `vout[0]`: Deck spawn tag using a P2TH output. This tag registers the assets as a PeerAsset so that it can be discovered by PeerAsset clients. This is a zero output.
* `vout[1]`: (`OP_RETURN`) Asset meta-data. A [protobuf3 encoded message][1] containing meta-data about the asset.
* all other in and outputs are free to be used in any way. `vout[2]` will typically be used as a change output.
Such txn is sent to a dedicated P2TH, this can be existing PAprodbYvZqf4vjhef49aThB9rSZRxXsM6
but we can also invent a new one just for NFTs.
Resulting txid becomes the ID of the asset.
- Send cards (NFT)
For the card transfer transaction, the following properties are specified:
vin[0]
: The sending party of the transfer transaction.vout[0]
: Asset tag using a [P2TH] output based on the assetās unique identifier.
This tag makes it easy for nodes to follow transactions of a specific asset.vout[1]
: (OP_RETURN
) Asset transfer data. [protobuf3 encoded message][1] containing the amount of transferred assets and optionally some meta-datavout[n+2]
: The receiving parties of the transfer transaction. vout[n+2] receives the n-th (starting with 0) amount specified in the asset transfer data message.- all other in and outputs are free to be used in any way.
vout[2+receiver_cnt]
will typically be used as a change output.
- Futher reading on announcing decks and sending cards
- Unresolved questions
- Do we need to define the format for metadata? Specifically for links to external data like .jpegs/.gifs and so on.
- Do we drop both hash and file link into the generic āmetadataā field or we split it up into more fields?
- Do we default to IPFS like Ethereum ecosystem or we allow more flexibility and allow standard HTTPS links or even .torrent?
- Selling and buying these NFTs?
- Do we give up on this deck announcement process, which allows light nodes to find all the decks? There is no such concept on any other protocol.