Qortal UI - Main Code Repository A User Interface for the Qortal Blockchain Project. Truly decentralized web hosting, application hosting, communications, data storage, and full infrastructure for the future global decentralized digital world.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 KiB

(function () {
function generateSignatureRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp) => {
const data = generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp)
return nacl.sign.detached(data, keyPair.privateKey)
}
3 years ago
function generateRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp, signature) => {
return appendBuffer(generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp), signature)
}
3 years ago
function generateRegisterNameTransactionBase(publicKey, lastReference, owner, name, value, fee, timestamp) => {
const txType = TYPES.REGISTER_NAME_TRANSACTION
const typeBytes = int32ToBytes(txType)
const timestampBytes = int64ToBytes(timestamp)
const feeBytes = int64ToBytes(fee * 100000000)
const nameSizeBytes = int32ToBytes(name.length)
const valueSizeBytes = int32ToBytes(value.length)
3 years ago
let data = new Uint8Array()
3 years ago
data = appendBuffer(data, typeBytes)
data = appendBuffer(data, timestampBytes)
data = appendBuffer(data, lastReference)
data = appendBuffer(data, publicKey)
data = appendBuffer(data, owner)
data = appendBuffer(data, nameSizeBytes)
data = appendBuffer(data, name)
data = appendBuffer(data, valueSizeBytes)
data = appendBuffer(data, value)
data = appendBuffer(data, feeBytes)
3 years ago
return data
}
}())