# Build Your Own Mesh Gateway
https://inthemesh.com/archive/build-your-own-mesh-gateway/
"In this article we describe a do-it-yourself mesh gateway device that allows local off-grid mesh network users to exchange text messages with people on a traditional mobile phone network. This device can be used to give local mesh networks global connectivity and extend traditional networks into off-grid locations or disaster areas. Built with low-cost off-the-shelf parts, this gateway device can be run by people in their homes or rapidly deployed to where it is needed. Because a single-board computer has low power requirements this project could also be combined with an enclosure, battery and solar charger for off-grid placement."
"[Our mesh gateway project]([[Global Mesh Labs]]) uses a small board computer with both GSM and mesh radios that runs a Python script to bridge these two networks. Users on the mesh network use a simple Android messaging app to exchange SMS messages with anyone on the GSM mobile network through the gateway device or with other mesh users connected via the local mesh network."
- See [[GSM]] for more info
### History (and explanation of the Github repos)
"This project was first proposed in a [post](https://community.gotennamesh.com/t/building-a-stand-alone-rpi-based-gotenna-to-sms-gateway/5235) in early 2019 and the software was [updated](https://community.gotennamesh.com/t/building-a-stand-alone-rpi-based-gotenna-to-sms-gateway/5235/3) in early 2020 with the addition of a reference hardware implementation by [Tourmaline Wireless](http://tourmalinewireless.com/). The python script that runs on the gateway is derived from the [example script](https://github.com/gotenna/PublicSDK/blob/master/python-public-sdk/sample.py) provided by goTenna with their [public SDK](https://github.com/gotenna/PublicSDK). The Android messaging app used to communicate over the mesh network through the gateway is a [fork](https://github.com/remyers/Signal-Android) of the [Signal App](https://github.com/signalapp/Signal-Android) that adds support for mesh communication by adding code from the [sample Android Mesh app](https://github.com/gotenna/PublicSDK/tree/master/android-public-sdk/gotennasdksample/sample/src/main/java/com/gotenna/sdk/sample). ==Our fork only uses the user interface aspects of the Signal App and for simplicity — not it’s encrypted messaging functionality==. This allowed us to quickly test a prototype messaging app with our gateway. We are also working on a simple stand-alone open-source mesh messaging app using what we learned from working with the Signal app. ==We would also be happy to help anyone that wants to integrate mesh gateway functionality into an existing open-source messaging app==."
- Maybe an opportunity here?
![[image4-1440x1158.jpeg]]
### How it works
![[MeshGateway_2-1440x713.jpeg]]
### Setup
1. Install and run the GML Mesh App with a goTenna Mesh radio attached ([instructions](https://github.com/global-mesh-labs/Mesh_Gateway/blob/main/Mesh_App.md))
2. Install a Mesh Gateway device with a GSM modem and goTenna Mesh radio attached ([instructions](https://github.com/global-mesh-labs/Mesh_Gateway/blob/main/DIY-Instructions.md))
### Mesh to SMS Messaging
1. Select a phone contact using the GML Mesh App on your mobile device.
2. Compose a message and select to send it using the goTenna Mesh radio to a Mesh Gateway device.
3. The Mesh Gateway will receive the message and forward it to the SMS contact via the GSM network.
4. The SMS recipient will receive the message as an SMS message from the Mesh Gateway.
5. The SMS recipient can reply to the message using any SMS messaging app.
6. When the Mesh Gateway receives an SMS message, it looks up the mesh ID of the device that last sent an SMS to the phone number of the incoming SMS.
7. If a corresponding mesh sender is found, the gateway forwards the reply to the corresponding mesh device.
8. If no corresponding mesh sender is found, the gateway broadcasts the message to mesh devices near the gateway.
9. Mesh users receive SMS messages sent as direct replies and broadcasts via the GML Mesh App.
### ==Details==
- Messages are sent over the goTenna network to the nearest Mesh Gateway device.
- SMS messages relayed from the Mesh Gateway to a specific recipient can hop over multiple goTenna Mesh radios operating between the gateway and the mobile device user.
- SMS messages broadcast from the Mesh Gateway that are not replies to a specific recipient are not relayed over multiple hops.
### IMeshYou Map
The Mesh Gateway script also posts the user provided position and radio range of a gateway device to a web-based map and performs periodic updates so the map can show where and when a gateway is available.
![[image3-1440x1177.png]]
Pink pins with a cloud indicate active mesh gateway devices.
We are currently testing functionality to support arbitrary socket communication via a SOCKS5 proxy integrated into our upcoming [Lot49](https://github.com/remyers/lot49-android) app. This will allow low-bandwidth applications with support for communicating via a socket proxy like [Tor](https://www.torproject.org/) to operate off-grid via a mesh gateway.
To build towards our goal of incentivizing mesh gateway and relay devices we are working with the [Bitcoin Development Kit](https://bitcoindevkit.org/) team to create a reference implementation of a [low-bandwidth](https://medium.com/open-money-initiative/low-bandwidth-bitcoin-465d9a02b115) [Bitcoin wallet](https://github.com/remyers/BDWallet) that can operate off-grid via our mesh socket proxy system.
Ultimately our [Lot49 app](https://github.com/remyers/lot49-android) will send incentivized messages between mesh devices using the Bitcoin Lightning protocol. This work involves adding the [LND](https://github.com/lightningnetwork/lnd) Daemon service wrapper developed by the [Blixt Wallet](https://blixtwallet.github.io/) team.
## See also: Hackaday Project
https://hackaday.io/project/176138-mesh-gateway
- Includes additional instructions: "Adding the Sixfab 3G/4G Base Hat and Quectel Module"
![[Screen Shot 2021-07-10 at 10.20.47 AM.png]]
## See also: Bitcoin Dev Kit
![[Bitcoin Dev Kit]]