Skip to content

Working with Contact List

adamant-al edited this page May 28, 2021 · 5 revisions

Contact list is a specific case of KVS record in ADAMANT blockchain. Read more in in AIP 7: Contacts List.

Storing Contact list

Contacts list is stored as a JSON object in the ADAMANT KVS. This object must be encrypted and passed as value with key = contact_list.

The keys of the above JSON are ADAMANT UIDs, values are objects with aliases are stored in the displayName property. Example of value object for storing Contact list:

{
    "U9821606738809290000": {
        "displayName": "John Doe"
    },
    "U9821606738809290001": {
        "displayName": "Jane Doe"
    }
}

Other properties besides displayName may be added to values to store various contact details.

Example of transaction to store a contact list:

{
    "transaction": {
        "type": 9,
        "amount": 0,
        "senderId": "U15677078342684640219",
        "senderPublicKey": "e16e624fd0...",
        "asset":{
            "state":{
            "key": "contact_list",
            "value":"{
                \"message\": \"6df8c172feef228d930130...\",
                \"nonce\": \"f6c7b76d55db945bb026cd221d5...\"}",
            "type": 0}
            },
        "timestamp": 45603645,
        "signature": "dbafce549f1..."
    }
}