Consumer

Introduction

This document defines the protocol used to setup and teardown connections for the Consumer.

Operations

Join network

Consumer who is joining the network will send request to all the possible relayers with the amount that the consumer is willing to pay for the relay. The relayer can then decide whether to connect to the consumer or not.

func joinNetwork():
    ParentManagement::findParents()
    EscrowContract::addEscrow(amount)
func onNewPeer(peer, proposedFee):
    peer.send(proposedFee)
func onFeeAcceptance(signedAck):
    // do nothing

Exit Network

Consumer can exit the network by disconnecting to all the relayers.

func exitNetwork():
    ParentManagement::disconnectParents()
    EscrowContract::withdraw(remainingAmount)