In [1]:
%load_ext autoreload
%autoreload 2

Colored Coins Asset crawler

It looks like the Colu explorer doesn't have a way to get all assets currently issued. Options are:

  1. Setting up your own colored coins explorer (basically a full bitcoin node)

  2. Using the API to crawl from asset --> holders --> assets --> holders

With (2) we're essentially building an asset tree, which is a good entry point for further analysis.

ColoredCoins REST API

This approach doesn't use the colu node api or the redis server. We make HTTP requests directly from python.


In [2]:
import pandas as pd
from colupy import Asset, Holder, Colu

View metadata


In [3]:
romanian_votecoinId = 'Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4' # Romanian votecoin from bitnation
romanian_votecoin = Asset(romanian_votecoinId)

metadata = romanian_votecoin.get_metadata(use_utxo=True) #returns a dict

In [4]:
pd.DataFrame(metadata).T


Out[4]:
data
aggregationPolicy aggregatable
assetId Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4
divisibility 0
firstBlock 456384
issuanceTxid ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b3...
issueAddress 1EThyvoMMJX3veFToqC6cTC7m9mnkaZieZ
lockStatus False
metadataOfIssuence {u'assetName': u'Romanian Voting Coin', u'user...
numOfBurns 0
numOfHolders 9
numOfIssuance 1
numOfTransfers 24
sha2Issue 38b3b38c5986006efd8fa702b656315a17d64c704a9e02...
someUtxo e39e1fe509ced73fcc323dfa39c4e45fee441bf7872ca4...
totalSupply 100000000

Metdata of Issuance


In [5]:
pd.DataFrame.from_dict(metadata['metadataOfIssuence'])


Out[5]:
data
assetName Romanian Voting Coin
description Romania's first voting token created for a tra...
issuer MoodCrawler
urls [{u'url': u'https://colu-files.s3.amazonaws.co...
userData {u'meta': [{u'required': False, u'type': u'URL...

In [6]:
pd.DataFrame(metadata['metadataOfIssuence']['data']['userData']['meta'])


Out[6]:
key required type value
0 Our website False URL http://www.bitnation.ro
1 Coin value False String 1coin=1LEU

View Full Asset as dict or json


In [7]:
print romanian_votecoin.as_dict().keys()


['assetId', 'stakeholders', 'someUtxo', 'metadata']

Load asset from dictionary


In [8]:
romanian_votecoin_dict = romanian_votecoin.as_dict()

In [9]:
loaded_asset = Asset(asset_dict=romanian_votecoin_dict)
loaded_asset_dict = loaded_asset.as_dict()
for k,v in romanian_votecoin_dict.items():
    assert(v == loaded_asset_dict[k])
pd.DataFrame(loaded_asset.get_stakeholders())


Out[9]:
address amount
0 1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L 1
1 1tT5QQvgxHvqj8R9djr26VERzMBp95yVV 1
2 1KmyHAn4LbtJqykkSi8phfRZy7FMwu4zQk 12100
3 1EThyvoMMJX3veFToqC6cTC7m9mnkaZieZ 99977678
4 1PqaDThsRgrnhoNMvsrMMjGFqMfK1Z2pK1 10000
5 1Fj7vVxttXMckFdNe52P6r5puQLoWjdbkC 10
6 1GDhpN5Nar8RXdGYLC749RL9Ezy6uWJ3SR 10
7 1A323XmGXa173MxxsnzQaoVnrA6bHTanb8 155
8 1N9wT6pzDFFtEyNvp2S8Y8VrtTA3Vc5d8K 45

Save asset to file


In [11]:
romanian_votecoin.save('testdata/'+ romanian_votecoinId + '.json')

Load asset from file


In [12]:
loaded_asset = Asset(asset_file='testdata/' + romanian_votecoinId + '.json')

In [13]:
pd.DataFrame(loaded_asset.get_stakeholders())


Out[13]:
address amount
0 1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L 1
1 1tT5QQvgxHvqj8R9djr26VERzMBp95yVV 1
2 1KmyHAn4LbtJqykkSi8phfRZy7FMwu4zQk 12100
3 1EThyvoMMJX3veFToqC6cTC7m9mnkaZieZ 99977678
4 1PqaDThsRgrnhoNMvsrMMjGFqMfK1Z2pK1 10000
5 1Fj7vVxttXMckFdNe52P6r5puQLoWjdbkC 10
6 1GDhpN5Nar8RXdGYLC749RL9Ezy6uWJ3SR 10
7 1A323XmGXa173MxxsnzQaoVnrA6bHTanb8 155
8 1N9wT6pzDFFtEyNvp2S8Y8VrtTA3Vc5d8K 45

Query addresses for other assets they may hold


In [14]:
holders = pd.DataFrame(romanian_votecoin.get_stakeholders())

In [15]:
holders.address[2]


Out[15]:
u'1KmyHAn4LbtJqykkSi8phfRZy7FMwu4zQk'

In [16]:
some_romanian_votecoin_holder = Holder(holders.address[2])
assets = some_romanian_votecoin_holder.get_assets()
assets


Out[16]:
aggregationPolicy amount assetId divisibility issueTxid lockStatus blockheight blocktime used value
0 aggregatable 2500 Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4 0 ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b3... False 471258.0 1.497460e+12 False 3000.0
1 aggregatable 3000 Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4 0 ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b3... False 471258.0 1.497460e+12 False 3000.0
2 aggregatable 6500 Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4 0 ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b3... False 471258.0 1.497460e+12 False 3000.0
3 aggregatable 100 Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4 0 ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b3... False 471258.0 1.497460e+12 False 3000.0
4 aggregatable 10000000 Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap 7 ace0a57dcb78f0c82a8dcc9c5f1769fe85da04aaf61795... False 471256.0 1.497460e+12 False 3000.0
5 aggregatable 10000000 Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap 7 ace0a57dcb78f0c82a8dcc9c5f1769fe85da04aaf61795... False 471258.0 1.497460e+12 False 3000.0
6 aggregatable 100000000 Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap 7 ace0a57dcb78f0c82a8dcc9c5f1769fe85da04aaf61795... False 471258.0 1.497460e+12 False 3000.0
7 aggregatable 10000000 Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap 7 ace0a57dcb78f0c82a8dcc9c5f1769fe85da04aaf61795... False 471258.0 1.497460e+12 False 3000.0
8 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
9 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
10 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
11 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
12 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
13 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
14 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
15 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471367.0 1.497521e+12 False 3000.0
16 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471369.0 1.497523e+12 False 3000.0
17 aggregatable 10000000 La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq 7 0abc15d510e6878ed9898a1ac395028109cf03842e4458... True 471369.0 1.497523e+12 False 3000.0
18 aggregatable 10000000 Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap 7 ace0a57dcb78f0c82a8dcc9c5f1769fe85da04aaf61795... False 471544.0 1.497621e+12 False 3000.0
19 aggregatable 10000000000 Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap 7 ace0a57dcb78f0c82a8dcc9c5f1769fe85da04aaf61795... False 471544.0 1.497621e+12 False 3000.0

In [17]:
assets.assetId.unique()


Out[17]:
array([u'Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4',
       u'Ua8axurXJxWVfeJNnyBEeSYDfEC2C2Fm56hdap',
       u'La3Re3VSZa5VKSBavbryUkms6tGhXGrXE5oBdq'], dtype=object)

View Holder as dict or json


In [18]:
print some_romanian_votecoin_holder.as_json(indent=2)[:400]


{
  "address_info": {
    "utxos": [
      {
        "index": 0, 
        "used": false, 
        "assets": [
          {
            "lockStatus": false, 
            "divisibility": 0, 
            "assetId": "Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4", 
            "amount": 2500, 
            "aggregationPolicy": "aggregatable", 
            "issueTxid": "ccb25b94170f9d857a478cc48ef642e9d89bf3ba1

In [19]:
rv_holder_dict = some_romanian_votecoin_holder.as_dict()

load the holder from dict


In [20]:
loaded_holder = Holder(holder_dict = rv_holder_dict)
loaded_holder_dict = loaded_holder.as_dict()

In [21]:
loaded_holder.address


Out[21]:
u'1KmyHAn4LbtJqykkSi8phfRZy7FMwu4zQk'

Save Holder


In [22]:
loaded_holder.save('testdata/' + loaded_holder.address + '.json', indent=2)

Load holder from file


In [23]:
holder_dict = Holder(holder_file = 'testdata/' + loaded_holder.address + '.json').as_dict()

Asset Crawling

We would like to crawl the network of assets and holders, while avoiding extraneous API requrests. The Colu class provides such a high-level interface.

initialize empty colu mangager


In [24]:
colu = Colu()

In [25]:
romanian_votecoin = colu.get_asset(romanian_votecoinId, verbose = True)


getting asset for Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4

Cached assets and holders can be retrieved from Colu object. Use force to force download and refresh of asset/holder, creating a new instance.


In [26]:
assert(colu.get_asset(romanian_votecoinId, force = True, verbose = True) != romanian_votecoin)


getting asset for Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4

Get assets held by some romanian_votecoin stakeholder


In [37]:
romanian_votecoin_stakeholders = pd.DataFrame(romanian_votecoin.get_stakeholders())
romanian_votecoin_stakeholders


Out[37]:
address amount
0 1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L 1
1 1tT5QQvgxHvqj8R9djr26VERzMBp95yVV 1
2 1KmyHAn4LbtJqykkSi8phfRZy7FMwu4zQk 12100
3 1EThyvoMMJX3veFToqC6cTC7m9mnkaZieZ 99977678
4 1PqaDThsRgrnhoNMvsrMMjGFqMfK1Z2pK1 10000
5 1Fj7vVxttXMckFdNe52P6r5puQLoWjdbkC 10
6 1GDhpN5Nar8RXdGYLC749RL9Ezy6uWJ3SR 10
7 1A323XmGXa173MxxsnzQaoVnrA6bHTanb8 155
8 1N9wT6pzDFFtEyNvp2S8Y8VrtTA3Vc5d8K 45

In [38]:
romanian_votecoin_stakeholders_0 = colu.get_holder(romanian_votecoin_stakeholders.address[0])

In [39]:
romanian_votecoin_stakeholders_0.get_assets()


Out[39]:
aggregationPolicy amount assetId divisibility issueTxid lockStatus blockheight blocktime used value
0 aggregatable 1 Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4 0 ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b3... False 456978.0 1.489364e+12 False 3000.0

Iterate through manager's assets and holders


In [40]:
mycityId = u'La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT'

In [41]:
colu.get_asset(mycityId)
colu.assets.keys()


Out[41]:
[u'La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT',
 'Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4']

In [42]:
colu_dict = colu.as_dict()

In [43]:
loaded_colu = Colu(colu_dict = colu_dict)

Save/Load cached colu objects


In [44]:
colu.save('testdata/colu_save.json')

In [45]:
cat testdata/colu_save.json


{
  "holders": {
    "1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L": {
      "address_info": {
        "utxos": [
          {
            "index": 0, 
            "used": false, 
            "assets": [
              {
                "lockStatus": false, 
                "divisibility": 0, 
                "assetId": "Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4", 
                "amount": 1, 
                "aggregationPolicy": "aggregatable", 
                "issueTxid": "ccb25b94170f9d857a478cc48ef642e9d89bf3ba1d20b30e653f2e58d70415dc"
              }
            ], 
            "value": 3000, 
            "txid": "e39e1fe509ced73fcc323dfa39c4e45fee441bf7872ca4f736ba59dc21ad5ac0", 
            "blocktime": 1489363619000, 
            "blockheight": 456978, 
            "scriptPubKey": {
              "reqSigs": 1, 
              "hex": "76a914d17f0eacf7d9dd90d714832715377ddcf4fb7c6088ac", 
              "addresses": [
                "1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L"
              ], 
              "asm": "OP_DUP OP_HASH160 d17f0eacf7d9dd90d714832715377ddcf4fb7c60 OP_EQUALVERIFY OP_CHECKSIG", 
              "type": "pubkeyhash"
            }
          }
        ], 
        "address": "1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L"
      }, 
      "address": "1L6iSC3UJrXdtCrAxuN9k2wNCtDrrz5S1L"
    }
  }, 
  "assets": {
    "La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT": {
      "assetId": "La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT", 
      "stakeholders": null, 
      "someUtxo": null, 
      "metadata": null
    }, 
    "Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4": {
      "assetId": "Ua7qAZa2UQioKf4Z4KKFwgpzUug3Ztczm7YgE4", 
      "stakeholders": null, 
      "someUtxo": null, 
      "metadata": null
    }
  }
}

Load from file


In [55]:
colu = Colu(colu_file = 'testdata/colu_save.json')

In [52]:
print colu.as_json(indent = 2)[:400]


{
  "holders": {
    "14ZuogAa4TXaz2LtMz1yR3bvd8Psg6crrE": {
      "address_info": {
        "utxos": [
          {
            "index": 0, 
            "used": false, 
            "assets": [
              {
                "lockStatus": true, 
                "divisibility": 0, 
                "assetId": "La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W", 
                "amount": 1768697074, 
         

Asset Crawler example


In [57]:
colu = Colu()

In [58]:
found_assets = colu.crawl_assets([mycityId], wait = 0, verbose = True)
found_assets


La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT 5
	La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5
	La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W
	La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
	La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
	La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5 4
	La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W
	La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
	La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
	La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W 3
	LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K
	La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
	La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
	LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y
	La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K 2
	La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU
	La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
	La3uQhFA88FkbaBzdiwzNgmVFXwEGEmRe683UR
	La89T9wQhHCr8yDjfdztxyLgSUJwiJHWU6Ewmb
	Ua3jcRRHzhR3afQXCCEGFu2mocmVQBWvF524u1
	La3BAqENXEB3SYnJ8DMkijyadZi6G2rExon6iD
	Ua33z6kfXFn7gxnPsWybtT5D8BYBrrZWQKqpMc
	La8QWQffz9UdgZU6FT9X2kSXxrZJmWcXB6taVy
	La6WzDeTka5FDUX5fTt4xXvihiJ1hxaWKfrdwq
	La6zkaYNL3oh6xtuzXDZB6cFhtuTAkYvvVZWuH
	La3xNLJSDEQRmgern9CGFJQb7hHbPU5Z1BZ1bQ
	La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
	LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y
	La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU 1
	La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
	La3uQhFA88FkbaBzdiwzNgmVFXwEGEmRe683UR
	La89T9wQhHCr8yDjfdztxyLgSUJwiJHWU6Ewmb
	Ua3jcRRHzhR3afQXCCEGFu2mocmVQBWvF524u1
	La3BAqENXEB3SYnJ8DMkijyadZi6G2rExon6iD
	Ua33z6kfXFn7gxnPsWybtT5D8BYBrrZWQKqpMc
	La8QWQffz9UdgZU6FT9X2kSXxrZJmWcXB6taVy
	La6WzDeTka5FDUX5fTt4xXvihiJ1hxaWKfrdwq
	La6zkaYNL3oh6xtuzXDZB6cFhtuTAkYvvVZWuH
	La3xNLJSDEQRmgern9CGFJQb7hHbPU5Z1BZ1bQ
	La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
	LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y
	La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
Out[58]:
{u'La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W',
 u'La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU',
 u'La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT',
 u'La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5',
 u'LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K'}

In [59]:
pd.Series(list(colu._loaded))


Out[59]:
0    La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5
1    La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W
2    LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K
3    La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT
4    La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU
dtype: object

In [60]:
existing = pd.DataFrame.from_dict(colu.assets, orient='index')
existing = existing.assign(loaded = False)
existing.loc[list(colu._loaded), 'loaded'] = True
existing


Out[60]:
0 loaded
La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU <colupy.Asset instance at 0x1116033b0> True
La6zkaYNL3oh6xtuzXDZB6cFhtuTAkYvvVZWuH <colupy.Asset instance at 0x10db605f0> False
LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K <colupy.Asset instance at 0x1124ccdd0> True
La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL <colupy.Asset instance at 0x111741290> False
La3uQhFA88FkbaBzdiwzNgmVFXwEGEmRe683UR <colupy.Asset instance at 0x112d6a320> False
La89T9wQhHCr8yDjfdztxyLgSUJwiJHWU6Ewmb <colupy.Asset instance at 0x10da98518> False
Ua3jcRRHzhR3afQXCCEGFu2mocmVQBWvF524u1 <colupy.Asset instance at 0x1122fa440> False
La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W <colupy.Asset instance at 0x112a78d40> True
La3BAqENXEB3SYnJ8DMkijyadZi6G2rExon6iD <colupy.Asset instance at 0x1123f7098> False
Ua33z6kfXFn7gxnPsWybtT5D8BYBrrZWQKqpMc <colupy.Asset instance at 0x10db5af80> False
La6WzDeTka5FDUX5fTt4xXvihiJ1hxaWKfrdwq <colupy.Asset instance at 0x112d72fc8> False
La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT <colupy.Asset instance at 0x111c7f200> True
La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5 <colupy.Asset instance at 0x112d6fab8> True
La8QWQffz9UdgZU6FT9X2kSXxrZJmWcXB6taVy <colupy.Asset instance at 0x1113065a8> False
La3xNLJSDEQRmgern9CGFJQb7hHbPU5Z1BZ1bQ <colupy.Asset instance at 0x112be1a70> False
La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX <colupy.Asset instance at 0x111353dd0> False
LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y <colupy.Asset instance at 0x1127cb320> False
La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb <colupy.Asset instance at 0x1116c97a0> False

In [61]:
existing = existing.assign(search_set = False)
existing.loc[list(colu._search_set), 'search_set'] = True
existing


Out[61]:
0 loaded search_set
La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU <colupy.Asset instance at 0x1116033b0> True False
La6zkaYNL3oh6xtuzXDZB6cFhtuTAkYvvVZWuH <colupy.Asset instance at 0x10db605f0> False True
LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K <colupy.Asset instance at 0x1124ccdd0> True False
La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL <colupy.Asset instance at 0x111741290> False True
La3uQhFA88FkbaBzdiwzNgmVFXwEGEmRe683UR <colupy.Asset instance at 0x112d6a320> False True
La89T9wQhHCr8yDjfdztxyLgSUJwiJHWU6Ewmb <colupy.Asset instance at 0x10da98518> False True
Ua3jcRRHzhR3afQXCCEGFu2mocmVQBWvF524u1 <colupy.Asset instance at 0x1122fa440> False True
La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W <colupy.Asset instance at 0x112a78d40> True False
La3BAqENXEB3SYnJ8DMkijyadZi6G2rExon6iD <colupy.Asset instance at 0x1123f7098> False True
Ua33z6kfXFn7gxnPsWybtT5D8BYBrrZWQKqpMc <colupy.Asset instance at 0x10db5af80> False True
La6WzDeTka5FDUX5fTt4xXvihiJ1hxaWKfrdwq <colupy.Asset instance at 0x112d72fc8> False True
La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT <colupy.Asset instance at 0x111c7f200> True False
La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5 <colupy.Asset instance at 0x112d6fab8> True False
La8QWQffz9UdgZU6FT9X2kSXxrZJmWcXB6taVy <colupy.Asset instance at 0x1113065a8> False True
La3xNLJSDEQRmgern9CGFJQb7hHbPU5Z1BZ1bQ <colupy.Asset instance at 0x112be1a70> False True
La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX <colupy.Asset instance at 0x111353dd0> False True
LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y <colupy.Asset instance at 0x1127cb320> False True
La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb <colupy.Asset instance at 0x1116c97a0> False True

We should know the holders of the loaded assets. The holders of the search set assets should be unknown. Assets of the holders should be known.

Let's learn about the assets we found


In [62]:
for assetId, asset in colu.assets.items():
    print assetId
    metadata = asset.get_metadata(use_utxo=True, force = False)
    print metadata['metadataOfIssuence']['data']['description']
    print pd.Series(metadata)
    print pd.DataFrame.from_dict(metadata['metadataOfIssuence']), '\n'


La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU
Each unit represents one share of Orange Inc.
aggregationPolicy                                          aggregatable
assetId                          La7FEMgtMFMkDyqfVnkpbPSsFP7gMXMYnhQJhU
divisibility                                                          3
firstBlock                                                       412296
issuanceTxid          67856e106e3967c7539c39b8cb31a43dbe86204ce2d1d4...
issueAddress                         16Vjj9yua23FjedVZsQ5FbdMyR4xJGxXfs
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'Shares in Mycelium ...
numOfBurns                                                            0
numOfHolders                                                          3
numOfIssuance                                                         1
numOfTransfers                                                        7
sha2Issue             f2fb42d03169e2041ff65333e875b0325780705a915186...
someUtxo              08f5af30a6c8347e5dd369f0fd5bb1fe8fa448f94866b3...
totalSupply                                                     1000000
dtype: object
                                                          data
assetName                              Shares in Mycelium Test
description      Each unit represents one share of Orange Inc.
issuer                                                Mycelium
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'Arr... 

La6zkaYNL3oh6xtuzXDZB6cFhtuTAkYvvVZWuH
A piece of the future
aggregationPolicy                                          aggregatable
assetId                          La6zkaYNL3oh6xtuzXDZB6cFhtuTAkYvvVZWuH
divisibility                                                          5
firstBlock                                                       414348
issuanceTxid          9e6e20a9263679dc31d719eaf94861df4b411cc03372a4...
issueAddress                         1HDiNM7khVxNTiMJKcYvkd4H7THFUU89Kb
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'CryptoMaxxx Coin', ...
numOfBurns                                                            0
numOfHolders                                                          2
numOfIssuance                                                         1
numOfTransfers                                                        3
sha2Issue             2e12c02c3c8f889e7cc3374129a38daa5400403a9ff610...
someUtxo              da4cb2d1c1af44fa8f774ccc5c3d6e92be17c4c1ef322b...
totalSupply                                               2100000000000
dtype: object
                                                          data
assetName                                     CryptoMaxxx Coin
description                              A piece of the future
issuer                                             CryptoMaxxx
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'URL... 

LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K
Mycelium Wallet Tokens are a software product created, stored, and distributed to the Participant by means of the bitcoin blockchain as colored coins, granting the SARs related to Mycelium SIA. Token is not a security, is not listed, authorized, issued or traded on any regulated market. All rights derived from Tokens are subject to the terms of this Agreement. The Nominal Value of one Token equals one BTC during the Sale Event. Token is divisible just as bitcoin is. All the Tokens issued represent 5 % of Mycelium Wallet.
aggregationPolicy                                          aggregatable
assetId                          LaA8aiRBha2BcC6PCqMuK8xzZqdA3Lb6VVv41K
divisibility                                                          7
firstBlock                                                       413702
issuanceTxid          5babce48bfeecbcca827bfea5a655df66b3abd529e1f93...
issueAddress                         1K5zZeXeYQndyNLh6RFZNNeEZLSnrqNxb1
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'userData': {u'meta': [{u'type': u...
numOfBurns                                                            0
numOfHolders                                                        883
numOfIssuance                                                         1
numOfTransfers                                                      228
sha2Issue             18f505b4980fc3c2ec6e679be1e37e474ac83cc80ae5e8...
someUtxo              6183a7c90b176a7c7b051b48ac8baa73f93c5c0f296481...
totalSupply                                                 53110000000
dtype: object
                                                            data
assetName                                         Mycelium Token
description    Mycelium Wallet Tokens are a software product ...
issuer                                                  Mycelium
urls           [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData       {u'meta': [{u'type': u'URL', u'value': u'https...
verifications  {u'domain': {u'url': u'https://mycelium.com/as... 

La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
Our community coin to support SMB's and local economy.
aggregationPolicy                                          aggregatable
assetId                          La9J7tS8RNL9psAnQCS1J3cTQqD7Mk41kbrnzL
divisibility                                                          2
firstBlock                                                       412345
issuanceTxid          38eed35df12950cd2775ff392cb80d56b1ea2d4506a217...
issueAddress                         12DipN8qSKzFU9DDZBpY2CPaDatoS8b4vU
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'Bitcoin3', u'userDa...
numOfBurns                                                            0
numOfHolders                                                         10
numOfIssuance                                                         1
numOfTransfers                                                      415
sha2Issue             8b3510e7ef28be64fb22cfc5821e34134d9554a55b06ca...
someUtxo              a908728dd5be8f89eacc260e1cf871948dd1aff3bbd8f8...
totalSupply                                             100000000000000
dtype: object
                                                          data
assetName                                             Bitcoin3
description  Our community coin to support SMB's and local ...
issuer                                                    Logo
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'URL... 

La3uQhFA88FkbaBzdiwzNgmVFXwEGEmRe683UR
Each unit represents one share in BitDog & Co
aggregationPolicy                                          aggregatable
assetId                          La3uQhFA88FkbaBzdiwzNgmVFXwEGEmRe683UR
divisibility                                                          5
firstBlock                                                       428447
issuanceTxid          5ead3f973fb5ce4f6dda3e280725051dad592ba6ae4adc...
issueAddress                         13hc5E8BD8rGY7g9pYWjmRKNpuhA3spjw4
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'BitDog & Co', u'use...
numOfBurns                                                            0
numOfHolders                                                          2
numOfIssuance                                                         1
numOfTransfers                                                        1
sha2Issue             1ee5f86d059cc16d057b4dc46f6c3d5c2239b4ea4086f9...
someUtxo              98750f2ae22351e8067bd6607f210af1d1ed988aed418f...
totalSupply                                                100000000000
dtype: object
                                                          data
assetName                                          BitDog & Co
description      Each unit represents one share in BitDog & Co
issuer                                                    None
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'Arr... 

La89T9wQhHCr8yDjfdztxyLgSUJwiJHWU6Ewmb
In our local community, you can earn a coin by working for an hour in one of a designated list of required jobs. Many of our local stores and service providers accept these coins and will redeem them for goods and services
aggregationPolicy                                          aggregatable
assetId                          La89T9wQhHCr8yDjfdztxyLgSUJwiJHWU6Ewmb
divisibility                                                          0
firstBlock                                                       413282
issuanceTxid          ef3c158255296b029efdf699a2b7b36ea8c751a4a38ea5...
issueAddress                         1LwkoH4mc9gtT95UgCVwTGkv7wtzufcXRe
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'time coin', u'userD...
numOfBurns                                                            0
numOfHolders                                                          1
numOfIssuance                                                         1
numOfTransfers                                                        1
sha2Issue             ac6d05c6e1ebc0d414d9e7fe14679baad56b4dd8791f65...
someUtxo              e6261bfa13372eafebec737e98441303392eb90f6e636f...
totalSupply                                                           1
dtype: object
                                                          data
assetName                                            time coin
description  In our local community, you can earn a coin by...
issuer                                                    None
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'Str... 

Ua3jcRRHzhR3afQXCCEGFu2mocmVQBWvF524u1
A piece of the future
aggregationPolicy                                          aggregatable
assetId                          Ua3jcRRHzhR3afQXCCEGFu2mocmVQBWvF524u1
divisibility                                                          5
firstBlock                                                       414197
issuanceTxid          0a7bb8b7a3f0c10572ed719cf2ebd42427dbd911ffc291...
issueAddress                         12p5VsmS3prksmve89bw2enbTwkBApNvZQ
lockStatus                                                        False
metadataOfIssuence    {u'data': {u'assetName': u'CryptoMaxx Coin', u...
numOfBurns                                                            0
numOfHolders                                                          1
numOfIssuance                                                         2
numOfTransfers                                                        1
sha2Issue             170d9a0912650f06137b66c1f22e40d841f16a2cd451ae...
someUtxo              775c293c66d7e0f8140b7535c2cf3ccaf085b95081ea18...
totalSupply                                               9000000000000
dtype: object
                                                          data
assetName                                      CryptoMaxx Coin
description                              A piece of the future
issuer                                                   Jared
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'URL... 

La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W
Mass Coin is a digital currency required to access the services provided by the Mass Network. Mass Network is software for consumers, webmasters, advertisers and their agents, SSP, DSP and data management platforms. The founding goal is to create a convenient and fair marketplace for all, giving Internet users their share of the value created by them. This platform incorporates a frictionless, secure, and verifiable blockchain based payment system. Mass makes every internet user an interested party in these relations and improves consumer attitudes towards ads and publishers. Mass will make advertising much more efficient to the benefit of all parties involved. Mass Network will not hold a second emission of Mass Coin, its new sale, or offering of any sort. The price of Mass Coin is determined only by the market forces. Mass Coin can be freely traded on exchanges or privately.
aggregationPolicy                                          aggregatable
assetId                          La4szjzKfJyHQ75qgDEnbzp4qY8GQeDR5Z7h2W
divisibility                                                          0
firstBlock                                                       441663
issuanceTxid          ff3a31bef5aad630057ce3985d7df31cae5b5b91343e62...
issueAddress                         16rNecD1B5KjJF3PDqu2JGSw93WpdhLUZH
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'userData': {u'meta': [{u'type': u...
numOfBurns                                                            0
numOfHolders                                                        427
numOfIssuance                                                         1
numOfTransfers                                                      408
sha2Issue             5ecf15bf0515cf200052c7418dd5b7426c812e74d02a6c...
someUtxo              03789d1417ac1f744a37766e1593ea0059380f2cabb8b2...
totalSupply                                               1000000000000
dtype: object
                                                            data
assetName                                              Mass Coin
description    Mass Coin is a digital currency required to ac...
issuer                                                      Mass
urls           [{u'url': u'https://colu-files.s3.amazonaws.co...
userData       {u'meta': [{u'type': u'URL', u'value': u'https...
verifications  {u'domain': {u'url': u'https://mass.network/as... 

La3BAqENXEB3SYnJ8DMkijyadZi6G2rExon6iD

aggregationPolicy                                          aggregatable
assetId                          La3BAqENXEB3SYnJ8DMkijyadZi6G2rExon6iD
divisibility                                                          1
firstBlock                                                       413702
issuanceTxid          b66a5cf8600f76f31d86800eccc6101d49048eb713c575...
issueAddress                         1EMsmBVv59jtTCxegfmWGM3Bbv8HXoxvwD
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'userData': {u'meta': []}, u'descr...
numOfBurns                                                            0
numOfHolders                                                          2
numOfIssuance                                                         1
numOfTransfers                                                        1
sha2Issue             3b2da5018c5bb898e507ba1f3766ca3b2035c08b478307...
someUtxo              bd2450ed92de69d8bb5f156a95ec2705eec8ef8585b64a...
totalSupply                                                       10000
dtype: object
                                                            data
assetName                                            test token2
description                                                     
issuer                                                  Mycelium
urls                                                          []
userData                                           {u'meta': []}
verifications  {u'domain': {u'url': u'https://mycelium.com/as... 

Ua33z6kfXFn7gxnPsWybtT5D8BYBrrZWQKqpMc
Each unit represents one share of PUBLI8, a virtual FX Hedge Fund that uses high risk methods, such as investing with borrowed money, in hopes of realizing large capital gains.
aggregationPolicy                                          aggregatable
assetId                          Ua33z6kfXFn7gxnPsWybtT5D8BYBrrZWQKqpMc
divisibility                                                          2
firstBlock                                                       415893
issuanceTxid          d639cd21c1c153e1048aaf8f723b4db0f839f186be86b9...
issueAddress                         1G6B95KQfoxgGGGPDQGf2oFrWZQU5sHTj2
lockStatus                                                        False
metadataOfIssuence    {u'data': {u'assetName': u'PUBLI8', u'userData...
numOfBurns                                                            0
numOfHolders                                                          1
numOfIssuance                                                         1
numOfTransfers                                                        2
sha2Issue             94f29b3a35419d6f221e5b1e3f2c9178a7ebe52ce8435d...
someUtxo              1ec90c8c8255d610a17ab44782b5822735b0606c7d3696...
totalSupply                                                      300000
dtype: object
                                                          data
assetName                                               PUBLI8
description  Each unit represents one share of PUBLI8, a vi...
issuer                                                      Na
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'Arr... 

La6WzDeTka5FDUX5fTt4xXvihiJ1hxaWKfrdwq
The location and of the planet Xelodan came to oracle and musician "Jupiter" in a dream on 4.20.16 and he returned via astral travel to instill a multi-dimentional land claim upon it. 

Planet specifications are unknown. 
aggregationPolicy                                          aggregatable
assetId                          La6WzDeTka5FDUX5fTt4xXvihiJ1hxaWKfrdwq
divisibility                                                          7
firstBlock                                                       413442
issuanceTxid          e150a3674acc652f728a507c6d633f6ba2ea0b4bf7b327...
issueAddress                         1FmdCugUGYxnUnp37BQBUfo2bn1xkyJvUd
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'userData': {u'meta': [{u'required...
numOfBurns                                                            0
numOfHolders                                                          2
numOfIssuance                                                         1
numOfTransfers                                                        1
sha2Issue             6204bf88c0449c21356bb339169d461a4813a94302613c...
someUtxo              1cab8961c62afbddc5b4c79300eb6f3eb963e3709f2243...
totalSupply                                           10000000000000000
dtype: object
                                                            data
assetName                           Ownership of planet Xelodan 
description    The location and of the planet Xelodan came to...
issuer                                                   Jupiter
urls           [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData       {u'meta': [{u'required': False, u'type': u'URL...
verifications  {u'social': {u'twitter': {u'username': u'jupit... 

La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT
Our community coin to support SMB's and local economy.
aggregationPolicy                                          aggregatable
assetId                          La8Hvi9QSWxH7gr6ofdi6JefUSjm2djoBxv7VT
divisibility                                                          2
firstBlock                                                       412199
issuanceTxid          57401d6484f3db9c4f983b674ba4df5c085efbab34c743...
issueAddress                         14oTrfmpHfLYVe1heppv59QWm7xGdZvzxS
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'MyCity', u'userData...
numOfBurns                                                            0
numOfHolders                                                         30
numOfIssuance                                                         1
numOfTransfers                                                     2354
sha2Issue             54d658599dd9410551f218d1e01b96ac9abe683d8f410c...
someUtxo              2e77796e9b3ca32bee6ed8ad0e761b5ad6c95ca037c2d8...
totalSupply                                              10000000000000
dtype: object
                                                          data
assetName                                               MyCity
description  Our community coin to support SMB's and local ...
issuer                                                 abedbbd
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'URL... 

La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5
Our community coin to support SMB's and local economy.
aggregationPolicy                                          aggregatable
assetId                          La9JCeqVMe5TGUDBEuXmjAq3SSKziCsswUgxa5
divisibility                                                          2
firstBlock                                                       412418
issuanceTxid          b2225d039edfe4865754c926fcd32cbe81e0c95b4df775...
issueAddress                         1N59AApyEakJvKWTzn8ETocsNrq5i4qvzb
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'Mysol', u'userData'...
numOfBurns                                                            0
numOfHolders                                                          9
numOfIssuance                                                         1
numOfTransfers                                                      403
sha2Issue             96ac57edfc01760094dc93606b03dfeb2f91af44c8029b...
someUtxo              a1beb8d70e76303b753e62e5d159c278aace8529d8ebac...
totalSupply                                                 10000000000
dtype: object
                                                          data
assetName                                                Mysol
description  Our community coin to support SMB's and local ...
issuer                                                    Logo
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'URL... 

La8QWQffz9UdgZU6FT9X2kSXxrZJmWcXB6taVy
In our local community, you can earn a coin by working for an hour in one of a designated list of required jobs. Many of our local stores and service providers accept these coins and will redeem them for goods and services
aggregationPolicy                                          aggregatable
assetId                          La8QWQffz9UdgZU6FT9X2kSXxrZJmWcXB6taVy
divisibility                                                          0
firstBlock                                                       414423
issuanceTxid          bc365498f24e4ca992f06596ee1ee9b1638f3962bc451b...
issueAddress                         1BoFfghYZ5epbnoXACHYcVXGcjRcj6qzQA
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'time coin', u'userD...
numOfBurns                                                            0
numOfHolders                                                          1
numOfIssuance                                                         1
numOfTransfers                                                        0
sha2Issue             67fc8984bd5eac495273003de316f3990f22c543c62cd8...
someUtxo              bc365498f24e4ca992f06596ee1ee9b1638f3962bc451b...
totalSupply                                                           2
dtype: object
                                                          data
assetName                                            time coin
description  In our local community, you can earn a coin by...
issuer                                                    none
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'Str... 

La3xNLJSDEQRmgern9CGFJQb7hHbPU5Z1BZ1bQ
Each unit represents one share of Orange Inc.
aggregationPolicy                                          aggregatable
assetId                          La3xNLJSDEQRmgern9CGFJQb7hHbPU5Z1BZ1bQ
divisibility                                                          0
firstBlock                                                       413238
issuanceTxid          bf59fa1a7eaab6cf1dc31dd1389e21649010819c858ae3...
issueAddress                         1FL7pUPhBzDBLoztKjKobEpeaQzzZ6Nvcx
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'Shares in Orange In...
numOfBurns                                                            0
numOfHolders                                                          1
numOfIssuance                                                         1
numOfTransfers                                                        0
sha2Issue             249155db78ea5a983c9acd9bfb944b794696ce15467a9f...
someUtxo              bf59fa1a7eaab6cf1dc31dd1389e21649010819c858ae3...
totalSupply                                                           1
dtype: object
                                                          data
assetName                                Shares in Orange Inc.
description      Each unit represents one share of Orange Inc.
issuer                                              Individual
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'Arr... 

La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
Our community coin to support SMB's and local economy.
aggregationPolicy                                          aggregatable
assetId                          La8bnvrAKGczPPFEX3xUGV5wTzaAmpC56yQcVX
divisibility                                                          2
firstBlock                                                       412359
issuanceTxid          81bffa99cb7456d5e809aca786bcb7a2c57643faac2a1c...
issueAddress                         19VciUDBvpjA8M8Twc38Ki9W5vvy4qcamh
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'MyBitcoin', u'userD...
numOfBurns                                                            0
numOfHolders                                                         16
numOfIssuance                                                         1
numOfTransfers                                                      602
sha2Issue             07eccc9cf45ae1ead689d734f6a5e9e43d6f4229d9436c...
someUtxo              ec3f6e4c0db501221eb914997a6eef1baf51841446269a...
totalSupply                                                   100000000
dtype: object
                                                          data
assetName                                            MyBitcoin
description  Our community coin to support SMB's and local ...
issuer                                             HJBSFHGKASD
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': False, u'type': u'URL... 

LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y

aggregationPolicy                                          aggregatable
assetId                          LaAUkuxoviT8FSQVFgM9kBmpgYTPKgMm36ML9y
divisibility                                                          0
firstBlock                                                       444291
issuanceTxid          ae13b976010becee7c789c9227edd90f59b3542284363c...
issueAddress                         1Fazzqj3rqTEwx5XRFrkNDUftf1YwjqQA4
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'ColuTest', u'userDa...
numOfBurns                                                            0
numOfHolders                                                          2
numOfIssuance                                                         1
numOfTransfers                                                        1
sha2Issue             da00336e3c78ca582afa7fbae20985cc9e00e7792d5aea...
someUtxo              5dbce74d5fc56cb40042902a396ac4f4542fb4d8e171a3...
totalSupply                                                        5000
dtype: object
                                                          data
assetName                                             ColuTest
description                                                   
issuer                                                     Udi
urls                                                        []
userData     {u'meta': [{u'type': u'String', u'value': u'',... 

La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
Each unit is worth 1 ounce of gold
aggregationPolicy                                          aggregatable
assetId                          La5Arwe6PGVSJgMFfe9rWB4fUDo6zXTZvDf1Xb
divisibility                                                          2
firstBlock                                                       411717
issuanceTxid          30b4f19275c59e32034196b89dbc19b97e2a629e4b669a...
issueAddress                         18FrEoxdjPNCmUqncW5sLinyWCR8pR2ED2
lockStatus                                                         True
metadataOfIssuence    {u'data': {u'assetName': u'DGX', u'userData': ...
numOfBurns                                                            0
numOfHolders                                                          9
numOfIssuance                                                         1
numOfTransfers                                                      284
sha2Issue             09305d3fc26faf294e808b2905c541331c4d44ba588be8...
someUtxo              3e1a687d2778391df737a618d738b6ce856310ad844e5d...
totalSupply                                           10000000000000000
dtype: object
                                                          data
assetName                                                  DGX
description                 Each unit is worth 1 ounce of gold
issuer                                             HJBSFHGKASD
urls         [{u'url': u'https://s3-us-west-2.amazonaws.com...
userData     {u'meta': [{u'required': True, u'type': u'Stri... 


In [63]:
holder0 = colu.holders['17cXQREyFVBiKoh4TdPozWDn5D4ounheK8']

In [64]:
len(holder0.get_assets())


Out[64]:
1

In [65]:
# mycity_search.save('mycity_search.json')

# colu = Colu(colu_file='mycity_search.json')

In [66]:
colu.get_asset_graph(min_assets=2)

In [67]:
colu.weight_assets(min_assets=2)

Visualization!

Now for the fun part. We have crawled just 5 assets from the initial 'mycity' asset. Now we want to visualize all the holders and see which assets are shared between them. For this we use two very powerful tools:

  • networkx
  • plotly

first add all the known assets

Connect all the assets to their respective holders

Add edges connecting assets with their holders, weighted by the amount held? This will draw big holders relatively closer to their assets, but there's some kind of pareto distribution that makes this ugly.


In [69]:
mycity_asset = colu.get_asset(mycityId)

#  (<br>), bold (<b></b>), italics (<i></i>), hyperlinks (<a href='...'></a>). Tags <em>, <sup>, <sub> <span> 

def get_issuance_HTML(asset):    
    issuance = asset.get_metadata()['metadataOfIssuence']['data']
    asset_name = issuance['assetName']
    asset_url = issuance['userData']['meta'][0]['value']
#     asset_value = issuance['userData']['meta'][0]
    
    return dict(name = '<b>' + asset_name + '</b>', 
                issuance = issuance)

get_issuance_HTML(mycity_asset)['name']


Out[69]:
u'<b>MyCity</b>'

In [70]:
# Assign weights by holder

2D layout


In [71]:
import plotly
plotly.offline.init_notebook_mode() # run at the start of every ipython notebook



In [72]:
import networkx as nx
import plotly
from plotly.offline import iplot, plot
from plotly.graph_objs import Scatter, Line, Marker, Figure, Data, Layout, XAxis, YAxis, Scattergl
from textwrap import wrap


def graph_assets(self, title_assetId, layout_fn = nx.spring_layout, layout_kwargs = {}):
    title_asset = self.get_asset(title_assetId)
    
    asset_list = []
    for node in self.graph.nodes():
        if self.graph.node[node]['isasset']:
            asset_list.append(node)
    
    pos=nx.spring_layout(self.graph,weight=None, scale=.002)
    pos=nx.spring_layout(self.graph,pos = pos, fixed = asset_list, scale = .002)

    edge_trace = Scatter(
        x=[],
        y=[],
        name = 'ownership',
        line=Line(width=0.5,color='#888'),
        hoverinfo='none',
        mode='lines')

    for edge in self.graph.edges():
        x0, y0 = pos[edge[0]]
        x1, y1 = pos[edge[1]]
        edge_trace['x'] += [x0, x1, None]
        edge_trace['y'] += [y0, y1, None]

    asset_trace = Scatter(
        x=[],
        y=[],
        text=[],
        name = 'Assets',
        mode='markers',
        hoverinfo='text',
        marker=Marker(
    #         showscale=True,
            symbol = 'square',
            colorscale='YIGnBu',
            reversescale=True,
            color=[],
            size=25,
            line=dict(width=2)
        )
    )

    holder_trace = Scatter(
        x=[],
        y=[],
        text=[],
        name = 'Holders',
        mode='markers',
        hoverinfo='text',
        marker=Marker(
#             symbol = 'circle',
            colorscale='YIGnBu',
            reversescale=True,
            color=[],
            size=15,
            line=dict(width=1)))

    for node in self.graph.nodes():
        x, y = pos[node]
        if self.graph.node[node]['isasset']:
            asset_trace['x'].append(x)
            asset_trace['y'].append(y)
        else:
            holder_trace['x'].append(x)
            holder_trace['y'].append(y)


    for node_number, adjacencies in enumerate(self.graph.adjacency_list()):
        nodeId = self.graph.nodes()[node_number]
        node_info = '<b>' + nodeId + '</b><br>'

        if self.graph.node[nodeId]['isasset']: 
            asset_trace['marker']['color'].append(len(adjacencies))
            node_info = node_info + '# of holders: '+str(len(adjacencies)) + '<br>'
            metadata = self.assets[nodeId].get_metadata()
            if metadata.has_key('metadataOfIssuence'):
                description = metadata['metadataOfIssuence']['data']['description']
                node_info = node_info + '<br>'.join(wrap(description, 50))
            asset_trace['text'].append(node_info)
        else:
            num_assets = len(self.holders[nodeId].get_assets())
            node_info = node_info + '# of assets: '+ str(num_assets)
            holder_trace['text'].append(node_info)
            asset_trace['marker']['color'].append(num_assets)

    fig = Figure(data=Data([edge_trace, asset_trace, holder_trace]),
                 layout=Layout(
                    title='Colored Coins Asset Graph for: ' + 
                        get_issuance_HTML(title_asset)['name'] +
                        '<br>' + title_asset.assetId,
                    titlefont=dict(size=16),
                    showlegend=True,
                    hovermode='closest',
                    margin=dict(b=20,l=5,r=5,t=40),
                    xaxis=XAxis(showgrid=False, zeroline=False, showticklabels=False),
                    yaxis=YAxis(showgrid=False, zeroline=False, showticklabels=False)))
    return fig

In [74]:
plot(graph_assets(colu,mycityId, layout_fn=nx.spring_layout))


Out[74]:
'file:///Users/apembrok/Projects/colupy/temp-plot.html'

Todo:

  • Figure out why the asset nodes are not showing up
  • Use unweighted spring layout to initial positions, and fix asset positions