Building with Passport
Major concepts
Scoring mechanisms

Scoring mechanisms

Scoring mechanisms are algorithms that take a set of Stamps and return a numeric score. There are Gitcoin built-in scoring mechanisms that can be executed on the Gitcoin server, or you can design and implement your own.

scoring mechanisms

Built-in scoring mechanisms

When you visit (opens in a new tab) and create a Scorer, you are presented with four options: Unique Humanity, Unique Humanity (binary), Cost of Forgery and Custom. These are algorithms that can be applied to a user's Stamps on the Gitcoin server.

Unique Humanity

Unique Humanity assigns a weight to each individual Stamp. The score is simply the sum of the Stamp weights. The Stamp weights are set by Gitcoin and can be viewed on the Passport Github (opens in a new tab).

The intended use for this is that an app can set a threshold that can be used to gate access to certain content or functions. For example, you might determine that your users have to have a Passport score of 20 to access your platform. A threshold of 20 is generally considered to be a sensible default for removing bots and fake users from your application. You can choose to be more or less lenient depending on your specific use case.

With the Unique Humanity Scorer, the threshold is not applied for you on the server. You receive a numeric value to apply as you see fit.

Unique humanity (binary)

The binary version of Unique Humanity applies thresholding on the server and returns a Boolean (true/false) value indicating whether the user's Passport score exceeds the threshold or not. The threshold value is currently 20.

Cost of forgery (not yet available)

Cost of forgery is the value of a Passport in USD. This is based on a combination of the monetary value of any staked GTC along with an assumed amount of money required to dishonestly mint a specific Stamp. The idea with this Scorer is that you can set the minimum Cost of Forgery to be equal or greater than the amount of value that can be generated with a Passport passing the threshold. This makes it economically irrational to Sybil attack your app.

Custom (not yet available)

Server-side custom scoring allows you to provide your own Stamp weights to use in the Unique Humanity scorer. This allows you to configure the Scorer more specifically to your own particular use case.

Custom scoring mechanisms

You are also welcome to apply your own scoring mechanism to raw Stamp data. The built-in Scorers are executed on the Gitcoin server. You can also access a user's Stamps directly and implement your own algorithm to determine the Passport value. You can do this with Stamp data retrieved from the Gitcoin server or onchain Stamps. An example of client-side custom scoring is provided in our onchain Stamps tutorial.

Stamp deduplication

Scoring algorithms have to include some logic to remove multiple copies of the same Stamp being used multiple times on the same Scoring instance. On the Gitcoin server, the Stamp that was seen first is treated as valid, and any duplicates that are used in other wallets later are ignored in a process known as 'deduplication'.

If you use a built-in Scorer, deduplication is handled for you on the Gitcoin server. However, if you choose to implement some custom algorithm, you should also implement a custom deduplication algorithm. The hash of each Stamp is provided to enable you to identify individual instances of each Stamp.