Transferring an Asset

This specific transaction type is designed for transferring a specified amount of an available asset from one sending wallet to a recipient wallet. In this scenario, the transaction body and payload will be structured as follows:

var From = [From];
var To = [To];
var Timestamp = Circular.getFormattedTimestamp();
var "Payload" = '{
                   "Action":"CP_SEND",
                   "Asset":[Name of the Asset],
                   "Amount":[Amount to be transferred],
                   "Fee":[Fee]
                   }';

var ID = "0x" + sha256( From + To + Payload + Timestamp);
var Nonce = [Nonce];
var Signature = Circular.SignMessage(PrivateKey, ID);
var PublicKey = [PublicKey];
var Blockchain = [Blockchain];
var Type = "C_TYPE_TOKEN"; 

For this specific transaction type, the Payload undergoes parsing and processing to execute the intended operation. In this case, the operation is a CP_SEND transfer, where the asset specified by name is moved to the "To" wallet.

If the asset being transferred is the native coin "CIRX," the transaction type is labeled as C_TYPE_COIN. For all other tokens, it is identified as C_TYPE_TOKEN. In the case of CIRX coins, the Asset name will be "Circular Coin." The amount to be transferred is represented as a floating-point number with double precision, indicating the quantity of the asset destined for the recipient wallet.

The "fee" field allows the sender to include an optional fee, indicating their willingness to pay to expedite the transaction's inclusion in the next block. If the fee is set to zero, a nominal fee is applied, giving the transaction the lowest priority in block inclusion.

Please note that even with an additional fee, there is no guarantee of immediate inclusion in the next block. Subsequently, the payload is converted into a string format and must be encoded in Hex without the "0x" hexadecimal identifier.

Last updated