You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #1 is clogged with all the many comments I open a new issue here. Feel free to continue the discussion below and I'll keep the following updated as things develop. Also feel free to create separate issues / repos to coordinate and I'll add the relevant links below.
Next steps (networking, stalled – please see the “storage” section below):
We could use some documentation for the py-libp2p library
→ Having this would allow us to implement the ipfs block * API for fetching blocks of nodes we are connected to – fetching blocks of non-connected nodes needs the DHT.
To interact with go-IPFS you can start it with ipfs daemon --disable-transport-encryption, but note that you will not be able to connect to any regular peers until one of the transport encryption methods is implemented
Write a mss-nc like utility on top of this code to demonstrate that you are able to connect to go-ipfs nodes and negotiate
Here's some very simple sample code demonstrating the main mode of MSS:
importsockets=socket.socket(socket.AF_INET)
s.connect(("127.0.0.1", 4001)) # The connect will already exists.sendall(b'\x13/multistream/1.0.0\n') # Send your supported version of MSSs.recv(1024) # → b'\x13/multistream/1.0.0\n' – Receive supported version of MSS by other party & validate!s.sendall(b"\x0d/secio/1.0.0\n") # Request the protocol you'd like to upgrade toos.recv(1024) # → b'\0x0d/secio/1.0.0\n…' – Confirmation that protocol is available + Protocol data OR# → b'\0x03na\n' – Protocol was Not Available
The binary values at the start are varints and you need to read them byte-by-byte until you're done decoding them, then read the remainder of each message lines based on the received length value
To do this you'll need to create an async stream based version of https://github.com/fmoo/python-varint/blob/master/varint.py
Convert datastore to use async/await using some library (maybe https://pypi.org/project/aiofiles/ ?) for file access The trio framework is used for async I/O now
Write a minimal py-ipfs “implementation” that can fetch blocks from the local $IPFS_PATH directory and expose them with an API similar to what https://github.com/ipfs/py-ipfs-http-client currently offers (goal here is to eventually have a drop-in replacement)
In progress by @Alexander255 (no public code yet, most work happens in py-datastore)
Implement a simple Python HTTP server that emulates the block/{get,put,rm,stat} API that serves blocks from the local $IPFS_PATH directory
Recommendation: Use the trio-quart ASGI web microframework for this. (Whatever you choose it will have to be compatible with trio as that is the AIO framework used in the stack.)
(Stretch goal) Implement a badgerds compatible backend for py-datastore
There is an issue requesting Python bindings for the Go library, but no work has been done yet: dgraph-io/badger#984
Beyond: Start integrating IPLD to expose the UnixFS files stored in those raw blocks…
Since #1 is clogged with all the many comments I open a new issue here. Feel free to continue the discussion below and I'll keep the following updated as things develop. Also feel free to create separate issues / repos to coordinate and I'll add the relevant links below.
Next steps (networking, stalled – please see the “storage” section below):
py-libp2plibrarypy-ipfs-bitswaplibrary: https://github.com/AliabbasMerchant/py-ipfs-bitswapipfs block *API for fetching blocks of nodes we are connected to – fetching blocks of non-connected nodes needs the DHT.ipfs daemon --disable-transport-encryption, but note that you will not be able to connect to any regular peers until one of the transport encryption methods is implementedmultistream-selectcode ofpy-libp2pto support actually dialing other nodes (MOSTLY FIXED UPSTREAM –lsis still missing and anmss-ncimplementation could still be useful)mss-nclike utility on top of this code to demonstrate that you are able to connect togo-ipfsnodes and negotiateTo do this you'll need to create an async stream based version of https://github.com/fmoo/python-varint/blob/master/varint.py
lsmode in which MSS will return a list of supported protocols, see https://github.com/multiformats/multistream-select/blob/master/README.md for the complete speclibp2ppy-multistream-selectlibrary and updatepy-libp2pto use it (Easy!, stalled – needs your help!)py-multistream-selectlibrary: https://github.com/dheatovwil/py-multistream-selectNext steps (storage, simpler):
(Suggestion: Use Python's
lib2to3and just drop Python 2 entirely.)Current port: https://github.com/dheatovwil/datastore(maybe https://pypi.org/project/aiofiles/ ?) for file accessThetrioframework is used for async I/O nowpy-ipfs“implementation” that can fetch blocks from the local$IPFS_PATHdirectory and expose them with an API similar to what https://github.com/ipfs/py-ipfs-http-client currently offers (goal here is to eventually have a drop-in replacement)block/{get,put,rm,stat}API that serves blocks from the local$IPFS_PATHdirectorytrio-quartASGI web microframework for this. (Whatever you choose it will have to be compatible with trio as that is the AIO framework used in the stack.)dgraph-io/badger#984