Skip to content

Velluscinum Jason Hello

Nilson Lazarin edited this page Sep 11, 2024 · 3 revisions
Velluscinum for Jason Wiki

To install Jason-CLI on your computer, see the APT Package for Jason CLI

  1. Create a jason project

    jason app create helloVelluscinumWithJason
  2. Create a directory lib in the project folder and download the latest velluscinum.jar file into this directory, using the command below:

    wget https://github.com/chon-group/Velluscinum/releases/latest/download/velluscinum.jar -P helloVelluscinumWithJason/lib/
    
  3. Edit the agent file helloVelluscinumWithJason/src/agt/bob.asl, including the content below:

    // Agent bob in project helloVelluscinumWithJason
    
    /* Initial beliefs and rules */
    bigchainDB("http://testchain.chon.group:9984/").
    aliceKey("AFL794vuN2D4uWzdJsnbLtMRSz1b9bvmYxKy8RoFntKB").
    
    /* Initial goals */
    !start.
    
    /* Plans */
    +!start <-
    	.print("Creating a Wallet");
    	.velluscinum.buildWallet(myWallet);
    	.wait(myWallet(PrivateKey,PublicKey));
    	
    	.print("Creating a NFT");
    	?bigchainDB(Server);
    	.velluscinum.deployNFT(Server,
    			PrivateKey,PublicKey,
    			"name:Meninas;author:Silva y Velázquez;place:Madrid;year:1656",
    			"location:Madrid;value_eur:25000000;owner:Bob Agent",
    			myNFT);
    
    	.wait(myNFT(AssetID));
    	.print("NFT registered --> ",Server,"api/v1/assets/?search=",AssetID);
    
    	.print("Tranfering the NFT");
    	?aliceKey(AliceKey);
    	.velluscinum.transferNFT(Server,
    			PrivateKey,PublicKey,
    			AssetID,
    			AliceKey,
    			"value_eur:30000000;owner:Alice;location:Rio de Janeiro",
    			transactionTo(alice));
    				
    	.wait(transactionTo(alice,TransferID));
    	.print("NFT transferred --> ",Server,"api/v1/transactions/",TransferID);
    .

Running Jason Project

jason helloVelluscinumWithJason/helloVelluscinumWithJason.mas2j 

Checking

The asset was registered with ID 49d3715b8b6fb34f8ba44c008d6dffe6b6cb1c34827fcec2a7099aa1ba078361

The transfer was registered with ID cbe36b5da70de3e437d82e9c5f7618dbda88c7a24165c5f20206bfe6ed915bfa