## 3 LORAWAN Operation
### Architecture and Operation Modes  
The LoRaWAN consists of three key components identified in Figure 1:  
* LoRaWAN motes,
* LoRaWAN gateway,
* The LoRaWAN Network Server (NS).  
The LoRaWAN motes comprise the LoRa transceiver and the LoRaWAN stack. Motes have an eight-byte device identifier, and they have different modes of operation consisting of classes [39] A, B, and C.  
Class A motes can transmit and then, turn their receiver on at specified time windows to listen for the downlink and acknowledgement (ACK), if they requested an ACK. Typically the mote listens for the downlink and ACK in a window starting one second after completion of the transmission. If the ACK was requested, the ACK would use the same SF as the original message. If the ACK were not received, the mote starts listening in a window that starts two seconds after completing the transmission, and this ACK uses a network-defined fallback SF on a specified channel. If there is a downlink message for the mode, it is sent as part of the ACK packet. Unless there is some form of edge processing, a reply to an uplink message (note to the network) could not be included in the current ACK (network to mote) since the uplink data needs to be forwarded back to the data owner, but the NS needs to have the appropriate gateway prepare the ACK. For networks with high latency, such as gateways with a satellite backhaul, the network may implement different receive window timing.  
Class B motes require gateways that implement Class B operation. The specification requires a Class B gateway to transmit a beacon. The time following the beacon is divided into time slots, and the mote and gateway negotiate a timeslot which the mote will listen for downlink messages. This mode of operation is required for motes that need to listen for messages without enough power budget to listen continuously. Uplink messages and ACKs are handled as for Class A motes.  
Class C motes listen continuously except when transmitting. Downlink messages can be sent to Class C motes at any time.  
LoRaWAN Gateways comprise a LoRa transceiver chip and a Base Band Processor, enabling the concurrent decoding of multiple channels and SF combinations. The gateway processor accepts the demodulated packet and the meta-data related to the transmission, and together these are forwarded to the NS using a JavaScript Object Notation (JSON) packet transported in a User Datagram Protocol (UDP) [40] packet. Since this is UDP, there is no guarantee that the NS will receive the packet. The actual user data sent by the mote is encrypted in the packet and not readable in transit. Gateways transmit data to motes as per the class of the mote. Therefore, Class A motes receive data within an ACK, Class B motes in an ACK or a designated time slot, and Class C at any time.  
Network Server defines a LoRaWAN network. The NS communicates with gateways, identifies if a mote belongs to network, handles the up and downlink traffic, handles keys generation, and decodes user data. The NS manages the separation of motes based on their ownership. The database of the network server maps the mote hardware identifier and application group to the mote current network address. The database can store the encryption keys for communicating with the mote. As an alternate network implementation to that of Figure 1, each application owner has an application server where application keys are generated for motes. In this scenario, the application owner and the network operator are separate and unencrypted data passes from the NS to the application server [41]. The application server then uses the applicable application key to decode the data.