Seems it’s the only way in your case as you try to store username/password into ledger. This involves private data which may complicate the chaincode design and operation.

Another thought is that whether it is good to keep state data“encrypted”. I agree your point that it helps protecting against database attack. But my thought is more whether blockchain ledger should keep such critical information. It’s always a good debate what to be stored in the ledger. My intent is to avoid putting privacy-concern data into ledger. Rather use ledger to provide protection for off-chain data (e.g. hash, or signature). Majority of data should be sharable and transparent to participating organizations, while a few data may be protected using data privacy, rather than using encryption. Just my thought. No right or wrong.



Written by

Happy to share what I learn on blockchain. Visit for my works. or reach me on

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store