How does a chain node get the raw data from another node when ATTRIB transaction ?
in ATTRIB transaction:
raw (sha256 hash string; mutually exclusive with hash and enc): Hash of the raw attribute data. Raw data is represented as JSON, where the key is the attribute name and the value is the attribute value. The ledger only stores a hash of the raw data; the real (unhashed) raw data is stored in a separate attribute store.
so, how does a chain node get the raw data from another node when ATTRIB transaction ? if needn't, then the separate attribute store in different node will differ ?
thanks!
It sounds from some of the words in the question that you are assuming Indy behaves like Ethereum, where local nodes have to replicate some or all of the blockchain. This is not the case.
Clients of Indy don't have to have any blockchain data locally. They are not called "nodes" at all. The only "nodes" in Indy are the ones that participate in consensus, and the consensus algorithm automatically causes all transaction data to be replicated to other nodes. When a client asks for an ATTRIB transaction to be written to the ledger, several nodes typically find out about that request (Indy SDK broadcasts the request to about 1/3 of the nodes that are part of consensus). These nodes then broadcast the request to all other nodes that are part of the consensus pool, and all nodes in the pool come to consensus on the write. By the time the transaction completes (typically in a second or so), enough of the nodes know about the ATTRIB data that the transaction is immutable and irrevocable; it's not like Bitcoin where you have to wait for a few blocks to be committed before you can trust it. And the client doesn't need to take any further steps to propagate the knowledge; it happens automatically.
Thank @dhh1128 very much ! if the client don't have any blockchain data locally, I have 2 questions: (1) will the raw data be broadcasted to consensus node with the ATTRIB transaction ? if so, will everyone who can access the consensus node can get all data including the raw data in ATTRIB transaction ? (2) if everyone can get all data including the raw data, so, how to protect the privacy when the raw data is the privacy ?
Re. #1: Yes, all data written to the ledger is public. Re. #2: People should not write private data to the ledger, ever. Individual Indy networks can choose to enforce this or not, according to their preference; on the Sovrin networks, there are actual terms of service that enforce this. Individuals who want to write private data somewhere should use a different mechanism (e.g., peer DIDs; see https://identity.foundation/peer-did-method-spec/). The ATTRIB transaction is used to write metadata for public entities.
@dhh1128 ,Thank you ! but I still have the question. in doc https://hyperledger-indy.readthedocs.io/projects/node/en/latest/transactions.html#attrib,
The ledger only stores a hash of the raw data; the real (unhashed) raw data is stored in a separate attribute store.
as you reply, the ledger is public, but the raw data is not in ledger, so, where will the raw data store ? as you say, it is not in client, so, (1) does it store in consensus node? (2) if it store in consensus node, is the db storing raw data in consensus node A, the same as the db storing raw data in consensus node B(another node, different from A) ?
the ledger is public, but the raw data is not in ledger, so, where will the raw data store?
This is a question that ought to be answered by @skhoroshavin or someone on his team. However, I believe the "separate attribute store" is a rocksdb instance that is persisted beside the ledger on each node in the consensus pool. I believe it is automatically replicated as part of consensus/catchup, so the net effect is that the data for the ATTRIB is always available to anyone who looks up the transaction.
thank @dhh1128, your reply saved my day. @skhoroshavin , can you help me to get clear on it ?
Looks like this has been answered.