new Transaction()
This class represent Transaction.
Transaction are being made between two people, and require their public key
the person who sends the amount must sign the transaction with his key,
if the key does not match or the transaction has not been signed, blockchain will not accept it
- Source:
Methods
(static) fromResponse(data) → {Transaction}
This function is used to recreate Transaction class from received json transaction.
Parameters:
Name | Type | Description |
---|---|---|
data |
- Source:
Returns:
- Type
- Transaction
calculateHash() → {hash}
This function return calculated hash of the transaction
- Source:
Returns:
- Type
- hash
isValid() → {Buffer|Boolean|boolean|*|PromiseLike.<boolean>|boolean}
This function checks if the the transaction is valid.
It is checked first if the sender address is from mine (When we have mining reward transaction) - in that case functions return true
In other case function checks if transaction has signature and verify it.
- Source:
Returns:
- Type
- Buffer | Boolean | boolean | * | PromiseLike.<boolean> | boolean
signTransaction(signingKey)
This function checks the provided key and then signs the transaction with it
Parameters:
Name | Type | Description |
---|---|---|
signingKey |
Key wich is used to sign the transaction |
- Source: