Table of Contents
#User Models
##User Models Relationship Diagram
The parent model for all user-related information
- userMetadata
- Reference to User table
- Required field
- cryptoKeyPair
- Reference to CryptoKeyPair table
- Required field
- apiCreds
- Reference to ApiCred table
- Required field
The model that stores the metadata related to a user's account
- email
- varchar (length: 50)
- Unique constraint
- Required field
- firstname
- varchar (length: 20)
- Required
- lastname
- varchar (length: 20)
- Required field
- metadatas
- Reference to Metadata table via UsersMetadata join table
The ApiCred model stores credentials for a user to be able to interact with the API
- apiKey
- the public API key
- varchar (length: 256)
- required field
- encryptedSecretKey
- the encrypted version of the API secret key
- varchar (length: 256)
- required field
#Challenge Models
The Challenge model encapsulates all of the relevant data associated with a specific tree of transactions. More specifically, the “root node” is a sponsor who decides all of the parameters up front (see the properties below), which will determine the size and shape of the ensuing tree as transactions are made.
- parentChallenge
- A challenge might semantically be something along the lines of “build a car”. A child task of this broad goal could be something like “design the braking system”. All of these goals can be represented in this scheme as a “challenge”, and in this case, the “build a car” challenge would serve as the parent challenge. This property points to a parent challenge, if there is one.
- Reference pointing to Challenges table
- Optional field
- challengeSettings
- Reference pointing to ChallengeSettings table
- Required field
- subChallenges
- this is the representation of the children of a given challenge. See the description on the parentChallenge property above.
- Relationship through ChallengeToSubChallenges join table
- completionCriterias
- Reference pointing to CompletionCriteria table
- Required field
- cryptoKeyPair
- Reference pointing to CryptoKeyPair table
- Required
- distributionFeeReward
- Reference pointing to Reward table
- Required
The ChallengeSetting model stores all of the relevant metadata pertaining to a challenge. See the below properties for the specific metadata that is stored.
- name
- A string representing the semantic name of a challenge.
- varchar (length: 100)
- Required field
- description
- A string representing the description of the challenge, perhaps elaborating on the goal
- varchar (length: 1000)
- Required field
- imageUrl
- A string representing a link to a logo for the challenge for visual display purposes
- varchar (length: 100)
- Required field
- sponsorName
- The name of the sponsor of the challenge (i.e. an organization name)
- varchar (length: 100)
- Required field
- expiration
- The date and time at which the challenge will expire (no more transactions can be made)
- datetime
- Required field
- admin
- A pointer to the UserAccount responsible for overseeing the challenge
- Reference pointing to UserAccounts table
- Required field
- offChain
- A boolean representing whether or not the challenge is being facilitated on or off-chain
- Boolean
- Required field
- Default value of false
- maxShares
- The maximum number of transactions that can occur for the totality of the challenge
- integer
- Required field
- maxRewards
- The maximum asymptotic value for the total reward to be distributed over the challenge
- integer
- default of 1
- Optional field
- maxDistributionFeeReward
- The maximum fee to be incurred for the cost of transactions on the network (i.e. Gas)
- integer
- default value of max integer value
- Optional field
- maxSharesPerReceivedShare
- The maximum number of transactions that can ensue a given transaction in the challenge tree. In other words, this determines the size of a given sub-tree
- integer
- Default value of max integer value
- Optional field
- maxDepth
- the maximum length of a provenance change (depth of the tree)
- integer
- default value of max integer value
- Optional field
- maxNodes
- The maximum amount of key pairs that can be involved in the tree
- integer
- default value of max integer value
- Optional field
- shareExpiration
- The amount of time that a user can hold onto a challenge that has been shared with them. If a user does not either share the challenge or try and redeem it before the expiration, it will get sent back to the user from which they received it.
- datetime
- Optional field
The CompletionCriteria model serves as a validator for the completion of a challenge
- address
- The public key of the user that is able to trigger completion of a challenge
- varchar (length: 256)
- Required field
- reward
- Reference pointing to Reward table
- Required field
- prereq
- A reference to the challenge that would have to precede the criteria in this instance
- Relationship to Challenge table via PrerequisiteChallenge join table
A model representing all data properties associated with the reward for completion of a challenge instance
- type
- Reference pointing to RewardType table
- Required field
- pool
- Reference to RewardPool table
- Required field
- metadatas
- Any extra metadata for the reward
- Relationship to Metadata model through RewardsMetadata table
- RewardsMetadata table is a join between Rewards and Metadatas
A model that serves as a collection of all transactions related to a particular reward
- cryptoKeyPair
- A reward pool has its own key pair in order to be able to facilitate transactions on its own based on settings of a challenge
- Reference pointing to CryptoKeyPair table
- Required field
- transactions
- All transactions pertaining to the reward pool
- Relationship to the Transaction table via the RewardsToTransactions join table
A model representation of all metadata to properly describe the type of reward
- audience
- Represents the scope of the reward. It can be distributed over an entire challenge tree or a single provenance chain within a tree
- enum class
- Required field
- Values
- PROVIDENCE
- FULL
- type
- How the rewards are mathematically distributed over the audience
- enum class
- Required field
- Values
- SINGLE
- EVEN
- LOGARITHMIC
- EXPONENTIAL
- N_OVER_2
A model representation of a token on the network. Tokens of different types can exist on the network, so this parent entity tracks the amount of each type
- amount
- The amount of a tokenType on the network
- integer
- Required field
- tokenType
- Reference pointing to TokenType table
- Required field
This model stores all other metadata corresponding to a specific type of token on the network
- name
- The name of the tokenType
- varchar (length: 100)
- Unique constraint
- Required field
- parentToken
- A pointer to the parent tokenType, if there is one
- Reference pointing to TokenType table
- Optional field
- parentTokenConversionRate
- A representation of the conversion rate between a tokenType and its parent
- Double
- Optional field
A model representing any “event” - or a change in data that occurs on-chain. Examples of a transaction could be the creation of a challenge, the expiration of a challenge, or simply the transfer of tokens from one key pair to another
- from
- The public key from which the transaction occurs
- varchar (length: 256)
- Required field
- to
- The public key to which the transaction ends, if there is one. a challenge expiration, for example, would not need this data field
- varchar (length: 256)
- Optional field (in the case of a pure state change for a challenge)
- action
- Reference to Action table
- Required field
- previousTransaction
- A link to the transaction that occurred before this one (to track the tree)
- Reference to Transaction table
- Optional
- metadatas
- Reference to Metadata table through TransactionsMetadata join table
The Action model stores the semantic metadata for a Transaction instance. Given that a transaction can represent much more than the sharing of tokens from one wallet to another (i.e. challenge creation, expiration, etc.), it makes sense to store this data separately from the transaction entity itself.
- type
- an enum value providing a semantic representation of the type of transaction that is occurring
- enum
- required field
- possible values
- TRANSFER
- CREATE
- SHARE
- PAYOUT
- ACTIVATE
- COMPLETE
- INVALIDATE
- EXPIRE
- data
- the ID of the entity that is the subject of the transaction that this action is associated with
- integer
- required field
- dataType
- the type of data from the above property
- varchar (length: 100)
- required field
This model serves as a representation of a key pair on the blockchain
- publicKey
- varchar (length: 256)
- Required field
- encryptedPrivateKey
- varchar (length: 256)
- Required field
This model is just a key-value store to be used by other models in the schema to hold any other relevant metadata.
- key
- varchar (length: 256)
- Required field
- value
- varchar (length: 256)
- Required field



