Open terichadbourne opened 4 years ago
Instead of going with a code challenge tutorial, we can first create an introductory tutorial as multiple choice quizzes from some talks we've given in the past:
1. "The Life of a libp2p Connection" by Jacob
I'll use the first talks from Jacob as a base and then I'll incorporate some pieces from the other ones.
Yesterday we published our first libp2p tutorial, a multiple-choice, code-free introduction to libp2p. Huge thanks to @zebateira for taking the lead on it!
@zebateira is actively working on the in-memory transport and additional under-the-hood needs for libp2p code validation that will allow us to build coding challenges in the future in which multiple nodes can interact. Please see issue #229 for continued updates on that effort.
Moving forward, we'll use this issue as the place to reflect the status of our first code-based libp2p tutorial, to be built by @yusefnapora. He'll be adding an outline here for our joint review and then will start building the lesson content of the tutorial as @zebateira wraps up the in-memory transport. Once the transport is ready, @yusefnapora will be able to build the code challenges, for which we already have a few ideas bouncing around in #229.
Super excited about the progress we're making on this!
Here's what I have so far for the tutorial outline. @terichadbourne & @zebateira please let me know what you think. There are still a lot of details to work out, of course.
Coding challenge:
function getPeerId(libp2pNode) {
const peerId = // fill in the blank!
return peerId;
}
dial
and dialProtocol
dial
for now, next lesson covers dialProtocol
Coding challenge
function dialPeer(libp2pNode, peerId) {
// dial the peer at peerId
// e.g.: const conn = await libp2pNode.dial(peerId)
}
dial
method used in the last lesson gives you a connection that can carry many streams.
conn.newStream
on the connection object from previous lessionlibp2p.dialProtocol
to avoid the connection object entirelydialProtocol
to connect to a peer using the protocol ID for our example protocolCoding challenge
function dialPeerProtocol(libp2pNode, peerId) {
const protocolId = "/protoschool/example-proto"
// e.g.: const { stream, protocol } = libp2pNode.dialProtocol(peerId, protocolId)
}
Coding challenge:
attach a protocol handler to the libp2p node that sends a message to peers when they connect
question: should we send plain text (newline delimited?), JSON objects, etc?
TODO: flesh out details & add coding challenge
Show the user how to create their own libp2p node by walking them through the configuration
This lesson is at the end because much of the configuration is confusing unless you know what it's for
Walk through each of the most common configuration options
Explain how some options will be different in a production context
Coding challenge:
@yusefnapora Thanks so much for the outline. Looking great!
I'll leave it to @zebateira to comment on the content itself, but just jumping in to say that in some cases I suspect you have too much content per lesson. The thought process I'd encourage here is: "What's the one thing I'm teaching and then testing in this lesson?"
For your current lesson 1, for example, I suspect that these bullets could be pulled out into 1 or 2 prior lessons to teach about the libp2p node (perhaps with a multiple choice quiz) separate from the peer IDs:
Introduce the tutorial and describe what we'll acomplish / set expectations
Introduce the libp2p Node object
Not focused on configuration yet, this is about describing what it's capable of
I don't have enough technical context to judge if there are other spots here where you could split a lesson into two, but would encourage you to consider it where it works.
Also I saw one spot where it looked like you were considering putting a quiz and a coding challenge in the same lesson. You can only do one format per lesson, so breaking the content apart into the chunks you want to test with each method would be required here.
That's great feedback, thanks @terichadbourne. Lesson one could easily be split into two, and there are probably a few other places that are overloaded and could be split up. I'll work on that today and try to add more details to the bits that are still fuzzy.
Love the outline so far! Really great simple initial concepts walk-through from the start. I was a little skeptical about the idea of leaving the configuration to the end, but I think I really like the outline as it progresses, good job!
I think Teri is right that this outline pushes a lot of content into each lesson.
Here is the initial tutorial structure for the content you presented better suited for our usual lesson length:
Hope this makes sense, so you can restructure it from here.
Thank you! 🙏
That sounds great @zebateira - maybe it's best to save the "how to build a protocol" stuff for a separate follow-up tutorial.
That will let us dig in a little deeper and make a (slightly) more involved example. I was thinking maybe a knock-knock joke protocol, since it has a nice "call and response" structure like a real protocol 😄
maybe it's best to save the "how to build a protocol" stuff for a separate follow-up tutorial.
@yusefnapora I think that makes sense as well 👍
That will let us dig in a little deeper and make a (slightly) more involved example. I was thinking maybe a knock-knock joke protocol, since it has a nice "call and response" structure like a real protocol 😄
Good idea! Adding fun to the tutes works really well 💃
For upcoming meetups, I would really love to see lessons on DHTs, Content Routing and discovery algos in use and relative uses cases, ie pub/sub, gossipsub, graph-sync. These topics seem to bring the earlier concepts full circle.
Once we enable libp2p validation under the hood, we hope to create our first libp2p tutorial.
Some discussion about content has already happened within the libp2p validation issue and on related calls, but this issue can be used as a place to clarify the proposed outline and track progress when we start drafting content.