Transaction

data class Transaction(var number: Long, var parentHash: String, var daemonHash: String, var timestamp: Long = Instant.now().epochSecond, var owner: Address, var linker: Address? = Address(ZERO_LTC_ADDR), val type: TxTypeEnum, var hub: Array<String> = emptyArray(), var code: String? = null, val codeHash: String? = null, var payload: String? = "0x", var amount: Long = 0, var income: Long? = null, var joule: Long = 0, var sign: String? = null, var proofOfWork: String? = null, var version: Int = TxVersionEnum.LATEST.version(), var difficulty: Int? = 0)

交易数据类

Constructors

Link copied to clipboard
constructor(number: Long, parentHash: String, daemonHash: String, timestamp: Long = Instant.now().epochSecond, owner: Address, linker: Address? = Address(ZERO_LTC_ADDR), type: TxTypeEnum, hub: Array<String> = emptyArray(), code: String? = null, codeHash: String? = null, payload: String? = "0x", amount: Long = 0, income: Long? = null, joule: Long = 0, sign: String? = null, proofOfWork: String? = null, version: Int = TxVersionEnum.LATEST.version(), difficulty: Int? = 0)

Properties

Link copied to clipboard

转账的通证数量,整数

Link copied to clipboard
var code: String?

合约code

Link copied to clipboard
val codeHash: String? = null

合约code的哈希

Link copied to clipboard

守护区块哈希

Link copied to clipboard

难度

Link copied to clipboard

引用的交易哈希,一般用于接收交易时使用

Link copied to clipboard
var income: Long?

激励

Link copied to clipboard
var joule: Long

消耗的手续费

Link copied to clipboard

对方地址,一般为账户地址或合约地址

Link copied to clipboard

账户高度

Link copied to clipboard

己方地址

Link copied to clipboard

父交易哈希

Link copied to clipboard

交易备注,为0x前缀的16进制字符串

Link copied to clipboard

已废弃

Link copied to clipboard
var sign: String?

交易的签名

Link copied to clipboard

构造交易的时间戳(秒)

Link copied to clipboard

交易类型 TxTypeEnum

Link copied to clipboard

交易版本 TxVersionEnum

Functions

Link copied to clipboard
fun Transaction.calculateTransactionHash(isGM: Boolean = true, useProofOfWork: Boolean = false): String

calculate transaction hash

Link copied to clipboard
fun Transaction.getPow(codeHash: String, chainId: Int, isGM: Boolean = true): String
Link copied to clipboard
fun Transaction.hash(isGM: Boolean = true, chainId: Int = 1, useProofOfWork: Boolean = false): Pair<String, ByteArray>

对交易进行哈希运算

Link copied to clipboard
fun Transaction.hashSeal(codeHash: String, pow: String, chainId: Int, isGM: Boolean = true, useProofOfWork: Boolean = false, isSign: Boolean = false): ByteArray
Link copied to clipboard
fun Transaction.sign(privateKey: String, isGM: Boolean = true, chainId: Int = 1, useProofOfWork: Boolean = false): Pair<String, SignatureData>

签名交易

Link copied to clipboard

convert Transaction to SendTBlock