# \[v0.8.3\] Subcription testing

**URL:** <https://forum.duniter.org/t/v0-8-3-subcription-testing/25>\
**Category:** Nodes\
**Created:** [20 September 2014 17:17 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25 "2014-09-20T17:17:31Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![idkwptc](https://forum.duniter.org/letter_avatar/idkwptc/32/6_449c533f586939b6e5f246632a46421f.png) [@idkwptc](https://forum.duniter.org/u/idkwptc)\
**Post date:** [1 October 2014 09:23 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/21 "2014-10-01T09:23:02Z")

</div>

Waiting to be signed. Awesome ! 🙂

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [1 October 2014 11:07 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/22 "2014-10-01T11:07:45Z")

</div>

I’ve just certified you and added you in the blockchain @idkwptc, welcome 😉

You should start signing each other too, as now we are rather in “star” mode, and if I leave community will literally burst :smile:

---

<div class="post-metadata">

**Author:** ![canercandan](https://forum.duniter.org/user_avatar/forum.duniter.org/canercandan/32/1702_2.png) [@canercandan](https://forum.duniter.org/u/canercandan)\
**Post date:** [1 October 2014 12:10 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/23 "2014-10-01T12:10:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![canercandan](https://forum.duniter.org/user_avatar/forum.duniter.org/canercandan/32/1702_2.png) [@canercandan](https://forum.duniter.org/u/canercandan)\
**Post date:** [1 October 2014 12:17 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/24 "2014-10-01T12:17:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![idkwptc](https://forum.duniter.org/letter_avatar/idkwptc/32/6_449c533f586939b6e5f246632a46421f.png) [@idkwptc](https://forum.duniter.org/u/idkwptc)\
**Post date:** [1 October 2014 13:02 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/25 "2014-10-01T13:02:07Z")

</div>

I just signed @canercandan and @greyzlii. I was wondering if I should create an @evil\_fake\_bot that I could sign… 😼

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [1 October 2014 13:12 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/26 "2014-10-01T13:12:43Z")

</div>

@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](http://ucoin.twiced.fr:9101/blockchain/parameters)

Obviously, I won’t sign it 😛

---

<div class="post-metadata">

**Author:** ![greyzlii](https://forum.duniter.org/letter_avatar/greyzlii/32/6_449c533f586939b6e5f246632a46421f.png) [@greyzlii](https://forum.duniter.org/u/greyzlii)\
**Post date:** [2 October 2014 08:03 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/27 "2014-10-02T08:03:24Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [2 October 2014 08:19 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/28 "2014-10-02T08:19:30Z")

</div>

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 😛 ). I will notify all of you when it’s done!

Thanks again!

---

<div class="post-metadata">

**Author:** ![canercandan](https://forum.duniter.org/user_avatar/forum.duniter.org/canercandan/32/1702_2.png) [@canercandan](https://forum.duniter.org/u/canercandan)\
**Post date:** [3 October 2014 21:52 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/29 "2014-10-03T21:52:24Z")

</div>

Here is a digraph generated thanks to the code below and the libraries [ucoin-python-api](https://github.com/ucoin-io/ucoin-python-api) and networkx and pydot:

![](https://forum.duniter.org/uploads/default/16/b0549e96e8ba018b.png)

```python
#!/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 «&nbsp;wot/lookup/UID&nbsp;». We already know the first member of the WoT thanks to «&nbsp;blockchain/block/0&nbsp;», 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 ?

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [3 October 2014 22:34 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/30 "2014-10-03T22:34:16Z")

</div>

Excellent 🙂

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

---

<div class="post-metadata">

**Author:** ![canercandan](https://forum.duniter.org/user_avatar/forum.duniter.org/canercandan/32/1702_2.png) [@canercandan](https://forum.duniter.org/u/canercandan)\
**Post date:** [4 October 2014 06:21 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/31 "2014-10-04T06:21:01Z")

</div>

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](http://forum.duniter.org/t/update-of-ucoin-clients-code-python-versions/33/17?u=canercandan).

---

<div class="post-metadata">

**Author:** ![canercandan](https://forum.duniter.org/user_avatar/forum.duniter.org/canercandan/32/1702_2.png) [@canercandan](https://forum.duniter.org/u/canercandan)\
**Post date:** [4 October 2014 07:32 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/32 "2014-10-04T07:32:06Z")

</div>

Here the second solution code and result:

![](https://forum.duniter.org/uploads/default/17/ca3f05c1d46b853d.png)

```python
#!/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 😉

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [4 October 2014 09:20 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/33 "2014-10-04T09:20:13Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![greyzlii](https://forum.duniter.org/letter_avatar/greyzlii/32/6_449c533f586939b6e5f246632a46421f.png) [@greyzlii](https://forum.duniter.org/u/greyzlii)\
**Post date:** [4 October 2014 10:30 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/34 "2014-10-04T10:30:37Z")

</div>

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

> [@cgeek](#):
>
> About Eve, we can see here that she is 4 hops away from vit,

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

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [4 October 2014 12:06 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/35 "2014-10-04T12:06:06Z")

</div>

> [@greyzlii](#):
>
> I read 3 steps : Eve -\> idkwptc -\> cgeek -\> vit

And you are right 😁

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.

> [@greyzlii](#):
>
> Maybe that minSig parameter can solve that problem. Here this parameter is clearly no well chosen.

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

---

<div class="post-metadata">

**Author:** ![greyzlii](https://forum.duniter.org/letter_avatar/greyzlii/32/6_449c533f586939b6e5f246632a46421f.png) [@greyzlii](https://forum.duniter.org/u/greyzlii)\
**Post date:** [4 October 2014 13:32 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/36 "2014-10-04T13:32:57Z")

</div>

> [@cgeek](#):
>
> And you are right

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)

> [@cgeek](#):
>
> it helps us understand how important is this parameter

Sure ! And it’s exciting !

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [4 October 2014 13:55 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/37 "2014-10-04T13:55:35Z")

</div>

> [@greyzlii](#):
>
> If we wonsider that a valid “hop” has to be reciprocal

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

---

<div class="post-metadata">

**Author:** ![vit](https://forum.duniter.org/user_avatar/forum.duniter.org/vit/32/2775_2.png) [@vit](https://forum.duniter.org/u/vit)\
**Post date:** [4 October 2014 17:06 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/38 "2014-10-04T17:06:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![idkwptc](https://forum.duniter.org/letter_avatar/idkwptc/32/6_449c533f586939b6e5f246632a46421f.png) [@idkwptc](https://forum.duniter.org/u/idkwptc)\
**Post date:** [5 October 2014 16:50 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/39 "2014-10-05T16:50:00Z")

</div>

Come on ! Eve is the [nicest](http://xkcd.com/177/) person I ever met. 😉

---

<div class="post-metadata">

**Author:** ![cgeek](https://forum.duniter.org/user_avatar/forum.duniter.org/cgeek/32/279_2.png) [@cgeek](https://forum.duniter.org/u/cgeek)\
**Post date:** [9 October 2014 11:49 UTC](https://forum.duniter.org/t/v0-8-3-subcription-testing/25/40 "2014-10-09T11:49:13Z")

</div>

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 😉

[Previous page](https://forum.duniter.org/t/v0-8-3-subcription-testing/25.md?page=1)

[Next page](https://forum.duniter.org/t/v0-8-3-subcription-testing/25.md?page=3)
