Hans Schmidt :  Aug 10th 2019

hans_schm1dt@protonmail.com


Some Notes on Ravencoin Restricted Asset Usage
*Just a few tips to help you get started*

Background:

Yesterday 2019-08-09 the Ravencoin developers released the first GUI version of the client which includes restricted address functionality for testnet debugging purposes.

It is available for your enjoyment at (use a "Private Browsing" window):
    https://raven-nightly-builds.ravencoin.org --> Restricted-Assets-Testnet-Build

But it may not be intuitively obvious what the purpose is of restricted assets of how to use them.


Some Tips:

For the general overview you should read the article which Tron Black published after he thought up the new design:
    https://medium.com/@tronblack/ravencoin-tags-and-restricted-assets-84fe3070a226
   
The usage may be better understood by looking at the RPC commands which were created to support the new functionality:
    All defined Ravencoin RPC calls as of develop 02241e950 2019-07-31
   
Things get even clearer if you look at the help text of the individual commands and the parameters they support:
    Help details of new RPC calls in Ravencoin develop 02241e950 since V2.2.2

Do your debugging using the GUI if you prefer. But the RPC interface can still provide useful documentation. It also provides some functionality which is not available in the GUI.

Remember that RPC commands can be used from the command line command "raven-cli" or in the "Help" -> "Debug Window" -> "Console tab" of the GUI.

  
A Few Additional Hints:
  • You can't do anything related to restricted assets without qualifiers, so create them first (eg: #REQUIREMENT_1 and #REQUIREMENT_2)
  • Those qualifiers can then be "tagged" to addresses, indicating that those addresses qualify/meet those requirements
  • You must own a root asset name (eg: MY_ASSET_NAME!) before you can create/issue the corresponding restricted asset (eg: $MY_ASSET_NAME)
  • When creating/issuing a restricted asset, you also must first decide on its requirements (the qualifier_string) which is specified during issuance
    • The address you issue to (and later may transfer to) must meet the requirements of the qualifier_string   
  • The qualifier_string is a string of up to 80 characters which is a boolean equation using qualifier assets
    • whitespace is ignored
    • the valid operators are ! (negation), & (and), | (or)
    • parantheses () can be used for logical grouping
    • the RPC command "isvalidverifierstring" can be useful for checking syntax validity. Remember that you can use it in the "Help" -> "Debug Window" -> "Console tab" of the GUI.
    • eg: "(#REQUIREMENT_1 & !#REQUIREMENT_2) | (#REQUIREMENT_2 & !#REQUIREMENT_1)"
   

Here are a few example RPC commands to get you started:


    Issue two qualifier assets=>
            ./raven-cli -testnet issuequalifierasset "#STRAIGHT" 10 mnGC1gLGrGPsRCXnQU27mYuRJTXsTjZ5ef
            [
              "f1b7ffa01f7e3f9e8b2a1f7c7df830122f551f038e47ac66ab816e5892ca983c"
            ]
            ./raven-cli -testnet issuequalifierasset "#NARROW" 10 mnGC1gLGrGPsRCXnQU27mYuRJTXsTjZ5ef
            [
              "765293ec432696e2d431f1cec83f8233ccf1f2c9c0b72f5619a7897b9d6967f3"
            ]
   
    Tag "#STRAIGHT" to one address=>
            ./raven-cli -testnet addtagtoaddress "#STRAIGHT" myLE6kpf5pwjNM5P2RCEjr7DFiothETD8j
            [
              "36c3e8ed8a3d1a1228d68c0fd0cd5eb62a118c02d07fa91bac716ba4b29fed93"
            ]
   
    Tag both "#STRAIGHT" and "#NARROW" to another address=>
            ./raven-cli -testnet addtagtoaddress "#STRAIGHT" mhFNPU8DhDrwfQe7YfuWRguwQ8novXWhfq
            [
              "50f3237aa5eca2b6edb027efc35817efa41ee2dd2b15043b9eafa57f05255003"
            ]
            ./raven-cli -testnet addtagtoaddress "#NARROW" mhFNPU8DhDrwfQe7YfuWRguwQ8novXWhfq
            [
              "8031121c24448ef73aec03b96a8578114ff688033ff8dd021829e093922fa3a1"
            ]
       
    Issue some root assets=>
            ./raven-cli -testnet issue "RESTRICT_TST_STRAIGHT" 1 mtNRbFjiRtBQcSsjwjmdkzxhwnmwnCKmjA
            [
              "34879c1f259e0e5af7e842bdeab73d67825bce29bd28101248a2989120282a82"
            ]
            /raven-cli -testnet issue "RESTRICT_TST_STRAIGHT_N_NARROW" 1 mtNRbFjiRtBQcSsjwjmdkzxhwnmwnCKmjA
            [
              "b0c4305e42a1058b5a6971c4896ef13e0cea5a97e1210cd21ceda6b8480e97bf"
            ]
           
    Issue the first restricted asset using verifier "#STRAIGHT" to the address tagged with "#STRAIGHT"=>
            ./raven-cli -testnet issuerestrictedasset "RESTRICT_TST_STRAIGHT" 10 "#STRAIGHT" myLE6kpf5pwjNM5P2RCEjr7DFiothETD8j
            [
              "8573fe96f747df48a1981c49a8838fe6e75cb5d05c47a2dd62492c7aa6f68b6e"
            ]
   
    Demonstrate that you cannot issue the 2nd restricted asset using verifier "#STRAIGHT & #NARROW" to the address tagged only with "#STRAIGHT"=>
            /raven-cli -testnet listtagsforaddress myLE6kpf5pwjNM5P2RCEjr7DFiothETD8j
            [
              "#STRAIGHT"
            ]
            /raven-cli -testnet issuerestrictedasset "RESTRICT_TST_STRAIGHT_N_NARROW" 10 "#STRAIGHT & #NARROW" myLE6kpf5pwjNM5P2RCEjr7DFiothETD8j
            error code: -8
            error message:
            bad-txns-null-verifier-address-failed-verification
   
    Successfuly issue the 2nd restricted asset using verifier "#STRAIGHT & #NARROW" to the address tagged only with both "#STRAIGHT" and "#NARROW"=>
            ./raven-cli -testnet listtagsforaddress mhFNPU8DhDrwfQe7YfuWRguwQ8novXWhfq
            [
              "#NARROW",
              "#STRAIGHT"
            ]
            ./raven-cli -testnet issuerestrictedasset "RESTRICT_TST_STRAIGHT_N_NARROW" 10 "#STRAIGHT & #NARROW" mhFNPU8DhDrwfQe7YfuWRguwQ8novXWhfq
            [
              "aca78e4756c0e66207941ffedd96afe8e3780af36fcb32853453399f9e05fa55"
            ]
   

Happy bug hunting !

Copyright 2019 by Hans Schmidt