-
-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Background
js-libp2p is the JavaScript implementation of the libp2p networking stack, enabling peer-to-peer communication with modular transport, discovery, and security protocols. Integrating it with React Native is critical for decentralized applications, allowing mobile clients to connect to peer networks without relying on centralized servers.
Currently, react-native-tcp-socket, which serves as a TCP transport layer in React Native, faces compatibility issues with js-libp2p. Fixing these issues will not only enable seamless connectivity for libp2p-based applications on mobile but also improve react-native-tcp-socket by bringing it closer to Node.js's net implementation, ensuring long-term maintainability and broader adoption.
Bounty Details
I am offering $300 to the developer who successfully creates a PR addressing the following:
Tasks
- Solve react-native-tcp-socket issue #183: Implement support for the options parameter in the net.createServer method to align with Node.js's net module.
- Fix connection failures when a React Native client dials a relay: Ensure that React Native clients can successfully establish connections with relays without encountering errors such as UnexpectedEOFError (see Exhibit 2 below).
Acceptance Criteria (AC)
✅ Issue #183 is resolved.
✅ A React Native client can successfully dial a bootstrap/relay/peer without connection failures.
✅ A pull request (PR) is created with the fixes.
If you need assistance testing, I am happy to help by setting up a reproducible repository.
Exhibit 2: Connection Failure Log
libp2p:tcp:socket:error encrypting inbound connection from /ip4/X.X.X.X/tcp/58057 failed UnexpectedEOFError: unexpected end of input
at Object.read (file:///home/nodejs/libp2p/node_modules/it-byte-stream/dist/src/index.js:94:31)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Object.read (file:///home/nodejs/libp2p/node_modules/it-length-prefixed-stream/dist/src/index.js:45:37)
at async read (file:///home/nodejs/libp2p/node_modules/@libp2p/multistream-select/dist/src/multistream.js:22:17)
at async Module.readString (file:///home/nodejs/libp2p/node_modules/@libp2p/multistream-select/dist/src/multistream.js:33:17)
at async Module.handle (file:///home/nodejs/libp2p/node_modules/@libp2p/multistream-select/dist/src/handle.js:63:26)
at async DefaultUpgrader._encryptInbound (file:///home/nodejs/libp2p/node_modules/libp2p/dist/src/upgrader.js:458:42)
at async DefaultUpgrader._performUpgrade (file:///home/nodejs/libp2p/node_modules/libp2p/dist/src/upgrader.js:173:21)
at async DefaultUpgrader.upgradeInbound (file:///home/nodejs/libp2p/node_modules/libp2p/dist/src/upgrader.js:99:13) {
code: 'ERR_UNEXPECTED_EOF'
How This Helps the Future of react-native-tcp-socket
By resolving these issues, react-native-tcp-socket will better align with Node.js's net module, making it a more reliable and future-proof solution for TCP networking in React Native. This improvement is essential for decentralized applications, Web3 projects, and any use case requiring peer-to-peer communication on mobile.
If you're up for the challenge, submit your PR and claim the bounty! 🚀 Please feel free to reach out to me with any questions.