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 (Team II) #5144

Closed
synctext opened this issue Feb 19, 2020 · 28 comments

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

Team II

@synctext synctext added this to the Backlog milestone Feb 19, 2020
@synctext
Copy link
Member Author

synctext commented Feb 19, 2020

@InvictusRMC @brian2509 @MKuijpers @PJvanderLaan
Welcome to the course!
Sprint proposal divided on team of 4 students :

Future sprint ideas:

  • send actual Bitcoins to an address book entry (ignore MITM for now)
  • do something with MITM attack prevention, like certified friend using physical proximity and QR scan?
  • manage the "super_app" challenge (secure communication, media, money, market and passports)

@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.

@MKuijpers
Copy link

We would like to tell what we have done last week and what questions we have for the current meeting.

Done this week:

  • Research into the relevant literature from this issue
  • Delve into the Kotlin app project
  • Add a page in the app in order to get used to the app development. We added a simple page to add blocks with custom information to the trustchain. These messages are customizable from an interface in the app

Questions:

  • What are the concrete deliverables of the project?
  • What part does Bitcoin play in this project?

@PJvanderLaan
Copy link

PJvanderLaan commented Mar 2, 2020

This week's APK file

demo-android-debug.apk.zip

@synctext
Copy link
Member Author

synctext commented Mar 2, 2020

Next sprint comments:

  • no unit tests yet
  • start putting pointers to related work in README.md documentation
    • keep track of security issues in this README, like MITM
  • use real testnet Bitcoins please
    • transfer of tokens between two Android phones
    • generic coin handling
    • wallet support and offline transfer (QR code)
  • operational MultiSig wallet
  • send money to MultiSig wallet

@PJvanderLaan
Copy link

Initial design idea for the next sprint (not very specific):

Onboarding

  • Any individual user can start a shared bitcoin wallet ('genesis' user)
  • Any user can join the shared wallet
    • Start with a transaction to the shared wallet (bitcoins). Larger bitcoin contribution equals a larger voting right
    • Transaction valid: voting process starts by the users in the shared wallet
      • @DAO_Voting_group
    • If voting succeeded, the user is added to the shared wallet
      • New bitcoin wallet (multi-signature) is created
      • Each user of the shared wallet should receive a 'part' of the private key
    • Broadcast in trustchain: public key of new shared wallet, hash of the previous known block of the old shared wallet

Transaction

  • Any user can start a proposal for a transaction
  • Broadcast a proposal with the public key of the shared wallet and the private key part (encrypted or something)
  • Anyone that is part of the shared wallet (same public key) votes -> voting process
  • If voting succeeded, the transaction starts, using the private key parts

Known issues that are ignored (for now)

  • Any rich user can take control of the shared wallet
  • We need to decide how much voting power a user receives after contributing bitcoins to the shared wallet
  • Possibility to make the shared transactions private (for everyone not part of the shared wallet)

@synctext
Copy link
Member Author

synctext commented Mar 2, 2020

good stuff!
btw Please simplify as much as possible. Like, 'genesis' user determines the DAO-capital-fee, the fixed amount of Bitcoin that represents a single fixed vote. Be inspired by others (e.g. rip existing code): https://github.com/anders94/bitcoin-2-of-3-multisig

@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.

@InvictusRMC
Copy link
Member

InvictusRMC commented Mar 11, 2020

Progress update:

  • UI
    • Added ability to use subviews:
    • Create a shared wallet screen
    • Search a shared wallet screen
  • BitcoinJ
    • BitcoinJ proved to be a cumbersome process: downloading test-chain on Android took ~60 minutes.
    • Started code for creation of multi-sig wallet and transactions
    • Testnet balance seems to be incorrect
    • Normal bitcoin blockchain downloads in ~10 minutes. (Satisfactory?)
  • Onboarding process
    • Code is implemented per proposed design, however not fully tested due to BitcoinJ issues.
      1. Find most recent SW_JOIN in TrustChain
      2. Pay entrance fee
      3. Make new shared wallet with users and own BTC pk
      4. Create SW_JOIN on Trustchain
      5. Wait for M-out-of-N VOTING_AGREEMENT
      6. Transfer funds to a new wallet on Bitcoin Blockchain

APK:

demo-android-debug.apk.zip

Screenshot:

@synctext
Copy link
Member Author

synctext commented Mar 11, 2020

Sprint feedback:

  • 40% of the course is now integration with the other teams, see here
  • Nice progress post, very helpful
  • testnet SPV versus production network? 10 minutes on real phone, mainnet
  • please experiment on mainnet with <100 Euro of Bitcoins (refund available if you have receipts)
  • cast your votes in coming X Bitcoin blocks
  • please make thing (embarrassingly) simple in order to get a final operational Delft-DAO
    • no offline support
    • everybody actually votes
    • we assume last minute vote changes don't
    • not allowed to abstain
    • simplify: no vote is a vote against (so needing to meet the quorum)
    • transferred funds into DAO, but not voted in to join 😠
      • permissionless DAO, permissioned, membership
      • indiscriminately: pay-to-play
  • team magical idea:
    • enrollment: new person
    • everybody checks out if existing Delft-DAO members and stake in new shared wallet
    • re-think about locking out attack, a few member of existing Delft-DAO could be sabotaged
    • coordinate through Trustchain
    • magic for integrity: all member have access to each member public key and new user public key
      • they can create a multisig wallet
      • thus guaranteed access if they know about the new wallet
      • magic reliable trustchain broadcast that a new member donated new money to the Delft-DAO?

@InvictusRMC
Copy link
Member

We're running into a minor issue:

image

Bitcoin's transaction fees are quite high, meaning that we can perform "merely" up to 150 transactions before we run out of funds. Something to keep in mind.

@synctext
Copy link
Member Author

No problem, TUDelft has .73 dollar to spend on science 😄

@synctext
Copy link
Member Author

synctext commented Mar 12, 2020

Actually, the latest info I got is that your script is likely to be huge and cost at least $10 per transaction.. Industry expert: you probably need a week to compress it, once you have it working.

@PJvanderLaan
Copy link

PJvanderLaan commented Mar 18, 2020

Progress update

UI/Trustchain:

  • Connected the UI with the (new) Trustchain code
    • Create, join and view your shared wallets
    • All of these functions work using the trustchain only. Bitcoin blockchain is not connected (yet)
  • Loading screen for (bitcoin) blockchain download, can be skipped for now
  • Added (semi-mockup) Trustchain proposal screen for shared wallets (Your Shared Wallet > Click on 1)
  • Bought <100 EU in bitcoin and spread it over 3 wallets for testing

Bitcoin:

  • Fetch transactions to check whether entrance fee is paid
    • Use blockchain API and check for inputs, outputs and BTC amount
  • Multichain wallet creation possible with custom public keys/thresh-hold/initial fee
    • Possible in a (simple) UI for now
    • All the relevant data (transactions, public keys, signatures) made serializable for use in Trustchain blocks (message field)
  • Ability (in code) to sign transactions.
  • Ability (in code) to send a transaction from a multi-signature wallet (given enough signatures).

APK

(still not integrated in the superapp)
demo-android-debug.apk.zip

Screenshots

@synctext
Copy link
Member Author

synctext commented Mar 18, 2020

Sprint progress:

  • Delft-DAO team integration: use the mattermost channel given please; and self-organise
  • great screenshots!
  • not talked to 2 other groups yet
  • code coverage is not too good right now 😢
  • Solid MultiSig progress 👍
  • horrible to work with BitcoinJ lib (undocumented behavior; trying to nanny you, outdated docs)
  • still using standard Bitcoin scripts: https://davidederosa.com/basic-blockchain-programming/standard-scripts/
  • the current design only needs shared wallet in Bitcoin with shared ownership. No need (hopefully..!) for anything else on the Bitcoin script side. Can all be arranged with Android and Trustchain coding.
  • Public keys with ownership can be derived from the wallet address and Bitcoin transactions, all public. Threshold information is also public.
  • please do some radical tests with 1000 public keys and calculate for 1 million upto 2 billion users (e.g. Facebook alternative as a DAO). Can it scale (cheaper)?

@PJvanderLaan
Copy link

Done this week (2020-03-18 - 2020-03-25)

  • Finalize back-end methods of multisig transactions
    • Sending from a multi-sig wallet
    • Changed onboarding process
  • Connecting bitcoin, trustchain and UI code
    • Hard to test, since we need multiple devices
    • Connection took (a lot!!) longer than expected
    • Code is finished, but there are still some bugs
    • Cleanup of code, refactors, bugfixes
    • We were missing the trustchain code for transfering funds from an existing shared wallet on both the bitcoin and trustchain blockchain. We added the functions for this
  • Add ability to import custom keys to wallet for User
  • Improve navigation (UI stuff)
  • Improve UX (UI stuff)

Example multisig transaction:

(With an entrance fee of 10.000 satoshi)

Create wallet as the first person. zHeLWRUv1jJn6ciWYMjJrPxv6Gg96US6Fz is the shared wallet address. Transaction

Add the first person. zHeLWRUv1jJn6ciWYMjJrPxv6Gg96US6Fz now has 20.000 satoshi inside it. Transaction

Make payment to another address. Pay 1000 to mo4nNbGVfJGozjtD9ViXvcgW1fjq9stdzd from the shared wallet. Transaction

@synctext
Copy link
Member Author

synctext commented Mar 25, 2020

Sprint progress:

  • Anybody can start their own DAO with their rules
  • Anybody is free to join any DAO and participate within each democratic decision
  • DAO members determine the direction of their community by voting on Kotlin code
  • Nobody own any DAO, even the original founder is not special
    • you have no special privileges
    • you only set the initial parameter (entrance fee and voting quorum size)
  • Discovery mechanism for Delft-DAO instances
    • join live Trustchain plus Delft-DAO community
    • use block_type to identify transactions from Delft-DAO participants
    • send crawl_request for blocks in Delft-DAO community
    • scan, store and parse random incoming Trustchain blocks
    • Parse all Delft-DAO genesis blocks
    • Parse shared wallet information (duplicated in each block)
    • Remove the duplication of all public keys of all members
    • Show discovered Delft-DAO instances in GUI
    • Show discovered Delft-DAO instances in Superapp
  • Discovery mechanism for new vote
    • send to all member of Delft-DAO instance
    • stored all Trustchain public key
    • assume they are online
    • send a proposal block to each member individually (ToDo scale to millions, gossip)
  • malicious voting attack
    • everything needs to be check by everybody
    • describe the replace member attack (evil person joins, rigs the voting and excludes 1 specific existing member)
    • do not sign the MutiSig transaction for a new member if not all things are in order
  • Trustchain integration: serialised Bitcoin Multisig
  • Real Bitcoin are almost untouched (minor Tx costs)
  • integration started with democracy group, finalise in Week 4.8
  • what can demo inside a "BTC hello world" distributed app
    • When a distributed app is approved by voting, the developer is paid
    • By voting on a Kotlin app you also approve the payout of Bitcoin to developer
    • (optional) Not a one-shot primitive. Reserve bounty for Delft-DAO development in actual BTC into a isolated wallet.

@InvictusRMC
Copy link
Member

InvictusRMC commented Apr 1, 2020

Progress last week (25-03-2020 - 01-04-2020)

Super app fork:

https://github.com/InvictusRMC/trustchain-superapp/

Documentation

MKuijpers/kotlin-ipv8#22

Progress

  • Test trustchain interactions from CoinCommunity
    • Fix related bugs
  • Discuss integration with voting group
  • Block discovery on trustchain
  • Shared wallet discovery through block discovery on trustchain
  • Ability to import seed and changes to UI
  • Started integration with super app (not succesful yet)
    • However commit history is preserved

@synctext
Copy link
Member Author

synctext commented Apr 1, 2020

  • initial code somewhat running
  • Integrate with Superapp by Friday using PR
  • Bundle documentation, all teams fill with /docs/ dir with .md files
  • currently dealing with bug hunting; integrating the Trustchain/GUI part with the Bitcoin MultiSig engine
    • Screenshot of code coverage in .MD documentation
  • overlap with voting group! Two voting implementations
    • multisig unsigned transaction is actually a voting mechanism
    • voting team created a voting mechanism without any coins
    • this turned up after the first detailed discussions in week 8
    • one voting is integrated deeply inside MultiSig wallet matters
    • the other is a general voting function,. Ability to use generic VoteHandling functions.
      • 0 start a vote on Trustchain, Bitcoin or another system
      • 1 sign your vote
      • 2 Verify voting on Trustchain, Bitcoin by others, is a quorum reached?

@PJvanderLaan
Copy link

This week's progress:

  • Fixed the issues related to trustchain/bitcoin shared wallet connection
    • Creating a shared wallet with initial fee (tested with real fake bitcoins)
    • Transfering funds from an existing shared wallet
  • Integrated our app in the superapp (took longer than expected!)
    • Fixed all related issues, ie. linting and merge conflicts
  • UI improvements (mostly navigation control)
  • Other small bug fixes and small improvements

@MKuijpers
Copy link

MKuijpers commented Apr 8, 2020

This weeks apk: app-debug.zip

Note: there are some navgraph conflicts causing some navigation to not be behaving as planned

@synctext
Copy link
Member Author

synctext commented Apr 8, 2020

Sprint progress:

  • API to the Blockchain Engineering Class of 2020: Delft-DAO - Freedom of Computing #5146 group proposal
    • reward for coding effort "code bounty"
    • Start a global vote on a magnet link + payout BroadcastProposalForVote(Magnet Link, payout in mBTC, payout wallet address)
    • BroadcastProposalForVote is only executed by bounty hunter and needs to seed .APK in Libtorrent
    • Voting happens by signing an multisig Bitcoin transaction from the shared wallet into the developers own pocket!
    • each user that is online: IncomingVote(), VotePositiveOnProposal()
  • .APK to test 👍
  • almost does not crash inside Superapp 👏
  • GUI for "shared wallet discovery through block discovery on trustchain"
  • push your created shared wallet every hour
  • Fill your Delft-DAO wallet by sending money to your wallet address: "..."

@synctext
Copy link
Member Author

synctext commented Apr 15, 2020

Sprint progress:

  • API responsible with Freedom-of-Computing, please contact @InvictusRMC
  • still not stable, 75% of issues estimated to be fixed
  • Discovery: please inform users "scanning The Internets for a few minutes..."

@PJvanderLaan
Copy link

PJvanderLaan commented Apr 15, 2020

This week's progress

  • UI:
    • Fixed navigation issues
    • Worked on redesigning UI
  • Switched from testnet to bitcoin
    • Fixed related bugs
  • Increased test coverage by a lot!
  • Fixed join wallet trustchain issues
  • Lots of small bug fixes and improvements

app-debug.apk.zip

@InvictusRMC
Copy link
Member

Progress

  • Proposal screen where join and transfer proposals are shown with ability to vote on them
  • Fixed bugs related to transfer, join and create DAO
  • Structured the code in a better way, cleanup
  • GUI stuff (improvements)
    • Consistency across screens (BTC/Satoshi)
    • Fix crashes and better user feedback on failures
    • Add validity checks for fields and actions to protect the user
  • Some of the broadcasted trustchain blocks do not fit in the UDP packet -> silent failure.
    • Possible solution:
      • Split up blocks and have a single block to store information about all blocks
      • Send multiple blocks, which has data split up

app-debug.zip

@synctext
Copy link
Member Author

synctext commented Apr 23, 2020

near final sprint comments:

  • great GUI
    • "DAO logout", can that be a setting screen with "cog wheel".
    • please rename "Currency II" into "Bitcoin DAO" or something more hipster-like.
    • "import or Create new Account", replace with something like "Bitcoin wallet management".
    • "Load Existing", "if you previsouly created/imported and want to enter again, use this option". Replace with main DAO screen.
    • 6-clicks of hidden DAO discovery becomes the main screen. Everything is 1 click away. There is only 1 exit button.
    • liveliness for new users, shows something instantly
    • chain downloading in background with possible pauze button.
    • create new DAO,
    • proposal are only available inside the DAO menu (selected a specific DAO)
    • Wallet balance shown always on top, click for settings
    • "Home" becomes "DAO home".
  • critical bug. UDP packet overflow? Showstopper: Trustchain blocks are large. @qstokkink @devos50 any ideas here?
    • Silent fail of Trustchain block synchronisation
    • Confusion is added because it is added successfully to your local trustchain
    • Block contains: full serialised Bitcoin multisig transactions
    • BitcoinJ has difficulty to handle alternatives to raw storage.
    • also all Trustchain keys of DAO members are stored

@brian2509
Copy link

The main final documentation file in our folder README.md has been created with details about the protocol, structure, and issues. As well as an additional section in the main README.md.

@InvictusRMC
Copy link
Member

Final Release

app-debug.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

7 participants