In DistributedTown we have 3 community templates. All those 3 templates have their own set of skills used inside the community
The skills are categorized into 3 groups. These groups have their own amount of DiTo credits - 6, 12, or 24, depending on how valuable the skill is.
DistributedTown is focused on being inclusive regardless of whether our users know or not what a wallet is. We also want to achieve different degrees of "decentralization" based on our users' own choices. This is why we allow our users to create a SkillWallet with their own wallets. In order to achieve that we have two main cases:
Register with username and password
If the user chooses to register with a username and password. We generate a wallet for them, using ethers.js functionality of "BrainWallet".
ethers.Wallet.fromBrainWallet(username, password, [ progressCallback ])
We use this address for the skill wallet.
2. Register with existing Metamask wallet
If the user wants, they can use their own wallet, by authenticating with Metamask.
When the user registers in the platform, by selecting an interest the skills get filtered and the user can see one of those 3 subcategories of skills. When the user chooses their 1 to 3 skills and self evaluates them from 1 to 10 the DiTo credits get calculated.
The formula for evaluating DiTo credits is the following:
Li - The skill level selected by the user
Vi - The skill value of this particular skill - 6, 12 or 24
The minimum amount of credits that the user could have, is in case the user has selected a single skill with a value of 6 and has self-evaluated it to 1/10.
The maximum amount would be when the user has selected 3 skills all of them with a value of 24 and had self-evaluated them to 10/10.
So the initial user credits can vary from 2006 to 2720.
The SkillWallet is designed in a way that allows our partners to easily integrate with it. By adding a SkillWallet login button, our skill wallet owners can receive ERC-20 tokens from this external platform.
All skill wallet owners will get a share from the tokens issued by this app, just by having the skill wallet. However, the number of tokens that the skill wallet owners get will depend on how active are they in the partners' application.
In order to make this happen, we store a map of addresses of the tokens smart contracts, that the user already has.
Using TheGraph we can make queries to the network so that we can identify how active the user has been in their platforms, by querying the events and data on the network.
If necessary we also plan on implementing webhooks for off-chain events on their platform. The webhooks would be event-based triggered by our partners' platform. SkillWallet won't be storing any user-specific and sensitive data about the users' behavior in the platform. Just an evaluation of their activity.
The SkillWallet interface is implemented as a simple React Native mobile application, where the users can keep track of their DiTo credits, external ERC-20 tokens, and skills. From this app, the users will also be able to scan the QR-codes needed for the Gig Management. Please refer to the Gig Manager documentation for more details on the QR-codes logic. The mobile app is available for Android and iOS here.
The flow of SkillWallet creation is best described via the diagram below. In order to understand better the authentication flow and wallet management, refer to Technical Overview.
When a skill wallet is created, a hash is created for it, which we use for validation of the on-chain and off-chain data consistency. This hash is created from username:skills: skill levels and it's calculated dynamically from the data. After calculating the DiTos they get returned to the blockchain and get stored on-chain and the flow is finished.
Gig validation triggers reevaluation of the skill wallet of the user. This happens after the fifth gig, related to a certain skill. The rates are stored off-chain in the gigs collection inside the community thread. The diagram below describes the flow. If the rating triggers reevaluation, the smart contract fetches the new value of the skill which is getting rated and updates the skill wallet.
In a public User Collection in the DistributedTowns' threadDB, we store the user skills, username, password hash, communityID, and a hash. This hash is generated from the skills, communityID, and username, which makes it unique per user. This hash is stored on-chain and we use it to ensure that the off-chain and on-chain data are in sync. The smart contracts make requests to the backend in order to fetch the hash and validate. This is done by integrating with Chainlink.
When a skill wallet gets created we store the unique SW hash, and external ERC-20 token addresses. When the user logs in with the skill wallet in some of our partners' platforms they receive tokens for being a part of their platform.
The SkillWallet is easy to integrate npm package. It can be easily plugged into a web application, using frameworks such as React, Angular or simply using pure JS.
The app is publicly available here.
Using the SkillWallet package external applications can integrate with the skillWallet and read the user's skills.
When the user clicks on
Login with SkillWalletbutton they will be prompted to enter their distributed town's username and password or authenticate their Metamask wallet. The platform will use the same wallet address in order to transfer the ERC-20 tokens.