Values
Last updated
Was this helpful?
Last updated
Was this helpful?
Functioning as a Kademlia DHT network, the boson network not only ensures efficient routing and lookup mechanisms but also serves as a highly reliable and scalable storage platform for storing and retrieving key-value data. Applications can create values as needed, and these values are propagated to neighboring nodes across the network. Each stored value entity possesses a unique value ID, serving as its key within the same namespace as node IDs. Values are categorized based on their nature and purpose into the following classes:
In general, immutable and mutable values, akin to data on a public storage service like IPFS, are openly accessible to nodes across the entire network for individual use. In contrast, encrypted values find application in peer-to-peer scenarios, where the data remains confidential and can only be decrypted by the target node.
Immutable values are entities that cannot be updated once they are stored in the network, even by the data owner. This immutability ensures the permanence and integrity of the data over time, making it reliable and secure. The value ID of an immutable value is calculated using SHA-256 for the value data, which can also be treated as a CID (Content ID).
Mutable values are entities that can be updated only by the owner after they are published and stored in the network. This type of values has a public key, a nonce, a sequence number and signature proof along with the contained data. Each mutable value must be bound with a pair keys used for signing and verifying, where the private is used to generate the signature proof based on data content, and the public key is used to verify the integrity and ownership of the data content. And the private key is kept and ensured it’s security by the data owner himself.
The ID of a mutable value is generated by applying SHA-256 algorithm on the associated public key and nonce. This ID remains the same even if the value is updated. The nonce can be varied when a user uses the same key pair to generate a suite of data values for different purposes.
Encrypted values also are mutable values that they can be updated by the data owner after being stored in the network. However, the difference lies in the fact that the data in encrypted values is encrypted, while the data in mutable values is a plain data. An encrypted value shares the same properties as a mutable value, such as a public key, nonce, sequence number, and signature proof.
The ID of an encrypted value is similar to that of mutable values. It also utilizes the SHA-256 algorithm on the associated public key and nonce. The encrypted value can only be decrypted by a designated node with a specified node ID in the value entity. When the intended recipient node receives the encrypted value, it uses its private key to decrypt the data and process it.
In the boson network, stored values are propagated and retrieved through two fundamental protocols: store_value
and find_value
. When a new value entity is created by an application, it is distributed to nodes with neighboring IDs to the value ID using the store_value
protocol. Upon receiving the value, the recipient node caches it in its local database storage. Cached values in nodes may expire after 2 hours unless periodically rebroadcasted.
An application can employ the find_value
protocol to retrieve or look up the value using a specified value ID. It is crucial to note that the value ID should be obtained through an alternative method not involving the boson network.
The Protocol - store_value
The Protocol - find_value