Calculating a Transaction Hash
Example send CIRX to a wallet:
Circular.GetWallet(Blockchain, Address);
var Nonce = w_nonce + 1; // Wallet Nonce + 1
var From = '0x...'; // Sender Address
var To = '0x...'; // Recipient Address
// Remove ‘0x’ from the addresses
if (Blockchain.startsWith('0x')) {
Blockchain = Blockchain.slice(2);
}
if (From.startsWith('0x')) {
From = From.slice(2);
}
if (To.startsWith('0x')) {
To = To.slice(2);
}
var Asset = "CIRX";
var Amount = 100.00;
var Memo = "Test Send CIRX";
// Definition of the Transaction Payload
var PayloadObject = {
"Action": "CP_SEND",
"Asset": Asset,
"Amount": Amount,
"Memo": Memo
};
// Conversion to string
var jsonstr = JSON.stringify(PayloadObject);
// Conversion to Hex Representation
var Payload = Circular.stringToHex(jsonstr);
// Retrieval of the Timestamp
Timestamp = Circular.getFormattedTimestamp();
// Transaction String
const str = Blockchain + From + To + Payload + Nonce + Timestamp;
// Signature Hash
const TxID = sha256(str);
Last updated