[v0.8.3] Subcription testing

I will sign the keys of some of the members to simulate various behaviors.

Both the members @idkwptc and @greyzlii have been signed by me ( @canercandan ) , btw it’s funny to see that the members are naturally using the same uid in the ucoin test community and forum.

2 Likes

I just signed @canercandan and @greyzlii. I was wondering if I should create an @evil_fake_bot that I could sign… :smirk_cat:

@idkwptc yes you could! Rules of beta_brousouf currency are super permissive:

  • 1 minimum signature required
  • 3 max distance from any WoT member
  • Signature expiration after 1 year
  • Signature repeatability: every 5 years

Information extracted from: http://ucoin.twiced.fr:9101/blockchain/parameters

Obviously, I won’t sign it :stuck_out_tongue:

I just signed @idkwptc, @canercandan and @mhugo.

I do not trust other members.
They maybe are communists ! :slight_smile:

1 Like

Thanks for all these signatures! I can’t integrate them right now, I need software update for that (yes, there is still code to be written :stuck_out_tongue: ). I will notify all of you when it’s done!

Thanks again!

Here is a digraph generated thanks to the code below and the libraries ucoin-python-api and networkx and pydot:

#!/usr/bin/python2

import networkx as nx
import pydot as dot
import ucoin_python_api as upy
import six
from six.moves import range

DOT_FILENAME = 'community.dot'
PNG_FILENAME = 'community.png'

ch = upy.ConnectionHandler('ucoin.twiced.fr', 9101)
last_block = upy.blockchain.Current(ch).get()

assert 'number' in last_block

G = nx.DiGraph()
wot = {}

for i in range(last_block['number']+1):
    block = upy.blockchain.Block(ch, i).get()

    uids = {}

    for identity in block['identities']:
        pubkey, signature, timestamp, uid = identity.split(':')
        uids[pubkey] = uid

    for joiner in block['joiners']:
        pubkey, signature, timestamp = joiner.split(':')
        wot[pubkey] = uids[pubkey]
        G.add_node(wot[pubkey])

    for joiner in block['leavers']:
        pubkey, signature, timestamp = joiner.split(':')
        G.remove_node(wot[pubkey])
        del wot[pubkey]

    for cert in block['certifications']:
        pubkey_from, pubkey_to, timestamp, signature = cert.split(':')
        G.add_edge(wot[pubkey_from], wot[pubkey_to])

nx.draw_graphviz(G)
nx.write_dot(G, DOT_FILENAME)

g = dot.graph_from_dot_file(DOT_FILENAME)
g.write_png(PNG_FILENAME)

The present code illustrates a naive parsing method. To cover every members it reads every block one by one and updates a graph dictionary with the known paths (certifications).

But I have thought about using testing another method, based on the method « wot/lookup/UID ». We already know the first member of the WoT thanks to « blockchain/block/0 », we can then cover every connected members with him and keep parsing the next members connections til every connections be entirely parsed and used. But there is an issue since we have no guarantee the first user found in the first block still in the present time WoT, this is why it may be better to use the last block joiners instead to start parsing.

Do you have any better and much more efficient idea ?

1 Like

Excellent :slight_smile:

To know the WoT members, you have to look through all blocks from current to the past N blocks whose age is < 1 year, since memberships are to expire every year too. But you have to parse all of them, to be sure you do not loose any information.

N.B. : I am saying 1 year about memberships, but it is a currency parameter to be defined

Ya you are right but what about the second solution using “wot/lookup/UID” ?

BTW, the problem will be fixed thanks to the solution you’ve done here.

Here the second solution code and result:

#!/usr/bin/python2

import networkx as nx
import pydot as dot
import ucoin_python_api as upy
import six
from six.moves import range
from pprint import pprint

DOT_FILENAME = 'community.dot'
PNG_FILENAME = 'community.png'

ch = upy.ConnectionHandler('ucoin.twiced.fr', 9101)
last_block = upy.blockchain.Current(ch).get()

assert 'identities' in last_block

G = nx.DiGraph()
wot = {}
todo = []
done = set()

for identity in last_block['identities']:
    pubkey, signature, timestamp, uid = identity.split(':')
    todo.append(pubkey)

while len(todo) > 0:
    pubkey = todo.pop()
    if pubkey in done: continue

    lookup = upy.wot.Lookup(ch, pubkey).get()

    assert 'results' in lookup
    assert len(lookup['results']) > 0

    result = lookup['results'][0]

    assert 'uids' in result
    assert len(result['uids']) > 0

    uid = result['uids'][0]

    wot[pubkey] = uid['uid']
    G.add_node(pubkey)

    assert 'others' in uid

    for other in uid['others']:
        other_pubkey = other['pubkey']
        other_uid = wot[other_pubkey] if other_pubkey in wot else other_pubkey
        G.add_node(other_pubkey)
        G.add_edge(other_pubkey, pubkey)
        todo.append(other_pubkey)

    done.add(pubkey)

H = nx.relabel_nodes(G, wot)
nx.draw_graphviz(H)
nx.write_dot(H, DOT_FILENAME)

g = dot.graph_from_dot_file(DOT_FILENAME)
g.write_png(PNG_FILENAME)

If I am not wrong the /wot/lookup doesnot provide the real state of the wot blockchain but only the requested one since I can see some signing request but not yet confirmed from the blockchain.

BTW, One can see on the graph above, that Eve(il) has a weird behavior :wink:

Indeed, /wot/lookup doesn’t give you the real WoT state, but the potential one. This place is where you will find all incoming data. Contract’s data, however, is the one within the blockchain.

About Eve, we can see here that she is 4 hops away from vit, so she won’t be able to join the WoT given the maxSteps rule (I should call it maxHops btw). She also have only 1 certification. She will hardly enter a community that way! (even if beta_brousouf’s rule of minSig = 1 is successfully passed here).

I am glad you made this graph, since it shows us several useful informations:

  • WoT quicly becomes a real mess!
  • We can identify suspect identities (Eve here)
  • We can deduce from whom we may get signatures to join in

Great work :slight_smile:

Great job !
(Even if, I can’t imagine such picture with 100k members :open_mouth: )

I read 3 steps :
Eve → idkwptc → cgeek → vit

It could be useful to color arrows in order to have a view about expirations date.
Informations about maxSteps could also be interesting.

For example :

  • cgeek is at 2 steps or less from any member
  • vit is at 3 steps or less from any member

What happens now, if Eve is know only from idkwptc ? As Eve is a valid WoT member, it could have a severe impact on WoT expansion.

Maybe that minSig parameter can solve that problem. Here this parameter is clearly no well chosen. :slight_smile:

And you are right :grin:

Note, however, that even if we are really few in the WoT, we already reach the maxHops (I will call it that way now) rule limit.

Clearly :slight_smile: Anyway it is a good thing in our case, it helps us understand how important is this parameter.

If we wonsider that a valid “hop” has to be reciprocal, I’m wrong.
Reciprocal links means that two people tells to the whole community :
“We know each other.”

If we think in this way, Eve has not yet any valid link with the beta_brousouf community.
Anyway, Eve has just to sign idkwptc to make the link idkwptc <-> Eve valid.
(And join the community, and possibly block the wot growth if no other links are established)

Sure ! And it’s exciting !

It must not be considered this way in uCoin. As you said, certifying back your certifier is super easy.

I just signed @canercandan.
But I don’t trust Eve (Evil bot ?) !

Come on ! Eve is the nicest person I ever met. :wink:

Ok, I’ve just added 11 new certifications coming from existing members:

caner -> greyzlii
idkwptc -> greyzlii
moshe -> greyzlii
caner -> idkwptc
greyzlii -> idkwptc
greyzlii -> caner
idkwptc -> caner
moshe -> caner
vit -> caner
moshe -> mhugo
greyzlii -> mhugo

As you can see, I haven’t added Eve since I know who she is (or at least, I think). However, she fits the rules for joining. So if you want me to add her, no problem!

Next step: automated block generation when new data is received :wink:

New WoT state illustrated with a graph:

2 Likes

This topic is now closed, since this testing node is no longer available.