Skip to content

Latest commit

 

History

History
135 lines (77 loc) · 3.1 KB

TransactionId.md

File metadata and controls

135 lines (77 loc) · 3.1 KB

class TransactionId

The client-generated ID for a transaction.

** Java **

// create from..
var transactionId = TransactionId.fromString("[email protected]");
var transactionId = new TransactionId(new AccountId(23847), Instant.ofEpochSecond(1588539964);

** JavaScript **

// create from..
const transactionId = TransactionId.fromString("[email protected]")
const transactionId = new TransactionId(new AccountId(0, 0, 23847), new Timestamp(1588539964, 4);

** Go **

// create from..
txID, err := TransactionIdFromString("[email protected]")
txID := NewTransactionIDWithValidStart(AccountID{Account: 23847}, time.Unix(1588539964, 4))

Constructor

constructor ( AccoundId, validStart: Timestamp )

Construct a transaction ID from an account ID and a timestamp


Static Methods

fromBytes ( data: byte[] ): TransactionId

Construct the transaction ID from a protobuf encoded TransactionID


fromString ( text: String ): TransactionId

Construct a transaction ID from string

NOTE: The transaction ID format is (?<accountId>(\d+.\d+)?\d+)\.(?<timestamp>\d+.\d+)(?<scheduled>\?scheduled)?(?<nonce>/\d+)?


generate ( AccoundId ): TransactionId

Generate a transaction ID with the given account ID and a generated timestamp


getReceipt ( Client ): TransactionReceipt`

Fetch the receipt of the transaction.


getRecord ( Client ): TransactionRecord`

Fetch the record of the transaction.


withValidStart ( AccoundId, validStart: Timestamp ): TransactionId

Create a transaction id.


Methods

toString (): String

Stringify the transaction ID


toStringWithChecksum ( Client ): String

Convert to a string representation with checksum


toBytes (): byte[]

Serialize the transaction into protobuf encoded bytes


Fields

accountId: AccoundId

The account ID of the transaction ID

This account pays for the transaction


nonce: Uint64

The identifier for an internal transaction that was spawned as part of handling a user transaction. (These internal transactions share the transactionValidStart and accountID of the user transaction, so a nonce is necessary to give them a unique TransactionID.)

An example is when a "parent" ContractCreate or ContractCall transaction calls one or more HTS precompiled contracts; each of the "child" transactions spawned for a precompiled contracts has an id with a different nonce.


scheduled: bool

The scheduled status of the transaction


validStart: Timestamp

The timestamp of this transaction

Each transaction ID must have a unique timestamp. Timestamp generation in the SDK fuzzes the current time so collisions are less likely