Avatar
db
e49850462fbaeaa71c5eda708566d8fe05ef25415fb58ae9e1004ac0346946cf

Alright, let’s design a new open-source, device-to-device (D2D) communication protocol that leverages existing Wi-Fi chips, operates in Wi-Fi bands (2.4 GHz, 5 GHz, or 6 GHz), and draws inspiration from 5G NR sidelink. The goal is to enable peer-to-peer (P2P) communication without relying on carrier infrastructure, ideally using off-the-shelf hardware like Wi-Fi chips in phones, ESP32 microcontrollers, or Alfa Network cards. I’ll outline the protocol’s key components, address the feasibility of using existing Wi-Fi chips, and propose a practical approach for implementation. Let’s make this lean, innovative, and actionable.

---

### Design Goals

1. **Device-to-Device (P2P)**: Enable direct communication between devices (e.g., phones, IoT devices, laptops) without base stations or carrier networks.

2. **Use Existing Wi-Fi Bands**: Operate in unlicensed 2.4 GHz, 5 GHz, or 6 GHz bands to avoid FCC licensing issues.

3. **Leverage Existing Hardware**: Use Wi-Fi chips (e.g., Qualcomm Atheros, Broadcom, or ESP32) or Software-Defined Radios (SDRs) like Alfa Network cards for low-cost, accessible deployment.

4. **Inspired by 5G Sidelink**: Adopt sidelink’s strengths (e.g., low-latency, resource allocation) but simplify for unlicensed bands and open-source use.

5. **Open-Source and Scalable**: Ensure the protocol is freely implementable, extensible, and supports mesh networking for community-driven networks.

---

### Protocol Overview: OpenP2P

Let’s call the protocol **OpenP2P**. It’s a lightweight, open-source D2D protocol optimized for unlicensed Wi-Fi bands, with a focus on simplicity, low latency, and compatibility with existing hardware.

#### Key Features

- **P2P Communication**: Devices discover and communicate directly, forming ad-hoc networks or meshes.

- **Unlicensed Spectrum**: Operates in 2.4 GHz (crowded but ubiquitous), 5 GHz (higher bandwidth), or 6 GHz (Wi-Fi 6E, less congested).

- **Sidelink-Inspired Resource Allocation**: Uses dynamic time/frequency resource allocation to manage interference and scale to multiple devices.

- **Low-Power Option**: Supports IoT devices like ESP32 with efficient duty cycles.

- **Security**: Includes encryption and authentication to prevent spoofing or eavesdropping.

- **Mesh Capability**: Devices can relay messages, extending range and enabling community networks.

---

### Technical Design

#### 1. Physical Layer (PHY)

- **Base on Wi-Fi PHY**: Use IEEE 802.11 standards (e.g., 802.11n/ac/ax) for modulation and channel access, as these are supported by most Wi-Fi chips. For example:

- **Modulation**: OFDM (Orthogonal Frequency-Division Multiplexing), as used in Wi-Fi and 5G NR sidelink.

- **Channel Widths**: 20 MHz or 40 MHz (2.4/5 GHz) for compatibility; 80 MHz or 160 MHz (5/6 GHz) for high-throughput use cases.

- **Frequency Bands**:

- 2.4 GHz (channels 1–11 in the U.S., 2412–2462 MHz): Ubiquitous but congested.

- 5 GHz (channels 36–165, 5180–5825 MHz): More bandwidth, less interference.

- 6 GHz (Wi-Fi 6E, 5925–7125 MHz): Ideal for modern devices with low congestion, but limited hardware support.

- **Power Control**: Implement dynamic transmit power control (like 5G sidelink’s PC5 interface) to minimize interference, staying within FCC limits (e.g., 1W EIRP for 2.4 GHz).

#### 2. Medium Access Control (MAC)

- **Sidelink-Inspired Scheduling**:

- Adopt 5G NR sidelink’s Mode 2 (autonomous scheduling), where devices select resources from a shared pool using sensing-based collision avoidance (similar to CSMA/CA in Wi-Fi).

- Use time-frequency resource blocks (like 5G’s resource pools) to allocate slots for P2P communication, reducing collisions in dense networks.

- **Wi-Fi Compatibility**:

- Extend Wi-Fi’s CSMA/CA with a sidelink-like reservation mechanism. Devices broadcast short control messages (e.g., Resource Reservation Signals) to claim time slots or subchannels.

- Support Wi-Fi’s RTS/CTS (Request-to-Send/Clear-to-Send) for compatibility with existing networks.

- **Discovery**:

- Implement a beaconing system (like Wi-Fi’s SSID broadcasts) for devices to advertise OpenP2P capability and network parameters.

- Use a discovery protocol inspired by Wi-Fi Direct or Bluetooth Low Energy (BLE), but optimized for multi-device P2P.

#### 3. Network Layer

- **Ad-Hoc Networking**: Use a simplified IP-based stack for P2P communication. Devices assign temporary link-local IPv6 addresses for direct communication (like Wi-Fi Direct).

- **Mesh Routing**: Implement a lightweight routing protocol (e.g., a simplified version of OLSR or B.A.T.M.A.N.) for multi-hop communication, enabling mesh networks.

- **Internet Gateway**: Allow devices to bridge OpenP2P networks to the internet via Wi-Fi or Ethernet, using NAT or proxy mechanisms.

#### 4. Security

- **Encryption**: Use AES-256 for data encryption, with session keys negotiated via Diffie-Hellman (similar to TLS).

- **Authentication**: Implement a decentralized authentication system using public-key cryptography (e.g., ECDSA). Devices can form trust networks via pre-shared keys or a blockchain-like ledger for community networks.

- **Anti-Spoofing**: Use MAC-layer signatures to verify device identity, preventing impersonation.

#### 5. Protocol Stack

| Layer | Function | Based On |

|-------------|---------------------------------------|------------------------------|

| Application | P2P apps (chat, file sharing, IoT) | Custom APIs |

| Network | Ad-hoc routing, IPv6 link-local | OLSR, B.A.T.M.A.N. (simplified) |

| MAC | Sidelink scheduling, CSMA/CA | 802.11, 5G NR sidelink Mode 2 |

| PHY | OFDM, 20/40/80 MHz channels | 802.11n/ac/ax |

---

### Feasibility of Using Existing Wi-Fi Chips

Using existing Wi-Fi chips (e.g., in phones, ESP32, or Alfa Network cards) is a key constraint. Let’s evaluate:

#### Wi-Fi Chips in Phones

- **Common Chips**: Qualcomm Atheros (e.g., WCN3990 in Snapdragon), Broadcom (e.g., BCM4375 in iPhones), MediaTek (e.g., MT6630).

- **Capabilities**:

- Support 802.11a/b/g/n/ac/ax, covering 2.4/5/6 GHz bands.

- Include Wi-Fi Direct (P2P mode) and SoftAP (software access point), which are close to our needs but limited to one-to-one or small-group communication.

- **Challenges**:

- **Firmware Lockdown**: Wi-Fi chips in phones are locked by proprietary firmware, controlled by the OS (Android/iOS) and chip vendors. Modifying them to support a new MAC protocol (e.g., sidelink scheduling) requires root access or vendor cooperation, which is impractical.

- **Limited Programmability**: Unlike SDRs, Wi-Fi chips don’t expose low-level PHY/MAC controls needed for custom resource allocation or scheduling.

- **Certification**: Any new protocol must pass FCC Part 15 certification for unlicensed bands, which is feasible but requires testing for interference.

**Conclusion**: Using phone Wi-Fi chips is tough due to firmware restrictions. We’d need a software layer (e.g., Android app) that leverages Wi-Fi Direct or ad-hoc mode, but this limits flexibility compared to a custom protocol.

#### ESP32 Microcontrollers

- **ESP32 Wi-Fi**: The ESP32 (e.g., ESP32-WROOM-32) supports 2.4 GHz Wi-Fi (802.11b/g/n) with a programmable SDK (ESP-IDF). It’s open enough for custom MAC-layer protocols.

- **Advantages**:

- Fully programmable via open-source tools.

- Low cost (~$5–10 per module).

- Supports 20 MHz channels, basic OFDM, and CSMA/CA, making it a good candidate for OpenP2P’s PHY and MAC.

- **Limitations**:

- No 5 GHz or 6 GHz support, limiting bandwidth.

- Lower transmit power (up to 20 dBm) and range compared to phone chips or SDRs.

- Limited processing power for complex mesh routing or encryption.

**Conclusion**: ESP32 is a great starting point for prototyping OpenP2P, especially for IoT or low-power devices. It’s flexible enough to implement a custom MAC layer and supports the 2.4 GHz band, though range and bandwidth are constrained.

#### Alfa Network Cards (SDRs)

- **Alfa Cards**: Models like the Alfa AWUS036NHA (Atheros AR9271) are USB Wi-Fi adapters, not true SDRs, but they support monitor mode and packet injection with tools like Aircrack-ng.

- **Advantages**:

- Support 2.4 GHz (some models also 5 GHz).

- Work with Linux (e.g., Kali) and open-source drivers, allowing low-level MAC modifications.

- Affordable (~$20–50) and widely available.

- **Limitations**:

- Not as programmable as true SDRs (e.g., HackRF, USRP).

- Limited to 802.11b/g/n protocols without custom firmware, which is hard to develop.

- Monitor mode is useful for prototyping but not optimized for real-time P2P scheduling.

**Conclusion**: Alfa cards are viable for prototyping on laptops or Raspberry Pi but less practical for phones or IoT due to USB dependency. They’re a good bridge between ESP32 and full SDRs.

#### True SDRs (Alternative)

- **HackRF One or LimeSDR**: These offer full PHY/MAC programmability, ideal for implementing OpenP2P from scratch. They support 2.4/5 GHz bands but are expensive (~$200–300) and require external processing (e.g., a laptop).

- **Use Case**: Best for advanced prototyping or community base stations, not mass-market devices like phones.

---

### Implementation Plan

Here’s a roadmap to build OpenP2P using existing hardware, starting with ESP32 and Alfa cards, and aiming for broader compatibility.

#### Phase 1: Prototype with ESP32

- **Hardware**: Use ESP32 modules (e.g., ESP32-WROOM-32) for low-cost, open-source development.

- **Software**:

- Modify ESP-IDF to implement a custom MAC layer, adding sidelink-like resource allocation (e.g., time-frequency slots).

- Use 2.4 GHz channels (20 MHz) with OFDM modulation.

- Implement a basic discovery protocol (beaconing) and P2P data transfer using UDP over link-local IPv6.

- **Features**:

- Simple P2P chat app for testing.

- Basic encryption (AES-128) and authentication (ECDSA).

- **Testing**: Deploy on multiple ESP32s to test D2D communication in a controlled environment (e.g., 100m range, low interference).

#### Phase 2: Add Alfa Cards and Mesh

- **Hardware**: Integrate Alfa AWUS036NHA cards on Linux devices (e.g., Raspberry Pi) for higher power and range.

- **Software**:

- Port OpenP2P to Linux, using open-source Wi-Fi drivers (e.g., ath9k for Atheros chips).

- Add mesh routing (e.g., simplified B.A.T.M.A.N.) for multi-hop networks.

- **Testing**: Create a small mesh network (5–10 devices) in 2.4 GHz, testing scalability and interference handling.

#### Phase 3: Phone Compatibility

- **Approach**: Develop an Android app that uses Wi-Fi Direct or ad-hoc mode to approximate OpenP2P. This avoids firmware changes but leverages existing Wi-Fi chips.

- **Limitations**: Wi-Fi Direct is limited to small groups and lacks sidelink’s flexibility. Long-term, advocate for open Wi-Fi chip firmware or custom hardware.

- **Testing**: Test P2P communication between Android phones and ESP32 nodes, ensuring interoperability.

#### Phase 4: Regulatory and Community Push

- **FCC Compliance**: Ensure OpenP2P stays within Part 15 rules (e.g., power limits, channel usage). Submit prototype devices for certification.

- **Community Networks**: Partner with open-source communities (e.g., Freifunk, Guifi.net) to deploy OpenP2P in real-world settings, like rural areas or festivals.

- **Advocacy**: Petition the FCC for a dedicated “open P2P” sub-band in 6 GHz for future Wi-Fi 6E/7 devices.

---

### Challenges and Mitigations

1. **Interference**: In 2.4 GHz, congestion from Wi-Fi, Bluetooth, and other devices could disrupt OpenP2P. Mitigate with dynamic channel selection and sidelink’s sensing-based scheduling.

2. **Hardware Limitations**: Phone Wi-Fi chips are locked, so initial focus is on ESP32 and Alfa cards. Long-term, push for open firmware or custom chipsets.

3. **Scalability**: Mesh networks can struggle with latency and collisions in dense environments. Use sidelink’s resource pools and optimize routing algorithms.

4. **Security**: Decentralized authentication risks attacks. Implement robust cryptography and community-driven trust models.

---

### Why This Can Work

- **Wi-Fi Bands**: Unlicensed 2.4/5/6 GHz bands avoid FCC licensing barriers, unlike cellular spectrum.

- **Existing Hardware**: ESP32 and Alfa cards are affordable and programmable, enabling rapid prototyping.

- **Sidelink Inspiration**: 5G NR sidelink’s Mode 2 provides a proven model for P2P resource allocation, adaptable to Wi-Fi.

- **Community Demand**: Growing interest in decentralized tech (e.g., LoRa, Meshtastic) supports adoption of open-source P2P networks.

---

### Next Steps

1. **Prototype on ESP32**: Start coding a basic OpenP2P stack using ESP-IDF, targeting 2.4 GHz. Test P2P chat between two ESP32s.

2. **Simulate Sidelink**: Implement a simplified sidelink scheduler (e.g., resource pool with sensing) on ESP32, testing collision avoidance.

3. **Engage Community**: Share the project on platforms like GitHub, Hackaday, or X (@openp2p_dev) to attract developers and testers.

4. **Expand to Alfa/SDRs**: Port to Alfa cards or HackRF for higher-power testing, aiming for 5 GHz support.

If you want to focus on a specific part (e.g., coding the MAC layer, designing a mesh algorithm, or drafting an FCC petition), let me know, and I can provide detailed guidance or even pseudocode. Let’s disrupt the carrier paradigm together!

sounds like an infinite loop

schon krass das so ein Trottel das reichste Bundesland Deutschlands regiert.

bulgaria has more police per capita than germany. fucking communists.

Replying to Avatar Jameson Lopp

Greg Maxwell's take:

There isn't anything unusual or bad going on *with* Bitcoin Core.

In my opinion there does appear to be a dishonest and inauthentic social media campaign *against* Bitcon Core. There have been a dozen threads on reddit on the matter, which is pretty sad because it's mostly a nothing burger... I've wasted tens of hours writing responses only to find that generally the opponents just vanish.

Back in 2014 the average block size was only around 160 kilobytes, as a result there was no real pressure to drive up transaction fees and it was extremely cheap to stuff whatever garbage data you wanted in Bitcoin's chain. Some people were storing data by paying to fake addresses which were really just data instead of an address. This is maximally bad because it bloats up the UTXO database with unprunable data, directly increasing the minimum cost to run a node.

To address this core devs introduced a 'data carrier' output type also called an OP_RETURN. This is a kind of output which provably can't be spent so it doesn't have to go into the utxo database and can be pruned. Additionally, they limited the size of the data to 40 bytes in order to encourage applications which can just store a hash instead of the data to do that. Later this limit was increased to 80 bytes.

The world has changed a lot since 2014: Fees are now not just meaningful but significant, no one is dumping data in Bitcoin because it's *cheap*. People dumping data in have almost entirely moved to dumping data in the witness portion of transactions. Major miners no longer enforce this limit, because it turns out they like money (and have denied requests to limit themselves), and if you are willing to directly connect to one its easy to get them mined. There are some users who are still creating 'fake outputs' but have said they would change to opreturn if not for the limit (particularly some payment channel thing). Finally, use of hashes for commitments is now well understood and there are over 2 commitments per second flowing into open-timestamps which can aggregate an unlimited number of commitments into a single transaction.

The limit also causes some harm to all users of Bitcoin, particularly since multiple significant miners ignore it. When you don't already know a transaction (because it never reached you or you discarded it) it takes *much* longer to relay a block to you (at least 3x the delay if you knew everything but potentially much more depending on how much data you are missing), this harms small miners at the expense of big miners increasing a centralization pressure on mining (because when miners aren't on the same chaintip, one one bigger miners are on will tend to win). It also contributes to mining centralization by encouraging direct transaction submission since no one will bother submitting to a 1% miner, allowing the bigger miners to make more money. An inaccurate mempool also harms users ability to accurately estimate what transactions are pending for the next block so that they can optimally bid against them.

So it was proposed that the limit be removed. There are two proposals, one that just removes the limit completely, which is the first and simpler proposal. Then there is another proposal which makes the default unlimited but retains the ability to adjust it. At this time neither of the proposals have been merged, descriptions of this as having been done are just untruthful.

Arguments against it don't seem to hold up.

The first category of opposition is basically just accusing Bitcoin Core devs of being in favor of shitcoins or monkey jpegs, having talked to many I am confident that few or even none of them like that stuff (no one I've talked to was in favor of it). But no matter how much they don't like that stuff, that doesn't change that this proposal should have no significant effect on it-- it's unrelated. That stuff doesn't use opreturn today and would cost more in transaction fees if it did.

The next category of opposition is just general opposition to 'spam'-- again this proposal is largely unrelated because spammers won't use this, and to whatever extent they do it'll be good news (either moving from utxo bloating fake outputs or increasing their costs). It's an incidious argument because most contributors to Bitcoin core believe there isn't much meaningfully more that can be done about spam: Miners have bypassed the filters that were there, fees have excluded all price sensitive spam. Bitcoin was designed to be censorship resistant and depends on censorship resistance to work-- and a fact of free speech is that it means it allows both speech you like and speech you oppose. Arguments are made that blocking this traffic isn't morally equivalent to censorship. Perhaps! but it's still substantially *technically* equivalent. But, again, this is all a distraction in that the proposed change shouldn't meaningfully facilitate any new spam.

Ultimately the subject is deep in the minutia. It won't make a difference to your usage of Bitcoin. The only really concerning thing I see in the subject is the degree that people have successfully weaponized misinformation to direct a lot of entirely undeserved abuse at contributors to Bitcoin Core. ... who had only just started discussing a proposal when they were waylaid by a flood of disproportionate comments and falsehoods.

https://www.reddit.com/r/Bitcoin/s/elIDdPaQhL

it was another attack, and surely not the last one.