Tribler / kotlin-ipv8

P2P communication library for Android
62 stars 27 forks source link

Documentation of TrustChainCommunity lacks. When can a transaction be considered as complete? #82

Open Artanidos opened 1 year ago

Artanidos commented 1 year ago

We are working on a social media app based on ideas from Scuttlebut and we are using IPv8 as a base. We are also minting coins and paying them out like universal basic income. The TrustChainCommunity looks suitable for our coins and payments.

The documentation lacks of such a scenario, so its not clear for me how to secure the transactions in my app. Its said that you should send a proposal and wait for an agreement.
So far so good, but I don't understand when the transaction is complete. When can both sides say "now the transaction is ready"? Why shall I broadcast the blocks? Why shall I crawl the trustchain? How to identify that a proposal/agreement is coming from the same or an authorized app?

Normally I would say that for the receiver the transaction is ready when he gets the proposal. But what if the agreement never reaches the payer? Then the payer has only got a half block without agreement. Can he not double spend the coins or shall half blocks count as spent?

InvictusRMC commented 1 year ago

Hi Olaf, see my reponses

Why shall I broadcast the blocks?

To ensure others bear witness of the existence of this transaction

Why shall I crawl the trustchain?

To validate prior transactions of those with whom you are communicating (e.g. detect fraud)

How to identify that a proposal/agreement is coming from the same or an authorized app?

PK encryption should suffice. Introduce some freshness to combat e.g. replays.

Normally I would say that for the receiver the transaction is ready when he gets the proposal. But what if the agreement never reaches the payer? Then the payer has only got a half block without agreement. Can he not double spend the coins or shall half blocks count as spent?

You can build some logic to acknowledge deliveries. Note that IPv8 is connectionless so there is no guarantee messages will arrive.

I can also advise you to have a look at our paper on TrustChain: Otte, P., de Vos, M., & Pouwelse, J. (2020). TrustChain: A Sybil-resistant scalable blockchain. Future Generation Computer Systems, 107, 770-780. Open access link

Also have a look at our trustchain-superapp repo, especially the open pull request. This app contains several generations of MSc students also using TrustChain to create novel stuff.