Skip to content

Test Package #150

@BlockMechanic

Description

@BlockMechanic

This is a test guide. Please Test the functions highlighted and leave feedback indicating usability, issues and proposed fixes if any.

Test Package 1

**Due : 01/11/22**

To begin testing create a wallet and get an address. Post this address in discord chat to receive coins/assets.

This test package comprises of the following tests :-

Receive Assets

This is achieved easily by providing your address.

Send Assets

In the following size ranges [1-10, 10-100, 100-1000] send assets to Address mj4gaZDAaprjzTjFEASriPyUXD9YgEx4ZD one of each should do. Use the Send Page and the console/CLI to send. Take note that the send many command is not working. Use send to address.

Send Page

Navigate to the full Send window, enter the given address and an amount following the above guide lines and send. Try to send as many of the different assets available to you.

Send via Console

Navigate to the Console Window (Window->Console), use :- `sendtoaddress AddressHere AmountHere AssetHere`.

Send via cli

To use cli you have the wallet software running (qt or daemon), use the following command :- `crown-cli sendtoaddress AddressHere AmountHere AssetHere`.

Take note that ALL are required fields. Do not use the asset’s 3 or 4 letter symbol, use it’s actual name.

Create a Contract

The structure of a contract is
contract_url; //online human readable contract
symbol;
name;
sIssuingaddress;
description;
website_url;
scriptcode;
vchContractSig;

and you can issue one using the following procedure :

  1. Get a new address and fund it with at least 11 CRW
  2. use the following command
    ./src/crown-cli createcontract yourissuingaddress contractname contractsymbol contract_url website_url description scriptcode

this can be seen as well in the help section for the create contract command
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "Issuing address"},
{"name", RPCArg::Type::STR, RPCArg::Optional::NO, "Max 10 characters"},
{"short_name", RPCArg::Type::STR, RPCArg::Optional::NO, "Max 4 characters"},
{"contract_url", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "contract location online"},
{"website_url", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Issuer website online"},
{"description", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "contract decription"},
{"scriptcode", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "contract script in hex"},
},
A contract name and symbol has to be a unique name not already registered on the chain, and it's case insensitive so Bitcoin, is the same as BiTcOiN
so for a test i created this
./src/crown-cli createcontract msYPSHvJXaovD4LnmibAhrULWL7z4Xtce8 Bitcoin BTC https://bitcoin.com https://bitcoin.com "Index linked Bitcoin Fund paid in CRW" ""
If successful, you will get the following response
{
"txid": "5de9eb2e4e0047b749c61a13f59031370ab82fbb6f1d75380eaefa92d49213d1",
"hex": "1268747470733a2f2f676f6f676c652e636f6d034c5543074c756354657374226d7961727833445435547744664352786d544532767350377455624278566d764472145465737420636f6e7472616374206279204c75631268747470733a2f2f676f6f676c652e636f6d004630440220604c70dd34c2b1be9f0e226c0079c77d245723abb01274b77cc8d5d77e17b91e0220179281d4a9efdda345eec68a05b9ffd9255ee345993bc6b7a878ba85176a9e60"
}
This is a txid showing your registration transaction and the contract in hex form
Take note of the hex contract !!

Create an Asset

Wait for transaction confirmation then you can issue an asset. An Asset has the following structure :-

Version;
Flags;
Type;
Expiry;
Asset Name[11];
Asset Short Name[5];
contract hash;

The Flags and Type allow assignment of custom behaviour to new assets at issuance
/** Asset flags */
enum AssetFlags : uint64_t {
// Nothing
ASSET_NONE = 0,
// ASSET_TRANSFERABLE means that the asset can be transfered to other addresses after initial creation
ASSET_TRANSFERABLE = (1 << 0),
// ASSET_CONVERTABLE means the asset can be converted to another asset.
ASSET_CONVERTABLE = (1 << 1),
// ASSET_LIMITED means other assets cannot be converted to this one
ASSET_LIMITED = (1 << 2),
// ASSET_RESTRICTED means the assets can only be issued by one address
ASSET_RESTRICTED = (1 << 3),
// ASSET_STAKEABLE means the asset can be staked
ASSET_STAKEABLE = (1 << 4),
// ASSET_INFLATABLE means the asset supply can grow
ASSET_INFLATABLE = (1 << 5)
};

enum AssetType : uint32_t
{
    TOKEN = 1,
    UNIQUE = 2,
    EQUITY = 3,
    POINTS = 4,
    CREDITS = 5,
};

so the basics are already noted for the flags, for asset types, we have TOKEN, that is like issuing normal colored coins they can be used for anything
UNIQUE is for issuing unique items (NFTs) , strictly for use with one of a kind items
Equity allows users to have a share in the contract backing the asset, best used for DACs
Points and credits are additional types that allow customization for scenarios such as issuing an asset, these will eventually be forced (currently not) to have an expiry date attached
There is an incredible amount of unique ways of issuing assets and going through them all will take too long, so we will cherry pick
To start with, let us issue an NFT using the earlier contract
the command is

./src/crown-cli createasset contract/asssetname contract/asset_symbol CRWtouseinissuance numberofassetstoissue expirytime type transferable convertable restricted limited contracthex
This structure can be observed in the help section of this command as
{
{"name", RPCArg::Type::STR, RPCArg::Optional::NO, "Max 10 characters"},
{"short_name", RPCArg::Type::STR, RPCArg::Optional::NO, "Max 4 characters"},
{"input_amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "In put amount in Crown. (minimum 1)"},
{"asset_amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "Amount of asset to generate. Note that the amount is Crown-like, with 8 decimal places."},
{"expiry", RPCArg::Type::STR, RPCArg::Optional::NO, "Expiry date of asset"},
{"type", RPCArg::Type::NUM, RPCArg::Optional::NO, "asset type TOKEN = 1, UNIQUE = 2, EQUITY = 3, POINTS = 4, CREDITS = 5"},
{"transferable", RPCArg::Type::BOOL, RPCArg::Optional::NO, "asset can be transfered to other addresses after initial creation"},
{"convertable", RPCArg::Type::BOOL, RPCArg::Optional::NO, "asset can be converted to another asset (set false for NFTs)"},
{"restricted", RPCArg::Type::BOOL, RPCArg::Optional::NO, "asset can only be issued/reissued by creation address"},
{"limited", RPCArg::Type::BOOL, RPCArg::Optional::NO, "other assets cannot be converted to this one"},
{"contract", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Contract to issue asset to"},
},

NOTE: To issue assets you have to fund the contract address so you can burn the CRW to make the new asset

*** this measure prevents no risk assets being issued as well as preventing spamming which would unnecessarily bloat the chain ***

You can also select the type of asset you wish to issue. (more on each one's specific aspects)

Brief description of properties
transferable means that the asset can be transferred to other addresses after initial creation
convertible assets can be converted to another asset.
limited assets cannot be converted to this one
restricted assets can only be issued by one address
stakable means the asset can be staked
inflatable means the asset supply can grow (re-issuance)

With all data entered and options selected, click "create". Wait one block and your asset is ready.

NFT Instructions

So to use the above example contract in issuing an NFT i use

./src/crown-cli createasset Bitcoin BTC 10000 1 1715352029 2 true false true true "1268747470733a2f2f676f6f676c652e636f6d034c5543074c756354657374226d7961727833445435547744664352786d544532767350377455624278566d764472145465737420636f6e7472616374206279204c75631268747470733a2f2f676f6f676c652e636f6d004630440220604c70dd34c2b1be9f0e226c0079c77d245723abb01274b77cc8d5d77e17b91e0220179281d4a9efdda345eec68a05b9ffd9255ee345993bc6b7a878ba85176a9e60"
This effectively creates an NFT using 10K CRW for a single unique token called Bitcoin
because it's an NFT, i marked it as non-convertable , so the CRW cannot be retrieved in exchange for destroying the NFT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions