2.8 KiB
Messaging Protocol
Overview
This protocol assumes an underlying authenticated and ordered transport mechanism that takes care of framing individual messages. BOLT #8 specifies the canonical transport layer used in Lightning, though it can be replaced by any transport that fulfills the above guarantees.
All data fields are unsigned big-endian unless otherwise specified.
Table of Contents
Connection Handling and Multiplexing
Implementations MUST use a single connection per peer; contract messages (which include a contract ID) are multiplexed over this single connection.
Message Format
We reuse the Lightning Message Format and the Type-Length-Value Format
Fundamental Types
Various fundamental types are referred to in the message specifications:
byte: an 8-bit byteu16: a 2 byte unsigned integeru32: a 4 byte unsigned integeru64: an 8 byte unsigned integer
Inside TLV records which contain a single value, leading zeros in integers can be omitted:
tu16: a 0 to 2 byte unsigned integertu32: a 0 to 4 byte unsigned integertu64: a 0 to 8 byte unsigned integer
The following convenience types are also defined:
chain_hash: a 32-byte chain identifier (see BOLT #0)contract_id: a 32-byte contract_id (see Protocol Specification)sha256: a 32-byte SHA2-256 hashsignature: a 64-byte bitcoin Elliptic Curve signaturepoint: a 33-byte Elliptic Curve point (compressed encoding as per SEC 1 standard)spk: A bitcoin script public key encoded as ASM prefixed with a Bitcoin CompactSize unsigned integershort_contract_id: an 8 byte value identifying a contract funding transaction on-chain (see BOLT #7)bigsize: a variable-length, unsigned integer similar to Bitcoin's CompactSize encoding, but big-endian. Described in BigSize.contract_info: ???oracle_info: ???funding_input: ???cet_signatures: ???funding_signatures: ???
Authors
Nadav Kohen nadavk25@gmail.com
This work is licensed under a Creative Commons Attribution 4.0 International License.