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

Bounty payout voting and payment execution - self-evolving AI-DAO #5986

Closed
synctext opened this issue Feb 10, 2021 · 31 comments
Closed

Bounty payout voting and payment execution - self-evolving AI-DAO #5986

synctext opened this issue Feb 10, 2021 · 31 comments

Comments

@synctext
Copy link
Member

synctext commented Feb 10, 2021

Master course on Blockchain Engineering project 2021

TEAM P3: Bounty payout voting and payment execution
Your team ensures people get paid for evolution of features. Use muti-sig wallet and quorum-based voting to create real-world Bitcoin payouts. Sync the vote progress with others, visualise as votes come in (approve or reject) and display the undecided votes. Any developer can contribute code to the DAO and get paid. It disconnects the DAO from any bank, government, and legal system. Help create a global economy that is hyper-efficient, fair, honest, and digital. prior work

General Description - self-evolving AI-DAO (#5944)

Student from Delft have created a blockchain-based alternative to Spotify. Completely decentralised. Uses Bittorrent for streaming, Bitcoin for payments to artists, Trustchain with IPv8 for music discovery and IPv8 for app-to-app connectivity. With multiple teams the aim is to take this code to the next level: self-evolution.

A total of 4 students teams (4-5 students in each team) will work together on a cutting-edge scientific problem: how to create a software system which can be expanded in real-time and increasingly become more 'intelligent'. Build upon the existing open source app by TUDelft on the Android Play store using blockchain technology: the Superapp. You will help transform essential parts of the music industry and replace them with open source software. Current code:

GIF: Browsing and streaming music with Bittorrent
GIF: Sending money to artists using Bitcoin

DAO - organisations in software

To make a "self-evolving" app we use the DAO concept. What is a DAO? Within the coming decades 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. Background reading. Very optimistic view on DAO, official US review of DAO by Securities and Exchange Commission.

Within this master course you can create your very own autonomous organisation, the AI-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 AI-DAO is designed to be the first sustainable DAO. How can we empower leaderless organizations? How can it earn money from manipulating bits?

Scientific challenge: Self-evolving

A key step in an autonomous system is that it can evolve independently. This enables growth and evolution independently of any central organisation, sponsoring government, or tribe of volunteers.

You will collectively solve the problem of paying somebody to make new features in open systems which are fully decentralised. This goes further then paying somebody Bitcoins to create a new version. Decentralised technology is very robust to failures, manipulation, faults, and courtcases. For instance, The Internet itself is almost impossible to shutdown so is the "Tor darknet". With other teams you will address a key drawback of decentralised technology: difficult to update, nearly impossible to evolve, and lacks incentives to develop new features.

dApp ecosystem

"Distributed Applications" are a distributed way of running code. You will help develop an ecosystem of "global code". Code is running atop a blockchain and peer-to-peer (P2P) network that acts as a kind of operating system. This provides security, resilience, privacy, and novel features. This is related to smart contracts, but has no slow single virtual machine (all discussed in the online classes material). Background material, read FBASE trustworthy code execution

PNG: difference between cloud and decentralised Apps
@synctext
Copy link
Member Author

synctext commented Feb 16, 2021

@Tribler Tribler deleted a comment from StefanWeegink Feb 16, 2021
@Tribler Tribler deleted a comment from CallumH2410 Feb 16, 2021
@Tribler Tribler deleted a comment from RFHuisman Feb 16, 2021
@Tribler Tribler deleted a comment from wubero Feb 16, 2021
@Tribler Tribler deleted a comment from StevenL98 Feb 16, 2021
@StevenL98
Copy link

StevenL98 commented Feb 18, 2021

You have to clone the repository as follows: git clone --recurse-submodules <repo-url>
If the cloning of the submodule of kotlin-ipv8 fails, click the repository link and clone it separately within the project that is successfully cloned.
The folder should look as follows:

trustchain-superapp
│   README.md
│   file001    
│
└───kotlin-ipv8
│   │   file011
│   │   file012
│   
└───folder2
    │   file021
    │   file022

@StevenL98
Copy link

StevenL98 commented Feb 24, 2021

sync_gif
)
Showing the sync button and the votes below each music album

@synctext
Copy link
Member Author

synctext commented Feb 24, 2021

Progress in Week 3.3 of this 10 week course:

@StevenL98
Copy link

StevenL98 commented Feb 24, 2021

@synctext
Copy link
Member Author

synctext commented Feb 25, 2021

Impressive GUI!!
Each bounty payout could be in simple MusicDAO style, like: "Pay 50mBTC from our common funds to artist named "L$D"?
please dive into: bitcoin/bitcoin#21278 (comment)
Background reading, published yesterday: https://bitcoinmagazine.com/articles/lottrue-or-lotfalse-this-is-the-last-hurdle-before-taproot-activation

@StefanWeegink
Copy link

Hey! @RFHuisman and me have just finished implementing a working version of transactions. Currently still parts are hardcoded like public keys but as you can see we have already linked it to the UI, making it easier to test. The video bellow shows how our starting balance is 9.99 btc and then a transaction of 1btc is proposed. This transaction is approved by both users and is then executed and, thus, our balance has updated to 8.99 btc

transaction.mp4

@RFHuisman
Copy link

Hi! Taproot meets the requirements that you want once it is activated on the Bitcoin network. Details about the functionalities and confirming that it meets the requirements can be found here and here.

@synctext
Copy link
Member Author

synctext commented Mar 3, 2021

Taproot on Android: #5996 (comment)

@CallumH2410
Copy link

Screenshot 2021-03-03 at 14 44 19

@CallumH2410
Copy link

Screenshot 2021-03-03 at 16 20 13

@synctext
Copy link
Member Author

synctext commented Mar 3, 2021

Great progress! Three directions coming together as course goal:

Testnet: https://twitter.com/groestlcointeam/status/1340240253202948097?lang=en

@StevenL98
Copy link

I can not start the Gradle daemon when my Mobile Hotspot of my laptop is running. At my parents, I have to because the WiFi is terrible there. It is a known bug mentioned in this issue.
If you have an idea on how to fix this, please let me know.

@xoriole
Copy link
Contributor

xoriole commented Mar 4, 2021

@StevenL98 Reading the issue thread, maybe you could try downgrading to a working version.

@synctext
Copy link
Member Author

synctext commented Mar 11, 2021

  • Taproot works on Android emulator, cmdline Bitcoin node is working, tests are passing. 👏 🎊 👏 @RFHuisman and @StefanWeegink 🏅 !
  • ToDo: document magic recipe, multi-sig transaction (old approach), multi-sig (Taproot)
  • ToDo: is there a testnet, see Twitter pointer above, testnet token?
  • Bug fixes of Luxury communism DAO. Big flaw discovered: 20 minutes delay for discovery of new DAO!
  • ToDo: create Pull Request of DAO fixes please @CallumH2410 to main Superapp. Understand gossip, crawl request, and spam trade-offs. Write tests for this?!? Show number of peers (also their IPv4?) in DAO?
  • @StevenL98 fixed also DAO bugs. Worked on vote screen, signatures, public keys, IPv4 addresses, and peers.
  • Next sprint: DAO demo, post fixed .APK on this issue, new screens on voting.
  • Future epic sprint target: a DAO that scales, based on Taproot! Thousands of people can vote on proposals. Performance graph as main course project output. If you get that published at a scientific conference we can pay for your plane ticket to America.

@RFHuisman
Copy link

Here are some screenshots showing bitcoind, bench_bitcoin and test_bitcoin, compiled from the latest master branch, successfully running on an Android emulator. I will post a guide later this/next week describing the setup I used and the steps that I took to compile it.

bitcoind
android-bitcoin-screenshot6
android-bitcoin-screenshot7

bench_bitcoin
android-bitcoin-screenshot4

test_bitcoin
android-bitcoin-screenshot9

@thversfelt
Copy link

Hi, this is Thijs from Liquidity Pool group 1. We have also been looking into Taproot for our BTC part of the liquidity pool, and would really appreciate a guide for getting it to work on Android. Cheers!

@RFHuisman
Copy link

RFHuisman commented Mar 15, 2021

WIP: Guide for compiling Bitcoin Core on Android

Please contact me on my mail [email protected] if you have questions or are experiencing issues so I can adjust the guide.

NOTE:
I used Ubuntu 20.04 LTS when writing and testing this guide. Other Ubuntu versions or Linux distributions probably work as well, but verify this on your own.

  1. Clone https://github.com/bitcoin/bitcoin locally.
  2. Install Android SDK version 28. More recent ones probably work as well, but I did not test that. You can use Android Studio to install the right SDK.
  3. Download the NDK revision 20b here https://developer.android.com/ndk/downloads/older_releases. Other versions did not work for me, but you might be able to figure out how to use later versions as well.
  4. Make sure to unzip and place the contents of the NDK in the SDK folder in the subfolder ndk-bundle.
  5. Follow this guide to install required dependencies when compiling. For Ubuntu, use this one https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#linux-distribution-specific-instructions. Also make sure you have these dependencies installed for cross compiling https://github.com/bitcoin/bitcoin/tree/master/depends#for-linux-including-i386-arm-cross-compilation.
  6. cd in your terminal to the depends folder.
  7. In this folder, run the following command: sudo make HOST=x86_64-linux-android ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/home/rick/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin ANDROID_SDK=/home/rick/Android/Sdk/ ANDROID_NDK=/home/rick/Android/Sdk/ndk-bundle/

NOTE:

  • In the command above, HOST specifies the architecture that you are running Android on. For a physical device, this could be aarch64-linux-android, but I used an emulator, so we need to compile for the x86_64-linux-android architecture. Make sure to change this variable to the architecture you are running on your device.
  • ANDROID_API_LEVEL is 28 in my case. Make sure this version is the same as the SDK you installed.
  • Make sure the paths for ANDROID_TOOLCHAIN_BIN, ANDROID_SDK and ANDROID_NDK are correct on your computer.
  1. Now wait to build depends (this takes some time). Make sure there are no errors before continuing.
  2. cd back to the bitcoin core folder.
  3. Run sudo ./autogen.sh
  4. Run the following command: sudo ./configure --prefix=/home/rick/Documents/bitcoin/depends/x86_64-linux-android/. Make sure the folder name is the same as the architecture you chose to compile before and that the path is correct for your computer.
  5. Now run sudo make -i LDFLAGS="-static-libstdc++". The -i flag ignores errors during compilation. There are certain files in the folder test/fuzz that give errors when compiling and I did not bother fixing them, since they are not needed to run or compile bitcoin core. In addition, LDFLAGS makes sure that you do not get a CANNOT LINK EXECUTABLE "./bitcoind": library "libc++_shared.so" not found error when trying to run the binary on your device.
  6. Wait for all the binaries to be built. Run file src/bitcoind and make sure it matches the architecture you compiled for and is runnable on your device.

NOTE:
Next steps assume you are running an emulator, but the steps should be fairly similar when you are running on a physical device. Make sure to adjust the commands and the setup so that it works. Google is your friend here.

  1. Download the correct emulator in Android Studio. Make sure that it has the correct architecture that you compiled Bitcoin Core with (for me x86-64), that it runs the right Android version (for me 28) and that the device doesn't contain the Play Store. This is needed since we need to root the device. You can check this by going to the AVD Manager in Android Studio and it should say Google APIs in the Target column instead of Google Play.
  2. Start the emulator and open a new terminal. Wait until the emulator shows the home screen.
  3. Run adb devices to make sure the device is up and running and connected to adb. You probably need to install adb if you haven't before.
  4. Run adb root to root the device.
  5. Run adb push src/bitcoind /data/local/tmp to upload the bitcoind binary to the device in /data/local/tmp.
  6. Run adb shell and then run cd /data/local/tmp.
  7. To quickly test if we can run bitcoind, run mkdir .bitcoin and then ./bitcoind -datadir=.bitcoin. You can also upload other binaries that we compiled (like test-bitcoin or bench_bitcoin) and run them to test if it works.
  8. If you did not encounter any errors during the steps above and can run the binaries, then congratulations, you successfully compiled Bitcoin Core for Android.

I hope this guide was helpful. If you are stuck at a certain step or encounter other issues, please reach out to me via my mail (see the beginning of the guide) and I will see if I can help you further and potentially update the guide.

@RFHuisman
Copy link

@thversfelt Please check out the guide above and let me know if it works for you.

@StefanWeegink
Copy link

StefanWeegink commented Mar 15, 2021

WIP: Guide for compiling Bitcoin Core on Android

Please contact me on my mail [email protected] if you have questions or are experiencing issues so I can adjust the guide.

NOTE:
I used Ubuntu 20.04 LTS when writing and testing this guide. Other Ubuntu versions or Linux distributions probably work as well, but verify this on your own.

1. Clone https://github.com/bitcoin/bitcoin locally.

2. Install Android SDK version 28. More recent ones probably work as well, but I did not test that. You can use Android Studio to install the right SDK.

3. Download the NDK revision 20b here https://developer.android.com/ndk/downloads/older_releases. Other versions did not work for me, but you might be able to figure out how to use later versions as well.

4. Make sure to unzip and place the contents of the NDK in the SDK folder in the subfolder `ndk-bundle`.

5. Follow this guide to install required dependencies when compiling. For Ubuntu, use this one https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#linux-distribution-specific-instructions. Also make sure you have these dependencies installed for cross compiling https://github.com/bitcoin/bitcoin/tree/master/depends#for-linux-including-i386-arm-cross-compilation.

6. `cd` in your terminal to the `depends` folder.

7. In this folder, run the following command: `sudo make HOST=x86_64-linux-android ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/home/rick/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin ANDROID_SDK=/home/rick/Android/Sdk/ ANDROID_NDK=/home/rick/Android/Sdk/ndk-bundle/`

NOTE:

* In the command above, HOST specifies the architecture that you are running Android on. For a physical device, this could be `aarch64-linux-android`, but I used an emulator, so we need to compile for the `x86_64-linux-android` architecture. Make sure to change this variable to the architecture you are running on your device.

* ANDROID_API_LEVEL is 28 in my case. Make sure this version is the same as the SDK you installed.

* Make sure the paths for `ANDROID_TOOLCHAIN_BIN`, `ANDROID_SDK` and `ANDROID_NDK` are correct on your computer.


1. Now wait to build depends (this takes some time). Make sure there are no errors before continuing.

2. `cd` back to the bitcoin core folder.

3. Run `sudo ./autogen.sh`

4. Run the following command: `sudo ./configure --prefix=/home/rick/Documents/bitcoin/depends/x86_64-linux-android/`. Make sure the folder name is the same as the architecture you chose to compile before and that the path is correct for your computer.

5. Now run `sudo make -i LDFLAGS="-static-libstdc++"`. The `-i` flag ignores errors during compilation. There are certain files in the folder `test/fuzz` that give errors when compiling and I did not bother fixing them, since they are not needed to run or compile bitcoin core. In addition, `LDFLAGS` makes sure that you do not get a `CANNOT LINK EXECUTABLE "./bitcoind": library "libc++_shared.so" not found` error when trying to run the binary on your device.

6. Wait for all the binaries to be built. Run `file src/bitcoind` and make sure it matches the architecture you compiled for and is runnable on your device.

NOTE:
Next steps assume you are running an emulator, but the steps should be fairly similar when you are running on a physical device. Make sure to adjust the commands and the setup so that it works. Google is your friend here.

1. Download the correct emulator in Android Studio. Make sure that it has the correct architecture that you compiled Bitcoin Core with (for me x86-64), that it runs the right Android version (for me 28) and that the device doesn't contain the Play Store. This is needed since we need to root the device. You can check this by going to the AVD Manager in Android Studio and it should say Google APIs in the Target column instead of Google Play.

2. Start the emulator and open a new terminal. Wait until the emulator shows the home screen.

3. Run `adb devices` to make sure the device is up and running and connected to adb. You probably need to install adb if you haven't before.

4. Run `adb root` to root the device.

5. Run `adb push src/bitcoind /data/local/tmp` to upload the `bitcoind` binary to the device in `/data/local/tmp`.

6. Run `adb shell` and then run `cd /data/local/tmp`.

7. To quickly test if we can run `bitcoind`, run `mkdir .bitcoin` and then `./bitcoind -datadir=.bitcoin`. You can also upload other binaries that we compiled (like `test-bitcoin` or `bench_bitcoin`) and run them to test if it works.

8. If you did not encounter any errors during the steps above and can run the binaries, then congratulations, you successfully compiled Bitcoin Core for Android.

I hope this guide was helpful. If you are stuck at a certain step or encounter other issues, please reach out to me via my mail (see the beginning of the guide) and I will see if I can help you further and potentially update the guide.

I will test this tomorrow on a ubuntu 20.04.2 LTS server and run the emulator on windows (@RFHuisman ran it on ubuntu):

Tested it and got quite far except my server keeps crashing due to kernal error (unrelated to this). Some additions to @RFHuisman guide would be how to install the sdk/ndk without android studio:

step 2
$ wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
$ unzip commandlinetools-linux-6858069_latest.zip
$ cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-28"

NOTE I had the following error: Error: Could not find or load main class java.se.ee to fix:

change java to 8 (in 11 they removed the java.se.ee class) and adjust default java version (verify using java -version)

If there are still errors you can try this or google the error:

$ unset JAVA_OPTS
$ ./sdkmanager --licenses

step 3 & 4
$ wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
$ unzip android-ndk-r20b-linux-x86_64.zip

step 6
depends is in the bitcoin folder if you are looking for it

@thversfelt
Copy link

@thversfelt Please check out the guide above and let me know if it works for you.

Thank you for the comprehensive guide, we'll let you know.

@StevenL98
Copy link

StevenL98 commented Mar 17, 2021

  • Within a voting, you now have the possibility to send a vote against the proposal
  • Every proposal now has the same unique id if it is proposed to all the participants of a DAO (this is how it is supposed to be right?)
  • Transformed a signature to the bitcoin public key, a user can now see who voted already
  • Added a voted stamp when a user has already voted.
  • Added a red border when a proposal can't be met at the current state.
  • If these things are approved, I will create a Pull Request for it
  • The Pull Request for the bugs, should be online on the Tribler branch on 18/03. EDIT: It is now

@RFHuisman
Copy link

@synctext
Copy link
Member Author

synctext commented Mar 18, 2021

  • Solid progress again, impressive work!
  • ToDo: Create a testnet/signet and facet for free 10 BTC for each of our users? Single central server?
  • Repeating issues from above
    • document magic recipe, multi-sig transaction (old approach),
    • Missing wallet support in Taproot Bitcoin code! 🔥 Magic trick possibility: use RPC to bitcoinD for taproot? (now still stand-alone)
    • multi-sig using Taproot magic 🧙‍♂️
    • DAO Bug fixes. 20 minutes delay for discovery of new DAO. UPDATE: NAT problems? Peer discovery and discovery of IPv4 addresses seems to have bug(s). @CallumH2410 to main Superapp. Understand gossip, crawl request, and spam trade-offs. Write tests for this?!? Show peers (also their IPv4?) in DAO?
    • DAO demo, post fixed .APK on this issue, new screens on voting.

@StevenL98
Copy link

StevenL98 commented Mar 30, 2021

In this sprint we:

  • Set up a RegTest server that works with Taproot and bitcoinj
  • Set up a faucet server, where users can ask for bitcoins via the app itself, using the 'get BTC' button. This button disables if a user has over 10 BTC
  • Changed the GUI on several places, such that it shows the balance of a DAO in BTC
  • Added a check if a DAO has sufficient balance (without the fee) before creating a proposal or a transaction
  • Calculated an estimated fee, this is shown on a transfer proposal
  • Added a new toggle to switch between the Production/RegTest/TestNet network
  • Completed most of the work on the Taproot library
  • Found a bug in the bitcoinj library which we prevented by adding the balance check
  • Changed a lot of satoshi to BTC, to make it a lot more clear
  • Show the current network on the bitcoin fragment and in the chain that is being downloaded.

@synctext
Copy link
Member Author

synctext commented Mar 30, 2021

ToDo for final grading: PR accepted, Readme 1 & 2, and running .APK
(readme, document stuff like the three Multi-Sig methods, library version, mining server Python scripts, unreviewed academic sig sharing paper, Taproot status, need for code refactoring, etc. ) Twitter-love animated .GIF of a working DAO for promotional purposes 🚀
7 April meet: please have a .APK ready for testing n-out-of-n with all meeting members.

@synctext
Copy link
Member Author

synctext commented Apr 7, 2021

Extension beyond Q3 for beating Taproot into submission. Its proven hard to get fully working 🔨
Invite for 2nd edition of our workshop in Canada on 6-10 December 2021 with a scientific write-up of your DAO: https://middleware-conf.github.io/2021// https://dicg2020.github.io/ (small print requires performance evaluation graphs and paper acceptance)
Because money is critical infrastructure, please do some burn-in testing and other Quality Assurance.

@synctext
Copy link
Member Author

For readme, show the system architecture in 1 picture: taproot.tudelft server, regtest, BicoinJ library, rpc calls, regtest server, trustchain, voting system, negative vote spreading, etc.

@StevenL98
Copy link

StevenL98 commented Apr 27, 2021

We sent the .apk file via mail, it can also be downloaded via this link. We will finish the readme and pull request before tomorrow.

See here our result video

blockchain.with.text.mp4

@RFHuisman
Copy link

PR is ready: Tribler/trustchain-superapp#70.
It contains all of our code and documentation now

@StevenL98
Copy link

StevenL98 commented May 24, 2021

The final .apk file can be downloaded here!
Note, it will expire in 1 week (31-05-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

9 participants