Packet Purchasing
A trustless and decentralized way to allow coverage providers and coverage users to exchange value is core to the Helium Network.
Packet purchasing is implemented on the Helium Blockchain with two specific primitives:
- Organizationally Unique Identifiers
- State Channels
State Channels
State channels are side-chains opened by OUI operators (any of the libp2p addresses registered to
the OUI). With an
state_channel_open
transaction, the operator stakes two times the amount of Data Credits (DC) available to be spent in
the channel. In addition, the amount of blocks until channel expiration is configured.
Once a state channel is opened, hotspots and OUIs operators are able to transact within the channel. Generally, the flow is as follows:
- a packet is offered by a hotspot to the OUI operator, with some metadata but without the actual payload
- the OUI operator decides whether to purchase the packet; if it decides to purchase, the offer is signed
- the packet is delivered by the hotspot to the OUI operator
These signed offers are added to the state channel "banner", which allows the device to confirm that it is being given credit for its work during the lifetime of the state channel. This is possible even as many other hotspots have their own transactions added to the same banner.
Sometime before the expiration block, the OUI operator will submit a
state_channel_close
transaction channel, a transaction which also shows how many data credits are being burned in the
name of which hotspots. Should a hotspot not be credited the appropriate amount, it has recourse
during a "grace period" the ten blocks after the closure to file a dispute, using the signed offers
as evidence. This is done in the form of alternate state channel close transactions.
If there is no overspend or disputes, the second half of the stake and any remaining credit is returned to the OUI operator. Otherwise, the entire stake is kept and, in the event of a dispute, the appropriate amount of data credit burns are attributed to the hotspots with valid disputes.
Should the operator neglect to close the state channel before the expiration block, closes by all parties are still accepted during the ten block grace period. Should the OUI operator still neglect to close the channel, they will lose their whole stake.