Class: Transaction

Transaction(hexDataopt)

new Transaction(hexDataopt)

Initializes a new CryptoNote Transaction object
Parameters:
Name Type Attributes Description
hexData string <optional>
the hexadecimal representation of an existing transaction
Source:

Members

(readonly) amount :number

The amount of the transaction
Type:
  • number
Source:

blob :string

The hexadecimal representation of the transaction
Type:
  • string
Source:

(readonly) cryptoType :string

Returns the underlying cryptography module used
Type:
  • string
Source:

extra :Array.<Transaction.TransactionExtraTag>|string

The transaction extra tags/hex
Type:
Source:

(readonly) extraBlob :string

The hexadecimal representation of the transaction extra information
Type:
  • string
Source:

(readonly) extraData :string

The hexadecimal representation of the transaction extra data
Type:
  • string
Source:

(readonly) extraSize :number

The size of the transaction extra field in bytes
Type:
  • number
Source:

(readonly) fee :number

The transaction fee of the transaction
Type:
  • number
Source:

(readonly) hash :string

The transaction hash
Type:
  • string
Source:

ignoredField :boolean

Ignored field only used in some transactions
Type:
  • boolean
Source:

inputs :Array.<Transaction.TransactionInput>

The transaction inputs
Type:
Source:

(readonly) mergedMining :TransactionExtraMergedMining

The merged mining tag
Type:
  • TransactionExtraMergedMining
Source:

outputs :Array.<Transaction.TransactionOutput>

The transaction outputs
Type:
Source:

(readonly) paymentId :string

The hexadecimal representation of the transaction payment ID
Type:
  • string
Source:

(readonly) prefix :string

The hexadecimal representation of the transaction prefix
Type:
  • string
Source:

(readonly) prefixHash :string

The transaction prefix hash
Type:
  • string
Source:

(readonly) publicKey :string

The hexadecimal representation of the transction public key
Type:
  • string
Source:

signatures :Array.<Array.<string>>

The transaction signatures
Type:
  • Array.<Array.<string>>
Source:

(readonly) size :number

The size of the transaction in bytes
Type:
  • number
Source:

(readonly) stripped :Transaction

Returns a stripped version of this transaction that does not contain signatures or unknown extra data
Type:
Source:

transactionKeys :Transaction.KeyPair

Transaction one time keys - used for legacy purposes and convenience Note: setting these will not cause the actual transaction data to be update with the publicKey provided
Type:
Source:

unlockTime :number

The unlock time of the transaction
Type:
  • number
Default Value:
  • 0
Source:

version :number

The version number of the transaction
Type:
  • number
Default Value:
  • 1
Source:

Methods

addExtraData(data) → {boolean}

Adds a arbitrary data to the Transaction's extra information
Parameters:
Name Type Description
data Buffer | string the data to add
Source:
Returns:
if succeeded
Type
boolean

addMergedMining(depth, merkleRoot) → {boolean}

Adds a Merged Mining tag to the Transaction's extra information
Parameters:
Name Type Description
depth number the merkle root hash depth
merkleRoot string the merkle root hash
Source:
Returns:
if succeeded
Type
boolean

addPaymentId(paymentId) → {boolean}

Adds a payment ID to the Transaction's extra information
Parameters:
Name Type Description
paymentId string the payment ID for the transaction
Source:
Returns:
if succeeded
Type
boolean

addPublicKey(publicKey) → {boolean}

Adds a transaction public key to the Transaction's extra information
Parameters:
Name Type Description
publicKey string the public key of the transaction
Source:
Returns:
if succeeded
Type
boolean

Type Definitions

KeyPair

Transaction Keypair
Type:
  • Object
Properties:
Name Type Attributes Description
privateKey string <optional>
a private key
publicKey string <optional>
a public key
Source:

TransactionExtraMergedMining

Transaction Merged Mining Tag Structure
Type:
  • Object
Properties:
Name Type Description
depth number the depth of the merkle root
merkleRoot string the merkle root hash
Source:

TransactionExtraNonce

Transaction Extra Nonce Tag Structure
Type:
  • Object
Properties:
Name Type Description
tag number the nonce tag type
paymentId string the payment ID of the transaction
Source:

TransactionExtraTag

Transaction Extra Tag Structure. What properties exist depend on the type
Type:
  • Object
Properties:
Name Type Attributes Description
tag number the tag type
publicKey string <optional>
the public key of the transaction (type 1 only)
nonces Array.<Transaction.TransactionExtraNonce> <optional>
extra nonces (type 2 only)
depth number <optional>
The depth of the merkle root (type 3 only)
merkleRoot string <optional>
the merkle root hash (type 3 only)
Source:

TransactionInput

Transaction Input Structure. What properties exist depend on the type
Type:
  • Object
Properties:
Name Type Attributes Description
type string the input type
amount number <optional>
the amount of the input (type '02' only)
keyOffsets Array.<number> <optional>
the keyOffsets of the input (type '02' only)
keyImage string <optional>
the keyImage of the input (type '02' only)
blockIndex number <optional>
the block index of the input (type 'ff' only)
Source:

TransactionOutput

Transaction Output Structure
Type:
  • Object
Properties:
Name Type Description
type string the output type
amount number the amount of the output
key string the output key
Source: