inventory
— Chain inventory¶
There are three types of inventory in the NEO chain being Block, Consensus and Transaction, as indicated by InventoryType
.
Inventory types are shared over the network in a variety of scenarios. Consensus inventory types are relayed between NEO’s consensus nodes as the data to use to come to an agreement on the next Block to produce.
Next, the Block inventory type is send as a reponse to a network request. Additionally, the reference C# neo-cli client regularly broadcasts its latest block hash through this mechanism.
Finally, the Transaction inventory type is commonly used when a new transaction needs to be relayed or is requested from the mempool.
-
class
neo3.network.payloads.inventory.
InventoryType
(value)¶ Bases:
enum.IntEnum
An enumeration.
-
BLOCK
= 44¶
-
CONSENSUS
= 45¶
-
EXTENSIBLE
= 46¶
-
TX
= 43¶
-
-
class
neo3.network.payloads.inventory.
InventoryPayload
(type, hashes)¶ Bases:
neo3.core.serialization.ISerializable
A payload used to share inventory hashes.
Create payload.
- Parameters
type (
InventoryType
) – indicator to what type of object the the hashes of this payload relate to.
-
deserialize
(reader)¶ Deserialize the object from a binary stream.
- Parameters
reader (
BinaryReader
) – instance.- Return type
-
classmethod
deserialize_from_bytes
(data)¶ Parse data into an object instance.
-
serialize
(writer)¶ Serialize the object into a binary stream.
- Parameters
writer (
BinaryWriter
) – instance.- Return type
-
class
neo3.network.payloads.inventory.
IInventory
(*args, **kwargs)¶ Bases:
neo3.network.payloads.verification.IVerifiable
-
abstract
deserialize
(reader)¶ Deserialize the object from a binary stream.
- Parameters
reader (
BinaryReader
) – instance.- Return type
-
classmethod
deserialize_from_bytes
(data)¶ Parse data into an object instance.
-
get_hash_data
(protocol_magic)¶ Get the unsigned data
-
abstract
get_script_hashes_for_verifying
(snapshot)¶ Helper method to get the data used in verifying the object.
-
abstract
serialize
(writer)¶ Serialize the object into a binary stream.
- Parameters
writer (
BinaryWriter
) – instance.- Return type
-
abstract property
inventory_type
¶ - Return type
-
abstract