Interface Message

All Known Implementing Classes:
AddressMessage, AddressV1Message, AddressV2Message, BaseMessage, Block, BloomFilter, EmptyMessage, FeeFilterMessage, FilteredBlock, GetAddrMessage, GetBlocksMessage, GetDataMessage, GetHeadersMessage, HeadersMessage, InventoryMessage, ListMessage, MemoryPoolMessage, NotFoundMessage, Ping, Pong, RejectMessage, SendAddrV2Message, SendHeadersMessage, Transaction, UnknownMessage, VersionAck, VersionMessage

public interface Message
A Message is a data structure that can be serialized/deserialized using the Bitcoin serialization format. Classes that can be serialized to the blockchain or P2P protocol should implement this interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Maximum size of a Bitcoin P2P Message (32 MB)
  • Method Summary

    Modifier and Type
    Method
    Description
    default byte[]
    Deprecated.
    default int
    Deprecated.
    int
    Return the size of the serialized message.
    byte[]
    Serialize this message to a byte array that conforms to the Bitcoin wire protocol.
    default byte[]
    Deprecated.
  • Field Details

    • MAX_SIZE

      static final int MAX_SIZE
      Maximum size of a Bitcoin P2P Message (32 MB)
      See Also:
  • Method Details

    • messageSize

      int messageSize()
      Return the size of the serialized message. Note that if the message was deserialized from a payload, this size can differ from the size of the original payload.
      Returns:
      size of this object when serialized (in bytes)
    • getMessageSize

      @Deprecated default int getMessageSize()
      Deprecated.
    • serialize

      byte[] serialize()
      Serialize this message to a byte array that conforms to the Bitcoin wire protocol.
      Returns:
      serialized data in Bitcoin protocol format
    • bitcoinSerialize

      @Deprecated default byte[] bitcoinSerialize()
      Deprecated.
    • unsafeBitcoinSerialize

      @Deprecated default byte[] unsafeBitcoinSerialize()
      Deprecated.