Social
Purpose of golos.social smart contract
The golos.social
smart contract provides users the following features:
creating and editing user profiles (metadata).
pin-list establishment that allows its owner to receive information about the publications of users that he/she is interested in.
the establishment of a so-called «black» list allowing to block communication between the owner of this list and any unwanted users.
Terminology used in the description of golos.social smart contract
User profile — user metadata stored in the client application database in the form of a structure characterizing the user. The user profile is created and edited by the user. The golos.social
smart contract is not responsible for the storing of user metadata, but only controls whether the user has the right to change or delete metadata.
A user’s pin list — a database item containing a list of account names that a given user is interested in. The user’s pin list is created and edited by the user. It can be used in the client application to create subscriptions, including informing the given user (subscriber) about the appearance of a new post whose author’s name is contained in the pin list.
«Black» list — a database item containing a list of account names that this user characterizes as unwanted. The «black» list is created and edited by the user. Using the «black» list allows the user to block comments and votes of accounts whose names are contained in this list. The golos.publication
smart contract verifies the absence of the account name in this list when performing createmssg
action.
Actions supported by golos.social smart contract
The golos.social
smart contract supports the following actions: pin, unpin, block, unblock, updatemeta and deletemeta.
accountmeta type
The accountmeta
type is intented to describe the user profile and comes in the following structure:
The accountmeta
type is used as a parameter in the updatemeta
action.
pinblock table
The pinblock
table is a database item and contains information about the relationship of one user to another. The data from the table is used to create a pin-list and a list of blocked users.
The pinblock
table contains the following fields:
(name) SERVICE.scope
— the account name (the first name taken from a pair), which puts a user name of interest into one of the lists — the pin-list or the list of blocked users;(name) account
— the account name that was added to one of the lists — the pin-list or the list of blocked accounts;(bool) pinning
— «true» means that the account name has been added to the pin list;(bool) blocking
— «true» means that the account name has been added to the list of blocked accounts.
Please note: Both
pinning
andblocking
fields cannot be set to «true». The record is removing from the table if thepinning
andblocking
fields are «false».
pin
The pin
action is used to add an account name of interest to a pin-list. This action can only be performed by the pin-list owner. The pin
action has the following form:
Parameters:
pinner
— account name which is the pin-list owner and adds the name specified in thepinning
field to the pin-list.pinning
— the account name that is being added to the pin-list.
The rights to run the pin
action belong to pinner
account.
The pin
action is introducing the following restrictions:
a user is not allowed to add own name to the pin-list, that is, the
pinning
field must not contain thepinner
field value.it is not allowed to add account name to the pin-list if pin-list already contains this name.
it is not allowed to add account name to the pin-list if this name has been blocked by the
pinner
account, that is, this name is in the list of blocked accounts.
unpin
The unpin
action is used to remove an account name from a pin-list. The unpin
action is as follows:
Parameters:
pinner
— the account name that removes a name specified in thepinning
field from the pin-list.pinning
— the account name that is about to be removed from the pin-list.
The rights to run the pin
action belong to pinner
account.
The unpin
action is introducing the following restrictions:
it is not allowed to remove the account name which is the pin-list owner, that is, the
pinning
field must never be equal topinner
filed.it is not allowed to remove an account name that is not present in the pin-list.
block
The block
action is used to add an account name of interest to «black» list. This action can only be performed by the «black» list owner.
The block
action has the following form:
Parameters:
blocker
— account name which is the «black» list owner and adds the name specified in theblocking
field to the «black» list.blocking
— the account name that is being added to the «black» list.
The rights to run the block
action belong to blocker
account.
The block
action is introducing the following restrictions:
a user is not allowed to block him/herself, that is, the
blocking
field must not be equal toblocker
field value.it is not allowed to add account name to the black-list if black-list already contains this name.
unblock
The unblock
action is used to remove an account name from a «black» list.
The unblock
action has the following form:
Parameters:
blocker
— the account name that removes a name specified in theblocking
field, from the «black» list.blocking
— the account name that is about to be removed from the «black» list.
The rights to run the unblock
action belong to blocker
account.
The unblock
action is introducing the following restrictions:
it is not allowed to remove the account name which is the «black» list owner, that is, the
blocking
field must never be equal toblocker
field;it is not allowed to remove an account name that is not present in the «black» list.
updatemeta
The updatemeta
action is used to fill, update, or delete account profile field values.
The updatemeta
action has the following form:
Parameters:
account
— name of the account whose profile is being edited.meta
— a value of type of theaccountmeta
structure.
The rights to run the updatemeta
action belong to the account that is specified in the account
field. The updatemeta action does not interact with the database. It only checks the rights of the user who changes her/his profile. Updating user metadata within the database should be implemented in the client application.
deletemeta
The deletemeta
action is used for deleting an account profile.
The delelemeta
action has the following form:
The parameter account
is a name of the account whose profile is being deleted.
The rights to run deletemeta
action belong to the account that is deleting her/his profille. The deletemeta
action does not interact with the database. It only checks the rights of the user who is about to delete her/his profile.
Removal of user metadata from the database should be implemented in the client application.
Last updated