HS19
- Lecture dates: 18.09.2019 - 18.12.2019
- Exam: 21.01.2020, 12:50 - 14:50
Distributed Systems Advanced & Blockchain (DSA)
DSA Challenge Task HS 2019 Winner
The winning group is: Marco Keller and Martin Iten.
I was impressed by their simple yet efficient design. Their blockchain-based four-in-a-row met all the requirements and showed how a truly decentralized solution could be built. The players can bet their stake, while the platform provider gets its share as well. This game was implemented on Ethereum with web3.js and WebRTC.
The contents of the lecture are still being defined. Thus, topics below are just an indication. The PDFs and other files are accessible within the HSR network. If you want to access these files from home, use VPN. The lecture will take place Wednesdays from 08:10 - 09:50 in 1.201. The exercise will take place after the lecture in the same room.
Nr | Date | Preliminary Topics | Who | Files |
---|---|---|---|---|
01 | 18.09.2019 | Admin / Miniproject / Repetition VSS | Thomas Bocek | DSA-HS19-01-Admin_v2.pdf, DSA-HS19-01-VSS_v4.pdf |
02 | 25.09.2019 | Repetition VSS / P2P Basics | Thomas Bocek | DSA-HS19-02-VSS_v3.pdf |
03 | 02.10.2019 | WebRTC / TomP2P | Thomas Bocek | DSA-HS19-03-WebRTC_v2.pdf |
04 | 09.10.2019 | P2P with TomP2P | Thomas Bocek | DSA-HS19-04-TomP2P_v3.pdf |
05 | 16.10.2019 | Ethereum & Solidity | Thomas Bocek | DSA-HS19-05-Ethereum_v2.pdf |
06 | 23.10.2019 | Ethereum & Solidity / ICOs / NEO | Thomas Bocek | DSA-HS19-06-ETH-ICO-NEO_v3.pdf |
07 | 30.10.2019 | IOTA / PoS, and Bazo | Thomas Bocek | DSA-HS19-07-IOTA-Bazo_v2.pdf |
08 | 06.11.2019 | Classic Consenus, Efficient Broadcast, Protocols | Thomas Bocek | old DSA_Exam_2018-HS.pdf, DSA-HS19-08-Consensus_Protocol_v2.pdf |
09 | 13.11.2019 | Exam Preparation and Applied Cryptography | Thomas Bocek | DSA-HS19-09-ExamPrep_ECC_v2.pdf |
10 | 20.11.2019 | Bitcoin Advanced, Lightning | Christian Decker | DSA-HS19-10-Decker.pdf |
11 | 27.11.2019 | Monero | Sebastian Küng | DSA-HS19-11-Kueng.pdf |
12 | 04.12.2019 | Crypto Mining/Admin(challenge task, exam, feedback), NEO | Tolino Nello, Guilherme Sperb Machado | DSA-HS19-12-Tolino.pdf, DSA-HS19-12-Machado.pdf |
13 | 11.12.2019 | Challenge Task Presentations | Students | Time slot poll |
14 | 18.12.2019 | Fragestunde und Feedback | Thomas Bocek | DSA-HS19-14-Admin.pdf |
15 | 08.01.2020 | Beratungswoche | Thomas Bocek |
Quiz Questions
- Assume that 2 peers are behind different NATs and no firewall blocks any ports. Describe one reason why UPD hole-punching can fail.
- Ports are assigned randomly, no chance to know the port in advance
- The conntrack table entries have a TTL, if an entry expires, connections can fail
- TCP sequence number was guessed wrong, so the connection was aborted
- Which bucket should peer 0x101 check for id 0x010
- Bucket 3
- Which replication strategy for online availability is preferred
- Direct Replication
- Rsync works well with compressed data
- There are some issues with rsync and compressed data
- In a 51% Attack, you can modify other transactions
- No, this is not possible
- Merkle proof only needs to know the uncle hashes (log n)
- True
- What do you do if your smart contract breaks after a hard fork?
- Create new contract
- If you are using VPN, it could still leak your private IP with WebRTC
- True, ICE still collects that information and sends it / If you use Tor browser, this will not work, as it disables WebRTC
- Which statements are correct?
- STUN is used to identify the type of NAT
- TURN is a relay that forwards traffic
- ICE is a protocol to exchange IP addresses, which can be used/tested for connectivity
- UPNP and NAT-PMP automatically setup port-forwarding
- If you use WebRTC, you don't have to worry about all this (debatable)
- Which steps are required for a DHT operation, e.g., get?
- lookup/routing to find responsible nodes, then get
- What does bootstrap do?
- During bootstrap in a DHT, a new peer searches for its peer own ID
- What other routing mechanisms exists besides iterative routing?
- recursive
- If you «protect» an entry or domain. Can you prevent deletion?
- No, you can make the data disappear by placing malicious peers close to your content
- While WebRTC has the signaling server as a central element, TomP2P has…
- Bootstrapping peers as central elements
- How much lines of code is required to create your own cryptocurrency?
- 45
- A smart contract can listen to (emmited) events and trigger a smart contract execution
- False, a smart contract cannot trigger a smart contract function directly based on an event.
- Blockchain is not immutable: the Ethereum hardfork after The DAO showed that a transactions can be modified
- debatable
- There is no possibility to change functionality of a smart contract once its deployed
- False, if carefully planned, functionality can change
- Exchanging Bitcoin to Ethers only works with a centralized exchange
- False, you can exchange securely across chains
- Loosing crypto currency with atomic swaps with HTLC is not possible
- If the participant is offline, he could loose its funds
- IOTA can be easily run on IoT devices
- Not yet, low storage and slow CPU is a problem
- Why is a consensus algorithm important?
- Prevent Double-Spending / Achieve Unified Agreement
- Der Bitcoin Header ist 32 bit gross. Der Antminer S9 rechnet 14TH/s. Wie lange braucht der Antminer, um alle Zahlen durchzuprobieren?
- 0.0003s
- What is the "nothing at stake" problem?
- In PoS, you can validate blocks on any fork
- Paxos ist eine Gruppe von Protokollen mit dem Ziel, einen Konsensus in einem Netzwerk von unzuverlässigen Entitäten zu erzielen.
- True
- Raft ist ebenfalls ein Konsensus Algorithmus und kann als Alternative zu Paxos verwendet werden.
- True
- What is the latency on a ping (RTT) with a sattelite conneciton:
- ~600ms
- Wieso fallen in der Regel Transaktionsgebühren für Transaktionen in einer Blockchain an?
- Reward for miners, no spam transactions
- Was passiert bei einer 51% Attacke? Erklären Sie das Problem mit einem Käufer und Verkäufer, der Waren mit einer Kryptowährung kauft.
- Buyer can buy, pay with crypto, and revert tx, so he still has the cryptos
- Wozu wird eine Bootstrap Peer/Node verwendet?
- To participate in the network
- Was für Probleme sehen sie, wenn sie eine DHT in ihrer Applikation implementieren und es auf einem mobilen Gerät laufen lassen?
- New IP, battery usage
- Was macht Acceptor Z zum Zeitpunkt, welcher mit “?” markiert ist?
- nothing
- Welche Wörter soll der Benutzer aufschreiben, wenn der Seed 0x1a09 ist?
- Kiwi/Pineapple/Apple/Pear
- Um sicher zu gehen, dass alle Zahlen stimmen, wird eine Checksum hinzugefügt. Die Checksum addiert alle 4-bit Zahlen mit einem einfachen Overflow (Modulo 16). Der Overflow dient dazu, dass die Checksum nie grösser als 15 wird. Welches Wort wird als Checksumme verwendet?
- Cherry
- Alice besitzt die Schlüssel zu den folgenden Adressen F und H. Bob besitzt den Schlüssel zur Adresse M. Erstellen Sie eine Transaktion in welcher Alice 6 Coins an Bob schickt.
- a) Input: 4,1 / 8,0, Output M, Value 6
- b) Input: 7,1 / 9,0, Output X, Value 15
- c) Input: 10,0, Output N/X, Value 1/14
- d) E.g, a exchange address that sends TX in batches
Challenge Task HS 2019
This semester's challenge task (CT) is the design and implementation of a fully-distributed, P2P gambling game.
The system consists of two parts:
- Board games, this could be for example tic-tac-toe, four-in-a-row, poker, UNO. The board game has to be implemented with a waiting room and a chat. For groups with 3 members, random number have to be implemented as well. This could be used for example for shuffling cards.
- Gambling, this could be for example before the start, all the players pay in pot and the winner gets all.
Requirements
All requirements below must be met in order to pass the challenge task.
- Full decentralization and P2P for the board game (e.g., WebRTC, TomP2P, libp2p)
- Waiting room with chat (groups with 3 members need to implement random numbers)
- Fully decentralized and P2P mechanisms for gambling (e.g., Bitcoin/Ethereum)
Further requirements are:
- The solution may use existing libraries and code, but those must be allowed to be published under an open software license.
- The final presentation shall outline the application and architecture.
If one requirement is missing, you cannot write the exam.
Libraries and Tools
The items below represent supporting libraries, tools, or references that are recommended to be taken into consideration.
- You are allowed to use any language or framework. However, the supervisors are familiar with those: Java, Golang, and JavaScript.
- We recommend to use WebRTC or TomP2P. The golang version of TomP2P is currently work in progress. TomP2P is an open-source implementation of the Kademlia DHT. More information can be found at http://tomp2p.net/ with a quick introduction to the TomP2P library.
- Ethereum is the most popular public blockchain for smart contracts. You can also use a Testnet such as Ropsten or Rinkeby.
- Use Remix as Web IDE to develop your smart contract with Solidity.
Organization
- The groups shall be equally balanced, each containing 2 team members.
- During the challenge task, the group shall meet every week during exercise hours to work on the task and discuss the next steps.
- The groups shall utilize their homework times to work on the CT, besides the exercise time slots assigned on Wednesday.
- You do not have be physically present at the exercises. The supervisors will be available in room 1.169 and can relocate to the exercise room if required.
- The groups shall determine and set-up an internal project plan with the overall milestones timings provided here.
- Distribute the workload so that each group member gets a fair load of work (P2P load balancing, no free riding!) and make sure activities can run in parallel (non-blocking).
- Do not miss the opportunity of discussing details with your supervisor, he might give you good hints.
Milestones
There will be one milestone during the CT. The milestone shall include a fully distributed P2P system, preferably including basic functionality.
Please send your source code to your supervisors until November 6th 23:59. Make sure that your submission includes setup instructions. If the supervisors are not able to run your application using the instructions given, you will be given a second chance to submit your source code a week later in order to still pass the attestation. If you fail the second chance, you won't be able to attend the examination.
Presentation and Evaluation
Challenge task presentations and demonstrations will take place on December 11th. On these dates, the groups will present and demonstrate their results, which will be evaluated by a jury. Presentations and demos on dates will start at 08:10 in 1.201.
- Each group will have exactly 15 minutes for presenting their design and to demonstrate the working application (roughly 10 min presenting and 5 min demo). You will be interrupted by us if you exceed the 15 minutes presentation time. The presentation shall include slides. For the demonstration, you must run at least three instances (peers) on two different machines. You can use your own laptops or machines from the HSR. Most of the demonstration, though, will be done using the machine connected to the projector(s), so more people can see what is going on. Ideally, it is the same machine that will run the slide presentation.
- Make sure that everything will work for your demo! Test everything beforehand with given conditions, especially the network. If a group fails to present within its time window, it will be disqualified.
- Remember that the audience will not only be interested in seeing whether or not your application works, but more specifically how the designed mechanisms work behind the scenes. So it must be visible what these instances are doing.
- After the demonstration, each group will be evaluated by the jury. The following criteria will be taken into consideration: software design and implementation (fulfillment of requirements, overall design, trade-offs considered, scalability, usability, reliability), team work, presentation and demonstration of the solution. The results of the votes will be collected and disclosed after the last presentation.
- The winning group will have to present the application to their fellow students in the last lecture on December 18th. Furthermore, they will receive a prize (in Ether or Bitcoin) and the "HSR P2P Challenge Champion 2019" award.
Note: The participation of the CT is mandatory for the permission to attend the exam. There will be no grade and you can only pass or fail the CT. However, keep in mind that participation will greatly reduce the effort you have to spend studying for the exam.
Groups
There will be groups of 2, in case of an uneven number, groups of 3 are allowed. The group with 3 members have the additional requirement to include a random number for its game (e.g., shuffling cards).
Nr | Names | Status | CT |
---|---|---|---|
01 | Christoph S. / Michael S. / Martin M. | (handed-in) | |
02 | Yannick H. / Lukas C. / Rudolf R. | (handed-in) | passed dsa-yannick-lukas-rudolf.pptx, dsa-yannick-lukas-rudolf.zip |
03 | David Z. / Martin S. | (handed-in) | passed dsa-david-martin.pptx, dsa-david-martin.zip |
04 | Dario C. / Andreas F. | (handed-in) | passed dsa-andreas-dario.pptx, dsa-andreas-dario.zip |
05 | Marco K. / Martin I. | (handed-in) | passed dsa-martin-marco.pdf, dsa-martin-marco.zip |
06 | Linus B. / Fabrizio L. | (handed-in) | passed dsa-fabrizio-linus.pdf, dsa-fabrizio-linus.zip |
07 | Cedric W. | (handed-in) |