Skip to content

stampTransaction Internal Action

Nilson Lazarin edited this page Sep 11, 2024 · 1 revision
Internal Actions Wiki

.velluscinum.stampTransaction

Stamps an specific transaction;

"It is a self-transfer and unification process. Self-transfer, therefore, the units received from a divisible asset are transferred to itself, spending the received transaction (filling the OUTPUT pointer with the address of its wallet). Unification because this process joins the units from the received transaction with those already in the wallet. A transaction with two or more INPUT pointers and a single OUTPUT pointer is generated in this process".

DESCRIPTION

.velluscinum.stampTransaction(S,P,Q,T);
Parameters Description
P It's a literal that represents the agent's private key.
Q It's a literal that represents the agent's public key.
S It's a literal that represents the address of a DLT node.
T It's a literal that represents a transaction performed in the DTL.

EXAMPLE

  • Alice Agent
/* Initial beliefs and rules */
myPrivateKey("7neiPonWcQEXBoHooxMhTVvHQFAJGDdZYF1HuPTgH5ia").
account("C9q3KZzdBXaTyCpLUyizFXZQaPcZX3RjH8wLavRA91Lk").
bank("http://testchain.chon.group:9984/").

/* Plans */
+!paidAction(Payment,Message) <-
	?myPrivateKey(P);
	?account(Q);
	?bank(S);
	.velluscinum.stampTransaction(S,P,Q,Payment);
	.print("This is a sponsored message ----> ",Message);
.

-!paidAction(Payment,Message) <-
	.print("The Payment is not confirmed!");
	.stopMAS;
.
  • Bob Agent
/* Initial goals */
!start.

/* Plans */
+!start <-
	.send(alice,askOne,bank(_),Reply);
	+Reply;
	.send(alice,askOne,account(_),Reply2);
	+Reply2;
 
	.velluscinum.buildWallet(myWallet);
	.wait(myWallet(P,Q));

	?bank(S);
	.velluscinum.deployToken(S,P,Q,"name:MyCoin;type:criptocurrency",1000,myCoin);
	.wait(myCoin(TokenID));

	?account(AliceWallet);
	!transferToken(S,P,Q,TokenID,AliceWallet,10);
.

+!transferToken(S,P,Q,C,R,V) <-
	.random(W); .wait(5000*W);
	.velluscinum.transferToken(S,P,Q,C,R,V,q);
	.wait(q(Transaction));
	.print("Requesting a paidAction...");
	.send(alice,achieve,paidAction(Transaction,"Vote in Bob!!!"));
	!transferToken(S,P,Q,C,R,V*10);
.

-!transferToken(S,P,Q,C,R,V) <-
	?q(OldTransaction);
	.print("Requesting a paidAction with an used Transaction ID...");
	.send(alice,achieve,paidAction(OldTransaction,"Vote in Bob!!!"));
.