Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blockchain Engineering Class of 2020: Delft-DAO - Create your own currency #5143

Closed
synctext opened this issue Feb 19, 2020 · 31 comments
Closed
Assignees

Comments

@synctext
Copy link
Member

Delft-DAO

What is a DAO? Within the coming decade the future of jobs, employment and the nature of the firm will change profoundly. Automation, AI, and robots will replace many of today's jobs. A new type of company is a company without any employees, without any machines or physical infrastructure. A Decentralized Autonomous Organizations, DAO, only exists in software. It goes beyond smart contracts, it is a complete company inside software. DAO development is still in the experimental stage.

Within this course you can create your very own autonomous organisation, the Delft-DAO. Learn to engineer a decentralised autonomous organisation, use the existing tools, and understand the security risks. The aim is to alter the nature of the firm in the Internet age, see the Nobel prize winning theory. Production cost become essentially cost-free. An organisation which exists purely in cyberspace. The Delft-DAO is designed to be the first sustainable DAO. How can we empower leaderless organizations? How can it earn money from manipulating bits?

Advisor: J.A. Pouwelse, TUDelft blockchain lab founder (weekly meetings on Wednesdays)

Several teams from the class will create running code (requirements for a passing grade..) for one of the following functionalities. Four teams together create the building blocks of the complete Delft-DAO (time consuming integration step is outside our scope).

Create your own currency
First step of building a DAO is creating money. This enables the Delft-DAO micro-economy. Mark Zuckerberg is creating his own currency for a few billion users, called "Facebook Libra". For this assignment you will also create your own currency in 10 weeks, almost from scratch! Obviously security and usability is somewhat limited. You will investigate methods for minting and transfer of tokens. You will designate yourself as "trusted nodes", able to generate cash. Mandatory starting point for your code is this Kotlin app

  • create finite number of tokens by a central authority
  • encode in Trustchain
  • transfer of tokens between two Android phones
  • wallet support and offline transfer
  • usable in the future as DAO ownership token or voting pass
  • align your work with the DAO voting team
  • Bonus: your currency is usable as a DAO token
@synctext synctext added this to the Backlog milestone Feb 19, 2020
@synctext
Copy link
Member Author

@mvanmeerten @martijnbosma @dymbe @tijmen104
Welcome to the course!
Sprint proposal divided on team of 5 students :

@mvanmeerten
Copy link

:D

@rwblokzijl
Copy link
Member

rwblokzijl commented Feb 20, 2020

Related:

  • Vitalik, founder of Ethereum, has a talk about common pitfalls in decentralized governance, how to prevent oligarchies, and how to incentivise people from always voting for themselves. He had to solve this to make Proof of Stake work in Ethereum 2.0.
  • Kleros decentralised arbitration platform is a system that settles legal disputes through community voting.
  • Augur decentralised prediction markets is a system that implements a prediction market on the blockchain. Prediction markets are a tool to have financial markets vote (bet) on future events in order to (hopefully) predict outcomes.
  • Chainlink is a system that aims to get real world data (like stock prices, airplane cancelations, etc) onto the blockchain using a voting mechanism.

@synctext
Copy link
Member Author

synctext commented Mar 2, 2020

Lesson learned, not easy to solve; need 3 QR scans to transfer funds to strangers. Next sprint:

@tijmengit
Copy link

For creating QR-code transactions:

  • blocks into QR code?

  • validation check on transaction block

  • Create own app

@MattSkala
Copy link

For integrating work of all teams with the existing codebase, we have decided to take the super app approach. To separate IPv8 library from the app, we have moved demo-android app from kotlin-ipv8 to trustchain-superapp repository. Please create a module for your app and add a link to the dashboard according to the provided tutorial. When you feel ready (in the upcoming weeks), you can create a pull request with your contribution.

@dymbe
Copy link

dymbe commented Mar 9, 2020

@synctext
Copy link
Member Author

synctext commented Mar 9, 2020

  • go beyond QR codes, please help build DAO
  • minimal viable product for next sprint
    • wrap-up the QR task with the partial team
    • ignore conflict resolution, focus on DAO
    • fire and forget QR codes
    • bluetooth should "just work" in the Superapp
  • Repeating from above:
    • Goal: AI which understands, discover, and exploit pre-determined high and low prices on a random marketplace
    • integrate decentral marketplace
    • market at random timepoint switches to a random current price. Uniform between known Low and High price point.
    • sell and buy at the right time
    • there already exists a token to speculate with: the Trustchain, blocktype = Tribler_bandwidth
  • Final sprints (repeating from above)
    • AI that understands profit making
    • no need for decentral AI magic
    • actually, no need for AI or machine learning at all
    • a simplistic heuristic would do just fine
    • why machine learning, because we can!

@dymbe
Copy link

dymbe commented Mar 18, 2020

Our app is in the superapp. Can be found here: https://github.com/dymbe/trustchain-superapp/
Would you want us to do pull requests to the main repository @MattSkala?

@dymbe
Copy link

dymbe commented Mar 18, 2020

The app can now count how much you have of our currency, and a validator is added to make sure that the sender actually has enough money when sending. This check is disabled for offline transactions, because you need the senders entire chain to calculate how much currency it has. For the moment we have solved the minting problem by making every self-signed block print money. This is of course just a temporary solution to make development easier. Issue Verify transaction and Mint currency

@tijmengit
Copy link

Update:

  • App in super app

  • ML algorithm in java created. Right now we can pass a neural network a labeled dataset in .csv format for binary discrimination, and have the example neural networks for outlier detection as well, but the data needs to be in a specific format.
    Issue: Upon receiving price, decide to buy or sell.

  • "Market peer" created, a random extra ipv8 instance is used to simulate the market.
    Issue: Messaging market price to different peers

  • QR code fire and forget done, self signing block implemented

  • Count how much you have of our currency, and a validator is added to make sure that the sender actually has enough money when sending. This check is disabled for offline transactions, because you need the senders entire chain to calculate how much currency it has. For the moment we have solved the minting problem by making every self-signed block print money. This is of course just a temporary solution to make development easier.

@awrgold
Copy link

awrgold commented Mar 18, 2020

Pseudorandom dataset of 100k trades, with trade price and amounts is done.
Mean price: 0.64 (DymbeDollars)
Mean position size: 39 (position sizes are integers)
image
image

@synctext
Copy link
Member Author

synctext commented Mar 18, 2020

Sprint progress:

  • no communication with other teams
  • Joining mattermost to communicate with others of Delft-DAO
  • Solid progress with neural networks, etc.
  • DymbeDollars..
  • looked any AnyDEX
    • explored it
    • not created ask/bids yet
    • ToDo join live market community
  • neural network operational, anomaly detector, simple detect threshold for detecting buy/sell
  • wrap-up into minimal viable operational code; nothing fancy: detect threshold
  • partial bid/ask/trade implementation of AnyDEX in Kotlin (make your own; zero-security version, no cancel, etc.)
  • determine market price in live network (problem, no trade activity)
  • what trading pair do we focus on? (Bitcoin to Euro?)

@dymbe
Copy link

dymbe commented Mar 18, 2020

@synctext Just to be sure, you don't want us to use the currency we created, but rather Bitcoin and Euro? The last meetings we were told we should use our own currency when trading, and our project is called "Create Your own Currency" after all. This is all good of course but we though at least you should know that most of our efforts so far have gone towards creating our own currency, and we hope you can take this into account.

@synctext
Copy link
Member Author

synctext commented Mar 25, 2020

sprint progress:

  • somewhat stuck for a week basically
  • looked into Tribler code and got a bit overwhelmed
  • ignore that code in future

ToDo list:

  • Superapp infrastructure:
    • Creating Delft-DAO instances
    • Vote on distributed app
    • Get paid for distributed app
    • Install distributed app
    • AI Trade agent demo - distributed app
  • integrated AI technology (simple linear classifier)
  • observe the live market IPv8 community
  • however, there is no workload or traffic there!
  • create your own test bid/ask workload (Python or Kotlin)
  • no trustchain block creation, simple message broadcasting only to few dozen peers (will not scale, inefficient)
  • no special matchmaking agents, just match incoming ask with your own bid (or vise versa)
  • create bid/ask in the market community manually in GUI (helpful for testing)
  • display orderbook on the screen (build on Freedom of Computing team)
  • integrate transfer of cybercurrency QR-code one-shot operation
  • trading agent buy for this price, sell for this price
    • turn on/off on screen
    • give trade advise
    • turn on to do simplistic automatic trading
  • Testnet Bitcoins versus your own currency trading pair (e.g. Dymbedollars)

@awrgold
Copy link

awrgold commented Mar 31, 2020

image

Our classifier is now able to predict whether or not to execute a trade depending on the value of the bid/ask order. Prediction class 0 is "do nothing", class 1 is "buy", class 2 is "sell".

@tijmengit
Copy link

tijmengit commented Mar 31, 2020

Further update on the progress:

  • We have implemented functionality on the MarketCommunity that allows broadcasting bids and asks, also implemented is listener functionality for bid and asks. We used ipv8 messages for this.

  • Furthermore a GUI is created for sending bid and asks.

  • We are currently in contact with the other groups for integration. Our main focus is working together with the freedom of computing group to make our app as an example integration of their project. We are currently waiting on their answer on how to proceed on APK's they are using.

Todo's done:
-"however, there is no workload or traffic there!"
-"create your own test bid/ask workload (Python or Kotlin)"
-" no trustchain block creation, simple message broadcasting only to few dozen peers (will not scale, inefficient)"
-" create bid/ask in the market community manually in GUI (helpful for testing)"

@tijmengit
Copy link

Screenshot 2020-04-01 at 09 48 25

We can send and display bid and asks messages!

@devos50
Copy link
Contributor

devos50 commented Apr 1, 2020

Wow, that really cool progress guys! This is a critical step towards a decentralised market on a mobile phone 👍

Maybe you could improve the presentation a bit, and show asks on the left side, and bids on the right side, sorted on price (not sure if this is the focus of your project, just a suggestion)?

@synctext
Copy link
Member Author

synctext commented Apr 1, 2020

  • Try to integrate the stand-alone machine learning by Fri to Superapp with a PR
  • Nice progress
  • please be pro-active and allocate 1-2 team members for the deep integrating with live code injection team
    • beyond static injection and package name overwrite
    • webview for future sprints
  • please also fill a /docs/ directory with markdown with PR
    • generic token implementation
    • could integrate any double spending preventing method
  • please keep-it-simple, minimal viable PR and improve later

@synctext
Copy link
Member Author

synctext commented Apr 1, 2020

Future work, after this course (notes)

  • With this DAO anybody can create their own tokens without limits
  • It is possible to use an existing Euro bank account as collateral
    • use any IBAN account as escrow
    • Safety of the escrow Euros options:
      • You need to trust the token minter to be trustworthy and never fraud
      • Central bank offers guaranteed programmable Euro accounts (Central Bank Digital Currency)
      • Bank can provide a signed balance certificate (machine readable)
      • Trusted Third Party login to your bank account and checks balance (PSD2 regulation)
      • Bank offer Durable Power of Attorney to bank account or require two parties to agree for any transaction
  • With real Euros as collateral you can issue programmable Euro tokens
  • Solve guaranteed double spending detection problem using Trustchain and last transaction block witnesses

@tijmengit
Copy link

Trader
The AI is able to decide and execute trades upon receiving bids/asks broadcasted in the community.

@synctext
Copy link
Member Author

synctext commented Apr 4, 2020

solid! Can you hard link the .APK?
4 PRs are in pipeline, so there will be some re-basing for (late) teams.

@synctext
Copy link
Member Author

synctext commented Apr 8, 2020

Sprint progress:

@mvanmeerten
Copy link

@synctext You can try to install this apk. It works on @dymbe his device.

app-release.zip

@synctext
Copy link
Member Author

synctext commented Apr 8, 2020

works!
Please make an animated .GIF for the final documentation. Seeing the live trades come in, small GUI glitch when it starts to overflow from the screen. Better to put the latest accepted/rejected trade to the top of the screen I guess, users needs to scroll down for browsing old history. Keeps the screen interesting. Can you do a ℹ️ icon for additional info on the internal trading bot state? Simply some high-precision numbers that constantly change..
Please rename "trader" in the GUI to "AI trading bot".

@tijmengit
Copy link

tijmengit commented Apr 15, 2020

So to wrap up, in the past weeks we started by building an app to send money offline.
We were able to send entire proposal and agreement blocks by using QR codes, but verification was difficult. Therefore we discussed to use the QR codes in a fire -and-forget way, and implemented that. We proceeded by creating another app, to integrate a ML-trading algorithm inside the super app.

  • Designed, trained and implemented ML algorithm in Kotlin

  • Built an app to send money to other peers, either by scanning QR code for public key, or tapping their public key in community. Upon sending money, a proposal block is sent to the peer for signing.

  • Built an app to generate bid/ask messages for any currency. For this we built our own message type, but any type will do.

  • Built an app with an ML bot to execute trades upon receiving a bid/ask message. GUI shows which bid/asks are done and what the current balance of the bot is. Also possible to trade yourself. Upon executing a trade, a proposal block is sent to the peer.

Future recommendations:

  • Implement Market Community messaging protocol.
  • Bind Bitcoin and Bandwidth tokens
  • ML updates and distributes improvements to other peers

@tijmengit
Copy link

tijmengit commented Apr 15, 2020

@mvanmeerten
Copy link

app-release.zip

works!
Please make an animated .GIF for the final documentation. Seeing the live trades come in, small GUI glitch when it starts to overflow from the screen. Better to put the latest accepted/rejected trade to the top of the screen I guess, users needs to scroll down for browsing old history. Keeps the screen interesting. Can you do a icon for additional info on the internal trading bot state? Simply some high-precision numbers that constantly change..
Please rename "trader" in the GUI to "AI trading bot".

Most of the requested fixes are implemented, only the information icon is still missing

@synctext
Copy link
Member Author

synctext commented Apr 15, 2020

Sprint progress:

  • we now have achieved technological complexity!
  • small GUI improvement: "scanning network; please wait" when bid/ask screen is empty
  • Freedom-of-Computing integration is difficult; because it is not merely LoadDEXclasses; also whole GUI assets, XML, etc.
  • please think along with the freedom-of-computing team; how would your entire code fit in a Bittorrent swarm?
  • merge everything in the Superapp please
  • contribute to HN Show of the whole Delft-DAO
  • readme of Superapp needs to contain your contribution
  • single doc which contains screenshots and zero-server AI details with bid/ask matters
  • code coverage?

@synctext
Copy link
Member Author

synctext commented Apr 23, 2020

Final apk Github actions:
local version: app.zip

@synctext synctext closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

8 participants