Multichain Explorer server error

+5 votes

Hi all,

I have 2 assets on my chain, when I try to view one of them there is no problem, but when I try to view the other I get this error from Multichain explorer.

Traceback (most recent call last):

  File "/usr/lib64/python2.7/wsgiref/", line 85, in run

    self.result = application(self.environ, self.start_response)

  File "/home/demo/multichain-explorer/Mce/", line 349, in __call__

    tvars['body'] = flatten(page['body'])

  File "/home/demo/multichain-explorer/Mce/", line 4018, in flatten

    return ''.join(map(flatten, l))

  File "/home/demo/multichain-explorer/Mce/", line 4018, in flatten

    return ''.join(map(flatten, l))

  File "/home/demo/multichain-explorer/Mce/", line 4023, in flatten

    return l.decode('unicode-escape')

UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 0: \ at end of string - - [28/Jul/2017 10:22:55] "GET /FundPlaces/assetref/1884-1385-19420 HTTP/1.1" 500 59

Not sure why this is happening. Does anyone have any idea?

asked Jul 28, 2017 by Steven Chan
Hmmm... is it possible you're using some non-English letters in your asset names? This is legal from MultiChain's perspective but might be tripping up the Explorer.
For asset names we use md5 hashes could it be the metadata?
Yes, it could be. Does that contain non-ASCII characters?

This is the asset issuance metadata. I got it from viewing transactions. It's basically JSON encoded data where everything is a string. It should not have any non ascii characters. This is the metadata

This is where the server error occurs:

Hi Multichain or anyone else,

I really need the explorer to work, can you help me to get this working?

3 Answers

+1 vote
Are you adding an array of chars to issue details? or is python doing something here?

In mine details of issuefirst I have

"details": {
                "PublishedDate": "xxx",
                "Price": "xxx"

  "issue": {
    "details": {
      "0": "{",
      "1": """,
      "10": "n",

... etc
answered Aug 3, 2017 by MaSsv
0 votes
We need to look into why the Explorer is failing on this, but in general it looks like you're adding your metadata in a very strange way. You have a large object with integers as field name and individual characters as field values. Instead you should put the entire JSON structure you want to store as a string in a single field. I'm guessing the problem in the Explorer is that a field name contains an integer, so if you do this it should solve the problem.
answered Aug 3, 2017 by MultiChain
+1 vote

Hi all,

Just to square the circle, yes, there were some errors in the way I was storing the metadata (double json encode). However, since the chain is "live", I'm not able to change the metadata.

Therefore, I made a small tweak to the codebase of the multichain explorer to basically catch the exception and return an empty string instead:

   4016 def flatten(l):
   4017     if isinstance(l, list):
   4018         try:
   4019             return ''.join(map(flatten, l))
   4020         except:
   4021             return '';
answered Aug 14, 2017 by StevenChan