Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions 1. Message Structure/Lesson.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@
"Now how should we deal with these magic bytes in the process of reading and interpreting real Bitcoin network messages? This one is pretty simple -- just check whether they're equal to the values in the wiki / reference implementation!\n",
"\n",
"![image](../images/magic-values.png)\n",
"##### Exercise 2: Check Network Magic"
"##### Exercise 2: Check Network Magic",
"\n",
"Try and fix the code below to get all the tests to pass:\n"
]
},
{
Expand All @@ -427,7 +429,7 @@
"NETWORK_MAGIC = b'\\xf9\\xbe\\xb4\\xd9'\n",
"\n",
"def read_magic(stream):\n",
" raise NotImplementedError()\n",
" raise ImplementMeToMakeItWork() # What does this line need to be replaced with? \n",
"\n",
"def is_mainnet_msg(stream):\n",
" magic = read_magic(stream)\n",
Expand Down Expand Up @@ -581,7 +583,7 @@
"outputs": [],
"source": [
"def read_length(stream):\n",
" raise NotImplementedError()"
" raise NotImplementedError() # Fix me!"
]
},
{
Expand Down Expand Up @@ -726,8 +728,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Where Bitcoin uses SHA256, it usually uses it twice. [Here's a discussion](https://bitcoin.stackexchange.com/questions/6037/why-are-hashes-in-the-bitcoin-protocol-typically-computed-twice-double-computed) of why Satoshi might have made this decision \n",
"\n",
"##### Exercise 8: Write a `compute_checksum` function which returns the first four bytes of \"double-sha256\""
]
},
Expand Down Expand Up @@ -782,7 +782,7 @@
"\n",
"print(\"Payload: \", payload)\n",
"\n",
"print(\"checksum == compute_checksum(payload)?: \", \n",
"print(\"Is the received checksum the same as the computed checksum?: \", \n",
" checksum == compute_checksum(payload))"
]
},
Expand Down