Could any of you tell me how DAML on Fabric data are encoded?

This is the ChaincodeArgs part of a transaction. I tried to Base64 decode the data, but nothing intelligible came out of it.

ChaincodeArgs	
0	"[blob:THHWvJqRO/R5]"
1	"[blob:H4sIAAAAAAAAAAGYAGf/CAUQARgBIo8BH4sIAAAAAAAAAOPi4WjZPPMXq0DD6VurGKXyuJy5WB1TcjPzhFSMjdMsEo0sLXXNDJMNdE1MLFJ0k5KNzXXTjAwTDZJNzMyM0wyk2NLy85MSi7SAxlybBzJm0bxuRil1LlWX0oKczOTEklTv1EorBef8vJKixOQSBSBPIS+/RKE0L7OwNBUA5u7gfH4AAAA622qFmAAAAA==]"
2	"[blob:H4sIAAAAAAAAAK1SaVRTZxq+iQkEolQYBEZ6oEKAopAgghubstWQsFjQYUwQbpJLiNkguSEEl5YyxTCgYZwiiCCF6EFZigGxhkaBsgla6gANuFHqAgrhiEUJSMQmQAunp7P8mPvru+95vud9lq96AkALBYAHnc/FM0AuBx8K0gQsehQogFl0VjLIg6NhEIZwQXwulwVHi2hcllDI4vNcN+S5v1JDB5EAkgwYQzxYICEyYCCUrCciGIgIHIjBhASE5GUmgtBARWCnimAWR0gI1qNIi2ec4UzmM0MWeXzIAAbipUIcfjIEAx8scDL5fCYHIiQL+DCfJkokBEpgKBoWsHhMn7RkvYNtBgeLIPyvIPxHEA8S6HcywiGhEGRCZJbeSjQkYIEcVjrECOULuMDShwRWUQBjUGjgFcIAkhJIBlZzF68FcUChfmZOPgSmggQOyGMSFkZ6nWtXQiJArl6vxQrYbwpFAgNl9ZT1jBEmZhgJAGnJ+qVYUxNyilpV9A+fV5JUARD8WwuL4eFXhIdfCA+/FB7+34e3bAgZCKzjQly+wSpRSOSx4CXfC/EugONTgGMAMk0AOP8v8e3fssSNQAIIMrBGxGPz+GJeKAviMPT5OP1hUftWgKIhWJ8F/P8x+uuz/b3q5ZeBM/QtADnLkxX6KQCaZujakABan4D7f+OCwMTl3+ZV203jb012GpoUAHb/+a5DhWOWZyl7Vr+VCK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tS8TMq6GnlF/dG0bjrrlupiZEmhIm29J7HUJdiauKGQ9eySclKed7LbrpyX30Yd15zvDHOdgl9PUvq6jLU3aQPYh8bP4UBo7ttBTcGbey3vBdxXXRc9uS42U820ZQ/01RT4v/n5LPvxzA8FMt2r+y/Edm/B1/Mecbqr7MZ64T3zBAWS3aQp1s1VlOQE/GW+tNvKvpa86cpMApT+7t29nxSsF4Onb43C471T6ZDiMH3g+RZ+cZyv/8Tc6PTLYy/7j7x7oJ6ebZ9nNRCyB4WPhrJh7ahdwPHaWjL/e6emHXFFByWTGU2DCglHkf5zt+T6tatzT55OMddZy8g+B7FabbxmiqSK1z48e20HdzvhguWqAPURs5TggMbzjW9vyxFTOtNyu8QAzE1m5dydiv1dwy9sYr5nxPuKX/TH6SqixdyvuXxhU3Laj60Dn6hmB8bm2aUPjoif5sUfPfa4tKrVuOn+zGyH/eFIP6Vo5EzF1hv+kxMj/6I03dj4oyyS/8mFgjHr2kdNQ+9s96tdv54zBoBfAH3+Vl8pCAAA]"
2 Likes

Hi Gyorgy - it’s intentionally an opaque blob; don’t rely on it. The DAML APIs are the only way to access the contents. (It’s not encrypted either, just treat it like a proprietary binary format.)

To make it human-readable, you can try the Navigator.

Cheers

Tim

2 Likes

That’s interesting, does that mean that we can treat this feature a privacy guarantee, an alternative to Fabric’s private data collection?

Unfortunately not as it isn’t encrypted. (It’s private like a binary .doc file is private if you haven’t got a copy of MS Word.) In this case you could grab the DAML open source repo and reverse engineer the format if you wanted to (I don’t suggest doing that, it wouldn’t be fun!)

1 Like

@gyorgybalazsi to give a bit more color on the reason this is encoded as an opaque blob, some of our design goals were:

  1. Protect DAML users from getting locked in to a single technology, i.e. allow them to port their applications across databases / distributed ledgers
  2. Allow DAML and the underlying ledger technologies to evolve independently, i.e. make sure each has a very clear and clean interface

By encoding the DAML-LF data as opaque blobs we ensure the developers of the underlying platform and the integration don’t make any implicit assumptions about DAML, and the developers of DAML don’t make any implicit assumptions about the underlying platform. Goal (1) is achieved because the underlying platform is unaware of the DAML data, making ensuring that the Ledger API is your sole interface into DAML based applications. Goal (2) is achieved because the abstraction sets a clear interface between DAML concerns and ledger concerns, so each can evolve independently.

2 Likes

Yas, that makes sense, I guess this means that let’s say on Corda DAML-LF data is encoded the same way

Ok, thanks, I guess this means that the assertion that the only way to access the data is the API is not strictly true because as you write theoretically anyone can teverse engineering the encoding

Yes, we aren’t trying to make it impossible to reverse engineer. But the barrier is high enough that you probably know what you’re doing if you try to deserialize the blobs yourself :slight_smile:

2 Likes