PeerAssets is a blockchain token protocol which focuses on simplicity and flexibility. Most of the flexibility comes from “deck issue mode” which is a ruleset that describes how the deck state is calculated. In PeerAssets terminology assets are named “decks” and each transaction on the deck is called a “card”. Decks and cards are types of transactions parsed by the PeerAsset client to understand the bigger picture and calculate the cards balances and thus the state of the deck. Upon creating a PeerAssets asset (deck), in a process called “deck spawn”, rules of calculating the balances are etched into the blockchain so every client can independently confirm the state of the system. These rules are called “deck issue modes” and are set into the deck spawn metainfo, which is encoded in a protobuf message and inserted into the OP_RETURN field of a Peercoin transaction. Deck issue modes can be understood as light smart contracts, speaking in modern crypto jargon as they allow great flexibility when defining rules of token supply.

Deck issue modes are explained using bitflags and bitwise operators. PeerAssets deck modes can be combined or used standalone.

deck_spawn_metainfo =

{

"version": 1,

"name": "bobs_asset",

"number_of_decimals": 1,

"issue_mode": 0x0a

}

The deck spawn metainfo above states that the deck is using PeerAssets version 1, the name of the deck is “bobs_asset,” amounts on the deck can use up to 1 decimal and the issue mode is 0x0a (SINGLET).

None Issue Mode

NONE = 0x00

No issuance allowed. No issuing, and thus no cards on this deck will be registered as valid.

Custom Issue Mode

CUSTOM = 0x01

Custom issue mode is not specified, custom client implementation is required to parse it. This mode can be used for proprietary implementations of the PeerAssets client or special in-house deployments of the technology.

Once Issue Mode

ONCE = 0x02

Only one issuance transaction from the deck issuer is allowed. This means that the asset issuer has no control over the card supply from the moment of first issuance onward.

Multi Issue Mode

MULTI = 0x04

Multiple issuance transactions from the deck issuer are allowed. This means that the asset owner can add more cards to supply when deemed necessary.

Mono Issue Mode

MONO = 0x08

All card transaction amounts are equal to 1, this issue mode enforces all the cards amounts to 1.

Singlet Issue Mode

SINGLET = 0x0a

SINGLET is a combined issue mode, combining ONCE and MONO (0x02 | 0x08) = 0x0a.

Singlet deck issue mode means that only one (ONCE) card issuance is allowed with MONO filter applied, which means that the card amount must be equal to 1 to be valid.

Unflushable Issue Mode

UNFLUSHABLE = 0x10

Unflushable issue mode literally means “you can’t flush them,” stating that nobody can transact with the cards but the deck issuer. No card transfer transactions are allowed except for the card-issue transactions by the deck issuer.

To correctly calculate the balance of a PeerAssets address, a client should only consider the card transfer transactions originating from the deck owner.

Subscription Issue Mode

Subscription = 0x34

SUBSCRIPTION is a combined issue mode (0x34 = 0x20 | 0x04 | 0x10) = 0x34. This mode automatically enables MULTI & UNFLUSHABLE by inheritance.

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 the validity of a subscription one should take the timestamp of the first card transfer and add the address balance to it in hours.

start_time = <time_of_first_card_transfer>

end_time = start_time + balance * hour

Increasing the balance of an address extends its subscription timeframe by the increased amount in hours.

This issue mode allows for validation of membership by third parties without having to provide any personal information. Decentralized service architectures may use this feature to validate subscription to premium services without having access to a centralized user database. PeerAssets SUBSCRIPTION issue mode can be used to track proprietary software licenses or other DRM-enabled digital content.

Combined issue modes

The issue modes presented above are primitives, which can be combined to allow for greater flexibility. Example of such combined issue mode is MULTI + MONO.

IssueMode.MULTI.value | IssueMode.MONO.value = 12

This combination ensures that all card amounts are equal to 1, and issuer is allowed to keep issuing cards.