neo.Core.TX.Transaction

Below are the details of the neo.Core.TX.Transaction module

Description:
Transaction Basic Class
Usage:
from neo.Core.Transaction import Transaction
class neo.Core.TX.Transaction.ContractTransaction(*args, **kwargs)[source]
class neo.Core.TX.Transaction.Transaction(inputs=None, outputs=None, attributes=None, scripts=None)[source]
Deserialize(reader)[source]

Deserialize full object.

Parameters:reader (neo.IO.BinaryReader) –
static DeserializeFrom(reader)[source]

Deserialize full object.

Parameters:reader (neo.IO.BinaryReader) –
Returns:
Return type:Transaction
static DeserializeFromBufer(buffer, offset=0)[source]

Deserialize object instance from the specified buffer.

Parameters:
  • buffer (bytes, bytearray, BytesIO) – (Optional) data to create the stream from.
  • offset – UNUSED
Returns:

Return type:

Transaction

DeserializeUnsigned(reader)[source]

Deserialize object.

Parameters:reader (neo.IO.BinaryReader) –
Raises:Exception – if transaction type is incorrect.
DeserializeUnsignedWithoutType(reader)[source]

Deserialize object without reading transaction type data.

Parameters:reader (neo.IO.BinaryReader) –
GetHashData()[source]

Get the data used for hashing.

Returns:
Return type:bytes
GetMessage()[source]

Get the data used for hashing.

Returns:
Return type:bytes
GetScriptHashesForVerifying(snapshot=None)[source]

Get a list of script hashes for verifying transactions.

Raises:
  • Exception – if there are no valid assets in the transaction.
  • ValueError – if a snapshot object is not provided for regular transactions. RawTx is exempt from this check.
Returns:

of UInt160 type script hashes.

Return type:

list

GetTransactionResults()[source]

Get the execution results of the transaction.

Returns:if the transaction has no references. list: of TransactionResult objects.
Return type:None
Hash

Get the hash of the transaction.

Returns:
Return type:UInt256
NetworkFee()[source]

Get the network fee.

Returns:
Return type:Fixed8
References

Get all references.

Returns:Key (UInt256): input PrevHash Value (TransactionOutput): object.
Return type:dict
ResetHashData()[source]

Reset local stored hash data.

ResetReferences()[source]

Reset local stored references.

Scripts

Get the scripts

Returns:
Return type:list
Serialize(writer)[source]

Serialize object.

Parameters:writer (neo.IO.BinaryWriter) –
SerializeUnsigned(writer)[source]

Serialize object.

Parameters:writer (neo.IO.BinaryWriter) –
Size()[source]

Get the total size in bytes of the object.

Returns:size.
Return type:int
SystemFee()[source]

Get the system fee.

Returns:currently fixed to 0.
Return type:Fixed8
ToArray()[source]

Get the byte data of self.

Returns:
Return type:bytes
ToJson()[source]

Convert object members to a dictionary that can be parsed as JSON.

Returns:
Return type:dict
Verify(snapshot, mempool)[source]

Verify the transaction.

Parameters:mempool
Returns:True if verified. False otherwise.
Return type:bool
getAllInputs()[source]

Get the inputs.

Returns:
Return type:list
class neo.Core.TX.Transaction.TransactionInput(prevHash=None, prevIndex=None)[source]

docstring for TransactionInput

Deserialize(reader)[source]

Deserialize full object.

Parameters:reader (neo.IO.BinaryReader) –
Serialize(writer)[source]

Serialize object.

Parameters:writer (neo.IO.BinaryWriter) –
ToJson()[source]

Convert object members to a dictionary that can be parsed as JSON.

Returns:
Return type:dict
ToString()[source]

Get the string representation of the object.

Returns:PrevHash:PrevIndex
Return type:str
class neo.Core.TX.Transaction.TransactionOutput(AssetId=None, Value=None, script_hash=None)[source]

docstring for TransactionOutput

Address

Get the public address of the transaction.

Returns:base58 encoded string representing the address.
Return type:str
AddressBytes

Get the public address of the transaction.

Returns:base58 encoded address.
Return type:bytes
Deserialize(reader)[source]

Deserialize full object.

Parameters:reader (neo.IO.BinaryReader) –
Serialize(writer)[source]

Serialize object.

Parameters:writer (neo.IO.BinaryWriter) –
ToJson(index)[source]

Convert object members to a dictionary that can be parsed as JSON. :param index: The index of the output in a transaction :type index: int

Returns:
Return type:dict