Skip to content

About

Offline social media ( BLE MESH NETWORK PROJECT)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Ripple

no internet. no server. no cap.

ripple is a social network that runs entirely over bluetooth. you pull out your phone, open the app, and your posts start spreading to whoever is physically nearby. they spread to the next person. and the next. max 5 hops and then they die. thats it. thats the whole thing.

no accounts. no cloud. no algorithm deciding what you see. just proximity.


how it actually works

every device advertises itself over BLE with a custom service UUID. when two ripple devices get close enough, they connect over GATT and run a sync protocol:

HELLO  →  you there?
HAVE   →  yeah, here's everything i got (list of content IDs)
WANT   →  ok i need these ones
POST   →  here you go (the actual posts)
DONE   →  aight we good

both sides push what the other is missing in the same connection. one handshake, bidirectional. then disconnect.

each post has a hops counter. every time it gets relayed it goes up by 1. hits 5, it stops moving. so the further you are from where something was posted, the less likely you are to ever see it.

identity is a did:mesh: backed by an Ed25519 keypair stored in secure storage on device. no username, no password, no server to verify anything. your key is your identity.


the stack

  • react native (expo sdk 54, old arch — new arch breaks the BLE module)
  • react-native-ble-plx for scanning and connecting as a GATT client
  • custom kotlin native module (modules/ble-advertiser/) for BLE advertising and running the GATT server
  • expo-sqlite for storing posts locally
  • tweetnacl for the identity keypair
  • expo-secure-store for persisting the keypair

the part i needed help with

the BLE advertising was cooked. every npm package for BLE advertising on android is abandoned — the most popular one (react-native-ble-advertiser) hasnt been touched since 2020 and straight up doesnt compile with Android Gradle Plugin 8+. it was throwing namespace errors, package attribute errors, all that.

tried patching it, tried config plugins, tried post-install hooks. EAS build kept restoring cached node_modules and undoing everything.

ended up scrapping the whole thing and writing a native Kotlin module from scratch (modules/ble-advertiser/). referenced it as a file: dependency in package.json so EAS pulls it straight from the project. that fixed it.

the module handles:

  • BLE advertising (with scan response packet for the device name, since the 31-byte main packet fills up with just the service UUID)
  • GATT server that accepts incoming connections and handles the sync protocol writes
  • emitting events back to JS when data comes in from a peer

build / run

npm install

# cloud build (android)
eas build --platform android --profile development --clear-cache

# run on device after installing the dev client APK
npm run android

you need two physical android devices to actually test the sync. the simulator cant do bluetooth.


install

grab the latest build here:

https://expo.dev/accounts/potato_gupta/projects/ripple/builds/8ba1e7f9-b2dd-4a94-b07f-408babad802f

scan the QR, install the APK, done.


project structure

src/core/
  ble.js        — scan, advertise, GATT client, sync state machine
  protocol.js   — message types, encode/decode, hop relay logic
  store.js      — sqlite: save posts, query feed, CID lookups
  profile.js    — keypair generation, DID creation
  useprofile.js — react hook that loads/creates identity on mount

modules/ble-advertiser/
  android/      — kotlin native module (GATT server + BLE advertising)
  index.js      — JS bridge

App.js          — feed screen, profile screen, compose modal, tab nav

built this to see if a social network without any infrastructure was actually possible. turns out it is. its just bluetooth.

About

Offline social media ( BLE MESH NETWORK PROJECT)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages