Command used : nft_metadata_create <<account_name>> <<metadata_name>> <<metadata_symbol>> <<base_uri>> true true true
For example : nft_metadata_create account01 sknft sknft sknft null null true true true
Command used : nft_metadata_update <<account_name>> <<metadata_id>> <<new_name>> <<new_symbol>> <<new_base_uri>> null null true true true
For Example :nft_metadata_update account01 1.30.1 sknft01 sknft01 sknft01 null null true true true
Command used : nft_create <<account_name>> <<metadata_id>> <<Owner_account_name>> <<approve_aacount_name>> <<token_uri>> true
For Example : nft_create account01 1.30.0 account03 account03 sknftmint true
Command used : nft_get_balance <<account_name>>
For Example : nft_get_balance account01
Command used : nft_owner_of <<nft_id>>
For Example : nft_owner_of 1.31.1
Command Used : nft_safe_transfer_from <<Operator_account_name>> <<transfer_from_account_name>> <<transfer_to_account_name>> <<nft_id>> true true
For Example : nft_safe_transfer_from account01 account01 aaccount02 1.31.1 true true
Command used : nft_transfer_from <<Operator_account_id>> <<From_account_id>> <<To_account_id>> <<nft_id>> true
For Example : nft_transfer_from 1.2.31 1.2.31 1.2.28 1.31.37 true
Command used : nft_approve <<new_operator_account_id>> <<new_account_id>> <<ndt_id>> true
For Example : nft_approve 1.2.19 1.2.19 1.31.1 true
Command used: nft_set_approval_for_all <<Owner_account_id>> <<Operator_account_id>> true true
For example : nft_set_approval_for_all 1.2.21 1.2.21 true true
Command used : nft_get_approved <<approve_nft_id>>
For Example: nft_get_approved 1.31.0
Command used: nft_is_approved_for_all <<owner_account_id>> <<operator_account_id>>
For Example : nft_is_approved_for_all 1.2.21 1.2.21
Command used : nft_get_all_tokens
With this - all the created NFTs are listed on the machine.
Describing here the steps to verify the Marketplace_python on local or server machine.
Machine configuration : Local or server machine.
Project Url :
Run:
And then:
then:
Step: 4 Run unit tests
Run:
Expected result should be as below:
Here we learn some commands and use cases related to NFT, Marketplace, HRP, and RBAC.
Example NFT metadata create command without permissions,
account01 is the owner account of the metadata
“AVALON NAME” is the name of the NFT types created from the NFT metadata being created
“AVALON SYMBOL” is the symbol of the NFT types created from the NFT metadata being created. The symbol is reserved for future use.
“AVALON BASE URI” is the URI of the NFT types. Eg: avalonmeta.com
account02 is the revenue partner, this can be owner as well. Whenever the minted NFT is sold in the marketplace a split of the selling price goes to the revenue partner. The split can be specified in revenue_split parameter.
100 is the revenue_split on the scale of 10000 being 100 percent. i.e. 100 is 1%
is_transferable specifies if the minted NFTs can be transferred by the owner of the NFT to other accounts
is_sellable specifies if the minted NFTs can be sold in the marketplace.
role_id is the resource permissions specifying the whitelisting accounts among which the NFTs can either be transferred or sold on marketplace.
broadcast either true or false, keeping it true will include the transaction in the upcoming block on the chain.
First create a permission:
Example Permission:
account01 is the owner of the permission being created which can be attached to NFT metadata.
“Avalon Permissions1” is the name of the resource permission being created.
“Permission Metadata” is the metadata, can be a JSON as well.
[88,89,90,95] is the list of operations this permission whitelists for accounts. 88 - List Offer operation in marketplace 89 - Bid operation in marketplace 90 - Cancel Offer operation in marketplace 95 - Safe transfer from owner to another NFT
[1.2.40, 1.2.41] List of accounts whitelisted for the above operations. Offer, bid and transfer operations can only be among the whitelisted accounts.
"2020-11-04T13:43:39"
Expiry date of the permission
true
broadcast, keep it true to include the transaction in upcoming block.
Example NFT metadata create command with permissions:
1.32.0 This is specified in the metadata create operation to attach permissions to all the NFTs created from this metadata.
NFT is always minted by the owner of the metadata object this NFT is based on. The fees associated with minting this NFT is just the transaction fee + storage fee which are both collected in core PPY token. After the NFT has been minted this can be sold on marketplace in any token of NFT owner’s choice.
Syntax:
Example NFT creation based on the metadata created above:
account01 is the owner of the metadata this NFT is based on
1.30.0 is the metadata ID of the metadata object this NFT is based on ( Currently this works on best guess method by doing get_object 1.30.0, 1.30.1, 1.30.2 …. so on, in future a new cli command will be introduced that can list all the metadata objects by owner account ).
account02 is the owner of the NFT, can be one of the user of the Avalon App.
account02 is the approved account of the NFT, can be the owner as well.
"AVALON NFT URI"
is the URI that has additional information about this NFT.
Example command:
Note that NFTs can be transferred only when is_transferableflag
is set to true, also if permissions are enabled both from and to accounts have to be whitelisted.
account02 operator or owner account
account02 from account
account03 to account
1.31.0 Id of the NFT
"Enjoy my NFT"is the metadata of the transfer
true is broadcast option mentioned above.
Example command:
Note that is_sellable of NFT metadata should be true to make listing of the NFTs created from the metadata.
Only owner of the NFT can create a listing in auction.
["1.31.0","1.31.1"]
- List of NFTs to sell or buy
account02 is the owner of the NFTs
{"amount":100,"asset_id":"1.3.0"}
minimum bid price expected
{"amount":10000,"asset_id":"1.3.0"}
maximum bid price expected
false
buying_item denotes if this is an auction or reverse auction
"2020-08-18T11:05:39"
Listing expiry date
null
Optional metadata, if not null assign a string value
true
broadcast value mentioned above
Example bid command:
account04 is the bidder
{"amount":10000,"asset_id":"1.3.0"}
bid price
1.29.0
Offer listing objected created from create_offer command
true
broadcast value mentioned above
Example cancel offer command:
account02 is the creator of the listing
1.29.0
is the offer object
true
broadcast value mentioned above
Returns all the sell and buy listings offer objects in the marketplace.
Example command:
100
Number of items per fetch (pagination)
1.29.0
Index to start the search for. (pagination)
Example command without pagination:
Returns all the sell listing offer objects in the marketplace.
Example command:
10
Number of items per fetch (pagination)
1.29.6
Index to start the search for. (pagination)
Example command without pagination:
Returns all the buy listing offer objects in the marketplace. (Reverse Auction offer objects).
Example command:
10
Number of items per fetch (pagination)
1.29.6
Index to start the search for. (pagination)
Example command without pagination:
Returns all the closed auction and reverse auction listings. (offers)
Example command:
10
Number of items per fetch (pagination)
2.24.2
Index to start the search for. (pagination)
Example command without pagination:
Returns all the offers listed by an account.
Example command:
account02
issuer
10
Number of items per fetch (Pagination)
1.29.0
Index to start the search for. (pagination)
Example command without pagination:
Example command:
1.31.0
NFT Id
10
Number of items per fetch (Pagination)
1.29.1
Index to start the search for. (pagination)
Example command without pagination:
Example command:
account06 Issuer
10 Number of items per fetch (Pagination)
2.24.1 Index to start the search for. (pagination)
Example command without pagination:
Example Command:
1.31.0
NFT Id
10
Number of items per fetch (Pagination)
2.24.1
Index to start the search for. (pagination)
Example command without pagination:
Example Command:
account07 Bidder
10 Number of items per fetch (Pagination)
2.24.1 Index to start the search for. (pagination)
Example command without pagination:
Hierarchical role based permissions is a feature of Peerplays blockchain which helps in increasing the security of user accounts.
Users don’t have to use their active and owner keys for everything they do on the chain.
They can create role based custom permissions and map them to different keys other than active and owner keys.
They can then use these custom keys to sign transactions.
owner Owner of the account who is creating the custom permission
permission_name Permission name, eg. nftcreatepermission
auth authority is account authority, more info at permissions, public/private keys, multi authority
Example Command:
{ "weight_threshold": 1, "account_auths": [["1.2.52",1]], "key_auths": [["TEST71ADtL4fzjGKErk9nQJrABmCPUR8QCjkCUNfdmgY5yDzQGhwto",1]], "address_auths": [] }
This represents an authority structure,
account_auths
represent the amount of weight each accounts have on our account, in this example 1.2.52 has weight 1
key_auths
represent the amount of weight each public key has on this account, in this exampleTEST71ADtL4fzjGKErk9nQJrABmCPUR8QCjkCUNfdmgY5yDzQGhwto
has weight 1
Weight_threshold
represent the required weight for a transaction to be signed successfully.In this example either
1.2.52
can sign with his active key orTEST71ADtL4fzjGKErk9nQJrABmCPUR8QCjkCUNfdmgY5yDzQGhwto
can be used to sign a transaction successfully.
Example Command,
Example Command:
Here we removed the key_auths
and added 1.2.53
with weight 1, which is equal to weight_threshold
, so 1.2.53
can alone sign the transaction successfully.
Creating custom authority maps the created custom permissions with the actual operations present on the blockchain.
It also has expiry time by when this custom permission is no more valid on any given account and operation combination.
Example Command:
account01
is the owner of the account and the one who created a permission 1.27.0
1.27.0
is the custom permission created
0
is the operation number, refer to operations at operations, here 0
is transfer_operation
"2020-11-02T17:53:25"
valid from timestamp
"2020-12-03T17:53:25"
valid to timestamp
true
broadcast
Basically this represents a full HRP where transfer operation on account01
can be done by authorities present in 1.27.0
instead of account owner account01
Can be used to update existing valid_from
and valid_to
times,
Example command:
Used to delete the existing custom permission, this will delete all the custom account authorities linked to this permission as well.( cascading delete )
Example command:
Used to delete an account authority attached to a permission.
Example command:
As opposed to HRP mentioned above, resource permissions are controlled by an owner of a resource (eg. NFT metadata is a resource).
These are similar to IAM permissions in AWS Cloud environment.
Used to create an account role.
owner_account_id_or_name
resource owner Eg. account creating an NFT Metadata resource
name
name of the account role Eg. Movie Interstellar Permissions
metadata
metadata for additional info Eg. Some JSON struct or an external URL with info
allowed_operations
allowed operations that whitelisted_accounts
can perform on this resource.
whitelisted_accounts
All the accounts that can perform any allowed_operations
on a resource
valid_to
exports time of the account role, valid from is the time of creation of the account role
broadcast
broadcast mentioned above
Currently valid allowed_operations
are
offer_operation
(88), Checks if the user who is listing an NFT for sale is in whitelisted_accounts
, if not the user can’t list the NFTs in marketplace.
bid_operation
(89), Checks if the user who is bidding for an NFT on sale is in whitelisted_accounts
, if not the user can’t bid / buy the NFT from marketplace.
nft_safe_transfer_from_operation
(95), Checks if the user who transferring i.e. owner is in whitelisted_accounts
, if yes it checks the to-account is also in the whitelisted_accounts
. If any of the two checks fail, the transfer fails.
More operations like NFT Lottery, RNG are to be attached to account roles.
Example Command:
This command effectively limits any NFT to be sold or transferred between only three accounts, 1.2.40, 1.2.41, 1.2.43
For attaching NFT metadata to an account role, please refer to the above NFT sections.
Example command:
As a resource owner, one can update the operations and whitelisted accounts present in an account role.
This helps in blacklisting any users from selling or transferring NFTs or any resources.
operations_to_add
new operations to add to the account role
operations_to_remove
existing operations to remove from the account role
accounts_to_add
new accounts to add to the whitelist
accounts_to_remove
existing accounts to remove from the whitelist
Example command:
88
offer_operation
(88)
is added
95
nft_safe_transfer_from_operation
is removed
1.2.42
account to the whitelist
1.2.40
account removed from the whitelist
Once account role is deleted, restrictions on resource access no longer work.
Example command:
PPY is the core token of peerplays blockchain. Blockchain users can issue their own tokens with a conversion rate to core token.
In the Peerplays blockchain, every operation executed has a fee associated with it. The majority of these fees go as payments to witnesses that run the blockchain. These fees are called transaction fees and are collected in core (PPY) tokens only.
There is also a fee for storing any data on the blockchain like metadata or names.
Currently for the operations related to NFT, Marketplace, HRP, and Account Roles:
These values are subject to change by committee members.
In order to create an NFT, a metadata has to be created first.
Only the owner of the metadata can mint NFTs
These NFTs can be assigned to any user of metadata owner’s choice.
NFT Metadata owner is the owner of the metadata that mints the NFTs, NFT owner is the one who is assigned an NFT by metadata owner after minting.
User who is not the metadata owner cannot mint NFTs to himself
is_transferable
and is_sellable
flags configured on metadata control the transfer and selling properties of all the NFTs minted from the metadata.
If is_transferable
is false and is_sellable
is true, then the NFT owner can only list it in marketplace and sell it. He can’t transfer to another user.
If is_transferable
is true and is_sellable
is false, then the NFT owner cannot list it in marketplace and he can freely transfer it to other users.
If is_transferable
is false and is_sellable
is false, then the NFT owner can neither be transfer nor sell the NFT. It remains with him forever.
Peerplays blockchain operates the marketplace through offer_operation
, bid_operation
, cancel_offer_operation
, finalize_offer_operation
operations/smart contracts.
Offers operate as an auction where max bid before the expiry time owns the NFT
If max_price is equal to min_price in offer_operation it acts as normal listing. Whoever bids the max_price gets the NFT instantly.
For a successful bid, revenue_partner
gets the revenue_split
percent of the bid. This is configured during NFT metadata creation. So for all the NFT sales that are based on the metadata, revenue_partner
gets the cut.
Currently peerplays stakeholders don’t get the cut, this will be implemented in the future.
Currently there is only one marketplace i.e. Peerplays blockchain is providing a marketplace where any owner can sell his NFT based on the configuration of the parent metadata.
Metadata owner can customize this marketplace in the UI to show only the NFTs minted from his own metadata to his DAPP users.
So there are no multiple marketplaces on peerplays blockchain at the moment, only UI customization are possible.
Price can be set in terms of custom assets (tokens) in market place. In this case both offers and bids should be in the same asset (token). Eg. Offer price is in XCOIN token, then bid price should also be in XCOIN token.
I’m the owner of a movie theater where there is a premiere show for a movie Interstellar.
I create NFT metadata for Interstellar movie that has basic info about the genre, running time, movie posters etc
To maximize my profit and take a cut from the black market ticket sales, I created the metadata of the movie is_transferable
to false and is_sellable
to true
I accept payment on the blockchain in multiple currencies namely PPY, XCOIN and BTC (or some off chain mechanism in FIAT currencies like USD)
I mint the tickets as NFTs to the users who sent me the amount in the above currencies. Users can gain entry to the movie only with these NFT tickets.
Users cannot transfer the tickets among themselves, they can only list them on marketplace.
As the demand for tickets increase, listing price increase, so I get more cut for every ticket sold.
I’m the issuer of the lottery which has geo restrictions saying the lottery can only be sold to residents of the state New South Wales(NSW) in Australia.
I do the KYC check off chain and list down all the users on the blockchain that are residents of the state.
While creating NFT metadata I attach the account roles with the whitelist of users along with is_transferable
to true and is_sellable
to false.
I create a smart contract for minting NFTs from the metadata created.
This smart contract accesses the account role associated with the metadata.
If any user is not whitelisted he can’t purchase the NFT lottery ticket from the smart contract.
If the user is whitelisted and minted a lottery ticket, he can’t transfer it to non-whitelisting users who are not residents of NSW.
I create a draw and declare the owner of NFT as winner.
I’m the university issuing degrees to students that complete masters degree in two streams science and arts.
I create two NFT metadata one each for both Science and Arts.
I make both is_transferable
to false and is_sellable
to false.
I mint NFT accordingly based on the stream to each student.
Each NFT (degree) has the info about the student grades, courses etc.
These NFTs (degrees) stays with the students (users) forever, they can’t be transferred or sold.
I’m the owner of an NFT Metadata and my DAPP users are not blockchain savvy.
I mint the NFTs to my account itself.
I modify the URI of NFTs accordingly off chain to denote the ownership.
Core coin : PPY for fee
Purchase/Sell/Transaction token for NFTs : ava-token
PPY:ava-token = 1:10000
Describing the steps to verify the NFT_python on local or server machine below.
Machine configuration : Local or server machine.
Go to project :
Run:
Run:
then,
And then,
Run:
Expected result should be as below:
Cheers, all unit tests are passed and you successfully verify the NFT_python