Tribler / trustchain-superapp

Kotlin implementation of Trustchain and IPv8 with rich networking: multihoming of local Bluetooth+4G, decentral social networking, UDP hole punching, etc.
GNU General Public License v3.0
78 stars 63 forks source link

Demo for GoldRepublic #166

Open kandrio opened 1 year ago

kandrio commented 1 year ago

Description

On September 5th, Gold Republic will visit the Blockchain lab and we plan to show them a live demo of "offline token transfer". In order to do that, we must make the trustchain-superapp downloadable through the Google Play Store.

Link to relevant issue: https://github.com/Tribler/trustchain-superapp/issues/161

Important Dates

Date of the demo:

Deadline for trustchain-superapp APK upload:

Demo Structure

@synctext We need to decide on a couple of details:

CC @InvictusRMC

synctext commented 1 year ago

key argument for offline is 6% more revenue: https://tweakers.net/nieuws/171074/albert-heijn-en-ing-presenteren-digitale-betaalmethode-op-basis-van-tokens.html

@kandrio Yes, 10-15 minute of demo time sounds excellent. Please prepare for that. You are in charge of the demo structure. Explain it from scratch to somebody who is experienced in the global financial system. Focal end-point: we support offline transfers with web-of-trust protection against double spending.

What feature work today? Screenshot of each feature for tutorial!

kandrio commented 1 year ago

APK for demo: https://drive.google.com/file/d/1uSKhMLUOYPm1dCmaURpPF0-MPPKmXIkf/view?usp=sharing

kandrio commented 1 year ago

Understanding EuroToken

Ideally, we want to show GoldRepublic a EuroToken transfer live. However, I don't understand how to do that. I don't have any experience on the EuroToken module and I can't find any documentation about it.

The initial screen of the app looks like this:

In order to receive EuroTokens, I:

  1. fill the amount under "Request or transfer euro token"
  2. hit the Request button

Then, a QR code appears:

On a 2nd device, I hit the Send button and I scan the QR code. Then the following screen appears on the 2nd device:

As you can see, I get "Insufficient balance", so the transfer cannot happen. This makes sense, since my balance is 0 euros. So, I'm thinking about increasing my balance through the Exchange screen, on the bottom right part of the screen. This looks like this:

However, I don't get how this works.

@InvictusRMC @synctext any ideas on what I'm missing here?

synctext commented 1 year ago

Key priority: get demo working The offline token transfer must work for the demo. This means ability to create GoldEuros. The Demo mode used to work, could create Euros somehow. The demo mode only fills the trusted counterparty DB, when DEMO mode is enabled, it generates 50 random keys instead. Solution could be: enable demo mode, automatically adds 10 Euro to your balance! :euro:

InvictusRMC commented 1 year ago

@InvictusRMC @synctext any ideas on what I'm missing here?

Sorry for the late response. You need to run a gateway for this. I'll reach out to the student who last worked on this and will get back to you.

synctext commented 1 year ago

Sorry for the late response. You need to run a gateway for this. I'll reach out to the student who last worked on this and will get back to you.

No gateway needed. Just add 10 Euro to the user balance when enabling Demo Mode. Fixed :hammer:

InvictusRMC commented 1 year ago

Update

I have found out the following:

InvictusRMC commented 1 year ago

Sorry for the late response. You need to run a gateway for this. I'll reach out to the student who last worked on this and will get back to you.

No gateway needed. Just add 10 Euro to the user balance when enabling Demo Mode. Fixed 🔨

Ah! Yes, definitely try this first 🙂

kandrio commented 1 year ago

I'm on it!

kandrio commented 1 year ago

Networking Issues

During the past few days, I've been trying to make the default initial balance equal to 10 Eurotokens, instead of 0. This is only for the purpose of the demo of course. It was harder than I thought, but I successfully managed to do it!

Now, the sender is able to create and send a Proposal block successfully (without any "Insufficient balance" errors). However, one problem arises: the receiver does not receive any Proposal blocks. Therefore, what happens is:

Having worked with trustchain and IPv8 during the blockchain engineering course, I assume that this is clearly a connectivity/networking issue between the two devices. Specifically, I have 2 android devices connected to the same WiFi network (with access to the internet), but no Proposal blocks arrive on the receiver.

@synctext @InvictusRMC Any ideas on how to resolve this?

InvictusRMC commented 1 year ago

Should work indeed. Are you doing it over Eduroam or personal WiFi? The former can introduce some issues.

kandrio commented 1 year ago

Are you doing it over Eduroam or personal WiFi? The former can introduce some issues.

Personal WiFi.

I think it's a peer discovery issue at heart. I'll dive deeper and see what's going on

kandrio commented 1 year ago

Update

I managed to make simple transactions work finally. With a good WiFi network, peer discovery works. There were some other bugs in the application that I managed to resolve. Here are some screenshots:

Sender

Receiver

@synctext @InvictusRMC How does this look? I will upload an APK here by Monday, which will be the APK I'll use for the demo. I don't know if we have enough time for a new release.

Also, I'm not really familiar with some entities in Eurotoken. For instance:

Feel free to point me to any documentation so that I understand a little bit better what happens underneath

synctext commented 1 year ago

Google Play upload is hopefully in time. Solid work ✅

InvictusRMC commented 1 year ago

Unfortunately I don't have access to a PC until Monday. I can share the build commands with you though. If you then send me the APK, I will publish it.

kandrio commented 1 year ago

@InvictusRMC send me the build commands and I'll build the APK and send it to you. I'll be AFK for the weekend as well, so I'll upload the APK on Sunday evening.