add waku-raw

This commit is contained in:
Oskar Thoren 2019-11-22 16:54:45 +08:00
parent 1105dfa7fc
commit d160fd9cb5
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
bytes = *OCTET
; Packet codes 0 - 127 are reserved for Waku protocol
packet-code = 0 / 1 / 2 / 3 / [ x4-127 ]
packet-format = "[" packet-code packet-format "]"
; packet-format needs to be paired with its corresponding packet-format
packet = "[" required-packet / [ optional-packet ] "]"
required-packet = 0 status / 1 messages / 2 pow-requirement / 3 bloom-filter
optional-packet = 126 p2p-request / 127 p2p-message
packet-format = "[" packet-code packet-format "]"
status = "[" version pow-requirement [ bloom-filter ] [ light-node ] "]"
; version is "an integer (as specified in RLP)"
version = DIGIT
messages = *whisper-envelope
; pow is "a single floating point value of PoW. This value is the IEEE 754 binary representation of 64-bit floating point number. Values of qNAN, sNAN, INF and -INF are not allowed. Negative values are also not allowed."
pow-requirement = pow
; bloom filter is "a byte array"
bloom-filter = bytes
light-node = BIT
p2p-request = whisper-envelope
p2p-message = whisper-envelope
whisper-envelope = "[" expiry ttl topic data nonce "]"
; 4 bytes (UNIX time in seconds)
expiry = bytes
; 4 bytes (time-to-live in seconds)
ttl = bytes
; 4 bytes of arbitrary data
topic = bytes
; byte array of arbitrary size (contains encrypted message)
data = bytes
; 8 bytes of arbitrary data (used for PoW calculation)
nonce = bytes