# Human Passport > Human Passport is an identity verification application and Sybil resistance protocol. Developers can use Passport products and services to verify unique humanity and protect their communities from Sybils and bad actors. ## Overview ### Why Human Passport URL: https://docs.passport.xyz/overview/why-human-passport # Why Human Passport? **Human Passport is a Sybil resistance protocol and identity verification platform. Users can prove their unique humanity through multiple verification methods: [Stamps](/building-with-passport/stamps) aggregate identity attestations from web2 and web3 authenticators, [Models](/building-with-passport/models) provide frictionless ML-powered verification, and [Individual Verifications](/building-with-passport/individual-verifications) offer privacy-preserving KYC, phone, biometrics, and AML checks using zero-knowledge proofs.** Many systems, like Gitcoin Grants, assume each participant is a unique human, and offer rewards for these participants. This makes them vulnerable to Sybil attacks, where a bad actor creates a large number of pseudonymous identities to subvert the service’s reputation system, gain a disproportionate amount of influence, and direct rewards towards extractors. Credible identity verification and reputation mechanisms are essential to combat this. Applications liked BrightID, ENS, and POAP each help suggest whether an account is associated with a real human, but they are only truly powerful when they compose with each other. Projects need a way to evaluate these disparate "identity providers" altogether. **That's where Human Passport comes in.** We originally created Passport for Gitcoin's needs: to [defend Gitcoin's Grants program from Sybil attacks](https://youtu.be/v1Dm7FI2AdU) so that only real people can help decide which projects receive funds from a shared matching pool. One thing we have learned from defending the Gitcoin Grants program is this: Sybil defense is complicated and resource intensive. Yet it is essential for any web3 project that hopes to have longevity, because users will not stick around if your project is filled with scammers. As we developed years of in-house expertise in Sybil defense, we saw a responsibility to help other web3 projects protect their communities from bots and bad actors. **Because we believe that private identity verification is a public good, we decided to turn Passport into its own product.** With dozens of identity providers using Passport to protect their communities, Passport is on track to become the leading, open-source identity verification protocol in the world. --- ### Active integrations URL: https://docs.passport.xyz/overview/active-integrations # Active Passport integrations This page contains a condensed list of active integrations that have produced guides detailing how to leverage Passport within each ecosystem. To find a complete list of ecosystem partners, please visit the following page: - [Passport Ecosystem Partners](https://passport.human.tech/ecosystem) ## Snapshot Snapshot is a voting platform that allows DAOs, DeFi protocols, or NFT communities to vote easily and without gas fees. Snapshot enables you to use Passport in two different ways: Gate access to submitting proposals, and gate access to voting. Learn more at the following link: - [Using Passport with Snapshot](https://docs.snapshot.org/space-handbook/voting-threshold#voting-validation) ## Discourse Discourse is an open source Internet forum system that is used as a governance tool for many web3 organizations. You've got a few different opportunities to use Passport to assign roles and gate access! There are actually two different plugins that you can use with Discourse! We are more impressed with the level of documentation provided by Dappy.lol though. - [Dappy.lol's Discourse plugin](https://meta.discourse.org/t/gitcoin-passport-plugin/273532) - [Communiteq's Discourse plugin](https://github.com/communiteq/discourse-gitcoin-passport) ## Collab.land Collab.Land is a community management tool that supports a wide range of projects, including DAOs, NFT communities, brands, and creators of all sizes. As with any community management tool, roles are critical for providing different levels of access. The Collab.Land integration allows you to gate access to roles to just those users who can prove their humanity on Passport! Learn more here: - [Using Passport with Collab.Land](https://docs.collab.land/help-docs/command-center/create-a-tgr/gtc-passport) ## Missing something? While we do list our full list of integration partners on our [ecosystem page](https://passport.human.tech/ecosystem), we want to continue to build out this page with links to partners who have instructions on how to use Passport within their ecosystem. If we missed a partner, please feel free to submit an issue or open up a pull request by clicking the "Edit this page" button in the right sidebar! --- ### Key terms URL: https://docs.passport.xyz/overview/key-terms # Key Terms ### Passports The example below shows the JSON data format for a Human Passport. This is an example of a Decentralized Identifier (DID), as defined in the [W3c documentation](https://w3c.github.io/did-core/#a-simple-example). Each passport contains a field named `stamps`. This is a array where your Stamps are stored. To see what each Stamp looks like, scroll down to the Stamps section. When you add Stamps to your Passport, they are pushed into this array. The entire Passport (DID) object is stored on the Ceramic network and associated with your Ethereum address. ```json { "issuanceDate": null, "expiryDate": null, "stamps": [ ] } ``` ### Passport Protocol The "Passport Protocol" refers to the infrastructure that enables web3 citizens to create their own Passport, prove their decentralized identity and access Passport-gated projects. It is all the tooling that enables developers to build Passport gating into their apps. Web3 citizens interface with the Passport Protocol through the Passport holder dApp at [app.passport.xyz](https://app.passport.xyz). Developers can use the [Stamps API](/building-with-passport/stamps/passport-api) to easily integrate Human Passport into their apps. ### Passport-Gating "Passport gating" means integrating the Passport Protocol into an app for the purpose of screening accounts to keep out bots, bad actors, or simply real people who don't meet a certain [threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) of trustworthiness. **Usage:** * "I like how this project gated its community with Human Passport. I'm going to ask the project owner for their gating algorithm, so I can use it for inspiration." * "Some examples of Passport-gated dApps include: Snapshot, Bankless Academy, and Gitcoin Grants." * "Because this community is gated with Human Passport, it is able to ask for pieces of proof of not just identity via services like BrightID, but also reputation via services like POAP." See our [quick start guide](/building-with-passport/stamps/passport-api/quick-start-guide) to learn how to gate your project. ### Stamps Stamps are the key identity verification mechanism of Human Passport. A Stamp is a collection of one or more [verifiable credentials](#verifiable-credentials-vcs) from an identity provider that is collected in a Passport. Stamps are provided by a variety of web2 and web3 identity authenticators including Google, Facebook, BrightID, ENS, and Proof of Humanity. Custom Stamps for particular communities are under development. Stamps do not store any personally identifiable information, only the verifiable credentials issued by the identity authenticator. Human Passport aggregates Stamps and assigns each Stamp a different weight according to the needs of a particular community. This weight is used to calculate the cost of forgery of an identity, a score which reflects the credibility of a potential participant's online identity. For example, a community for developers could assign a greater weight to a Github Stamp, resulting in higher scores for those who have Github Stamps. The code snippet below shows a single Stamp. This particular Stamp proves ownership of a Discord account. The Stamps array in the Human Passport object contains multiple instances of this data structure representing each different passport Stamp. All the Stamps conform to this specific format inherited from [https://www.w3.org/2018/credentials/v1](https://www.w3.org/2018/credentials/v1). ```json { "provider": "Discord", "credential": { "type": [ "VerifiableCredential" ], "proof": { "jws": "eyJhbGciOiJFZERTQSIsImNyaXQiOlsiYjY0Il0sImI2NCI6ZmFsc2V9..Ac4ey_k49EFc-pNUpbJdfVYQxskVKVEPSZ36bak_vvtGf5gIqy1TXyWlbR5tzhFrzjYlFc-GHQKwSvW-0xzdBA", "type": "Ed25519Signature2018", "created": "2023-04-20T12:31:48.468Z", "proofPurpose": "assertionMethod", "verificationMethod": "did:key:zM6khhvGHobLobLYjd1b1MAtnbgRLh4Sdj1bgRLPGAAvbMA1nt2zcRyqmYU5LC#zKKkghvGHLobELLhS4LPGJAvz2cRyqmYU5LC" }, "issuer": "did:key:z6MGH1tn2zcRobLEdj1bgJLhS4LPGGAvbMARkghvymqYU5CL", "@context": [ "https://www.w3.org/2018/credentials/v1" ], "issuanceDate": "2023-04-20T12:31:48.468Z", "expirationDate": "2023-07-19T12:31:48.468Z", "credentialSubject": { "id": "did:pkh:eip155:1:0x281aa163B9b0927B8B5C68e5A009ddD06a103Eeb", "hash": "v0.0.0:Hl1gllZWqCCj69w9nmsjbaaahK3QtZthAE7/ku/jN7s=", "@context": [ { "hash": "https://schema.org/Text", "provider": "https://schema.org/Text" } ], "provider": "Discord" } } } ``` Stamps are added and removed from the the Passport service as the product evolves. To learn more, please visit our [Stamps overview for developers](/building-with-passport/stamps/create-a-stamp). The weights assigned to individual Stamps in the Passport scoring app can also change if re-weighting is likely to improve the overall Sybil defence efficacy of the Scorer. ### Verifiable credentials (VCs) Each Stamp is composed of one or more "verifiable credential". These credentials are individual pieces of evidence that can be tested in order to issue a Stamp. For example, the Github Stamp includes VCs for several different properties of a user's Github account, including the Github OAuth (can the user sign in to the account) and the number of followers, forks and stars the user has accumulated. Together, these VCs comprise the Github Passport Stamp. ### Ethereum Ethereum is a blockchain network. It is secured using a proof-of-stake based consensus mechanism and contains an embedded computer that allows apps to be built on top of it. Discrete units of executable code living on the Ethereum blockchain are known as smart contracts. Read more on Ethereum at [ethereum.org](https://ethereum.org). ### Ethereum address Ethereum users interact with the network using an account. An account is really a pair of keys. One key is known as the 'private key' which is used to sign and send transactions. The other is the 'public key', which is used to create a unique address used to identify a particular user. In Human Passport, users' Ethereum addresses are used to identify which Stamps they own. Their private keys are used to demonstrate ownership of that address. ### Hash A hash is the result of applying a hash function to some data. A hash function takes some data and returns a unique string of characters of fixed length (the hash). The hash function is deterministic, meaning the same data will always return the same hash, but it is extremely difficult to recover the original data from the hash. This makes the hash useful for efficiently validating data. ### Duplication of Stamps The Passport itself does not require a unique underlying account to issue a VC. This means that any number of wallets can create Passports that link to the same underlying identity. While it is fine for an honest user to have multiple Passports, for example to maintain different user profiles (for example "home" and "work") it is not acceptable to use the same credential multiple times to influence a single outcome. Passport is built to support contextual identity so you can maintain Passports that you use within specific communities. It's also important for recoverability that Stamps are not bound to a single Ethereum address - otherwise losing access to your wallet means losing the ability to prove your identity using the Stamps that had previously been tied to it. To enable users to maintain distinct personas is different communities, but simultaneously prevent dishonest multiplication of Stamps we have added a `hash` field to the Passport Stamps. This `hash` is a unique identifier that is generated for all VCs issued by the Passport server. It allows a Stamp to be uniquely identified, so a particular app can check that it has only been used once, while preserving anonymity. As a developer, you don't need to implement any logic for deduplicating Stamps if you use the default scorer. The deduplication is done server-side. However, if you are building a custom scorer you may want to store the hashes and deduplicate Stamps yourself to prevent users from submitting the same set of Stamps in multiple Passports. More details about Passport deduplication can be found on our [Deduplicating Stamps](/building-with-passport/stamps/major-concepts/deduplicating-stamps) page. ### Streams Passport identity data is stored as a decentralized data stream on Ceramic. Streams are individual instances of state on the Ceramic network. They are mutable and can only be altered after receiving a transaction signed by the account that owns it. These data streams are what allow Passport data to be interoperable and portable across multiple chains and dApps. ### Scorer A Scorer is an instance of a scoring algorithm. The Stamps API that offers a straightforward way for developers to interact with the Passport Protocol, including adding Passports to a registry and calculating the Passport score using a scoring algorithm. The Scorer assigns a score to a Passport by summing weights assigned to individual Stamps. Please note that the weights assigned to individual Stamps can change over time in order to provide the best Sybil defence. You can also implement your own scoring algorithm using Stamp data. ### Pagination (API) Some API requests might return large amounts of data. For example, the data returned from `/registry/stamps` returns information about every individual Stamp owned by a given address, possibly including all the associated metadata too. It can be convenient to break this data up into more manageable pieces. The way to do this is using API pagination. By adding a query to the API request, you can receive chunks of the data. Take, for example, the following request to the Stamp registry: ```bash curl --request GET 'https://api.passport.xyz/registry/stamps/{address}?include_metadata=true' ``` This request could return a large amount of data if the given address owns a lot of Stamps. In this case, it could be useful to paginate the response, which means the API will return a subset of the total data. You can do this by adding `&limit=x` to the API request, where `x` is the number of elements (in this example, Stamp objects) to return in each response. More detail, including an explanation of how to navigate paginated responses, is provided in the [API reference](/building-with-passport/stamps/passport-api/api-reference). ### Sybil A Sybil is a fake user. Many applications require confidence that each of their users represents a real human individual rather than a bot or an impersonator. However, users can try to create multiple personas that they use to access a service, gaining more than their fair share or reward or influence. Each of these dishonest personas is known as a Sybil. Take voting for example; if a user can create ten accounts and convince a platform that they are all valid, then they have multiplied their influence over the outcome of the vote by 10x. Human Passport is an anti-Sybil tool because it makes it harder for attackers to convince platforms that these Sybil accounts represent genuine users. ### Individual Verifications [Individual Verifications](/building-with-passport/individual-verifications) are privacy-preserving identity checks that use zero-knowledge proofs to verify specific attributes about a user without exposing personal data. Unlike Stamps which aggregate multiple signals into a composite score, Individual Verifications provide targeted proofs for use cases requiring stronger identity guarantees or regulatory compliance. Available verification types include: - **Government ID (KYC)** - Verify identity via government-issued ID - **Phone** - Verify a unique phone number - **Biometrics** - Face uniqueness and liveness check - **Proof of Clean Hands** - Sanctions and PEP list verification for AML compliance Upon successful verification, users receive a non-transferable SoulBound Token (SBT) that proves their verification status. ### Zero-Knowledge Proofs (ZKP) A zero-knowledge proof (ZKP) is a cryptographic method that allows one party to prove a statement is true without revealing any information beyond the statement's validity. For example, a user can prove they passed government ID verification without disclosing their name, ID number, or any other personal data. In Human Passport, ZKPs power [Individual Verifications](/building-with-passport/individual-verifications/introduction) — users generate compact cryptographic proofs client-side, which are verified on-chain as attestations. The underlying personal data never leaves the user's device. See [How Zero-Knowledge Proofs Work](/building-with-passport/individual-verifications/introduction#how-zero-knowledge-proofs-work) for a developer-oriented explanation. ### SoulBound Tokens (SBT) SoulBound Tokens are non-transferable blockchain tokens that represent identity credentials or achievements. Unlike regular tokens or NFTs, SBTs cannot be transferred or sold - they are permanently bound to the wallet that received them. Human Passport uses SBTs to represent completed [Individual Verifications](/building-with-passport/individual-verifications). When a user completes a verification (such as government ID or biometrics), they receive an SBT on their chosen blockchain (Optimism or Stellar) that proves their verification status. SBTs expire after one year and can be renewed by completing the verification process again. --- ### Changelog URL: https://docs.passport.xyz/overview/changelog # Changelog We are also maintaining a separate [Stamp changelog](/building-with-passport/stamps/major-concepts/credential-map-and-weights#stamp-changelog), which tracks updates to our Stamps and credentials within the Passport Stamps product. ## September 9th, 2025 We launched a new product called Passport Embed in beta, which enables partners to integrate Human Passport's Stamps-based verification directly on their website or dApp, ensuring that users can verify their identity without having to leave the protected user flow. You can learn more about Passport Embed via our [Passport Embed documentation](/building-with-passport/embed). ## June 18th, 2025 Today we renamed the Passport API to the Stamps API to better align with our new product architecture, which consists of Passport Stamps ([Stamps API](/building-with-passport/stamps/passport-api)), Passport Models ([Models API](/building-with-passport/models)), and [data services](/building-with-passport/data-services). ## May 19th, 2025 We launched a major update to our developer documentation. This launch includes a significant overhaul of our product architecture, including the addition of Passport Embeds, and better organizing products into the Passport Stamps, Passport Models, and Data Services groupings. This update coincides with a major update to the Passport website, which also launched earlier this month. With any major update to our documentation, we recommend that you review the updated documentation to ensure that you are using the latest features and best practices. We'd also love to hear your feedback! Please feel free to [submit an issue to our GitHub repo](https://github.com/passportxyz/passport-docs/issues/new/choose) if you see anything that doesn't make sense, or any broken redirects. ## May 15th, 2025 We launched a new Stamp to the Passport Stamps product. The new Stamp is called Proof of Clean Hands, and it checks to see if a given address and associated government ID is listed on any sanctions lists, including but not limited to the OFAC sanctions list, all US sanctions lists, and specific UN lists. you can learn more about this Stamp via our [Proof of Clean Hands documentation](https://support.passport.xyz/passport-knowledge-base/stamps/how-do-i-add-passport-stamps/the-proof-of-clean-hands-stamp). If a user has verified this Stamp, you will be able to see that they verified this Stamp via the [Stamps API](/building-with-passport/stamps/passport-api) and [smart contracts](/building-with-passport/stamps/smart-contracts). ## May 12th, 2025 We launched a new version of our Models API aggregate model, as well as a new Base model. The new models are available via the `GET /v2/models` endpoint, with the aggregate model being the default and the Base model being available via the `model` query parameter. You can learn more about the models in the [Models API documentation](/building-with-passport/models). ## March 12th, 2025 We made several updates to Onchain Passport based on developer feedback. - We have reduced the number of onchain attestations that we write for users from two to just one. - We have updated the [Onchain Passport attestation schema](/building-with-passport/stamps/smart-contracts/attestation-schema) to be more developer-friendly. - We have deprecated the hash that was returned with the decoder contract's `getPassport` method. - We've introduced a new method, `getScore` (0xdaadd662), which accepts a scorer ID (communityID) and user address, and returns the current score of a user for that scorer. This can be used by partners who are using [custom scores](/building-with-passport/stamps/custom-passport). At this time, there is no way to request Stamp-specific Custom Passport data from onchain. ## Context We produced the Changelog as part of the March 12th, 2025 release of Passport. We may backfill several product updates in the future. --- ## Building with Passport ### Data Services URL: https://docs.passport.xyz/building-with-passport/data-services # Passport Data Services Human Passport’s Data Services provide advanced, ML-driven Sybil detection and wallet analysis, helping partners confidently distinguish genuine users from Sybil attackers. ## Overview Passport’s Data Services offer batch analysis of wallet addresses, designed specifically for scenarios where you have a predefined list of addresses (such as airdrops, event registrations, or community campaigns). It complements Passport’s real-time verification tools like [Stamps API](/building-with-passport/stamps/passport-api) and [smart contract-based verification](/building-with-passport/stamps/smart-contracts). ## Use Cases Common scenarios where Passport’s Data Services deliver significant value include: * **Airdrops and Token Distributions**: Vet wallet addresses before distributing tokens to ensure only legitimate users receive rewards. * **Community Campaign Audits**: Identify bot-driven farming in referral campaigns, growth initiatives, or contests. * **Sybil Attack Investigations**: Assess and remediate suspected Sybil activities post-event or campaign. ## How It Works The process is straightforward and collaborative: ### 1. Submit Your Wallet List Securely share the wallet addresses you want analyzed. ### 2. Advanced Analysis Passport’s data team conducts comprehensive analysis, including: * **ML-based Sybil Classification**: Our machine learning models analyze wallet transaction patterns across multiple chains (Ethereum, Arbitrum, Optimism, Base, Polygon, zkSync), assigning a Unique Humanity Score from 0-100. * **Sybil Clustering Analysis**: Detect related wallets based on funding patterns, behavior similarities, and transaction clustering. * **Low-Activity Wallet Handling**: Special handling and heuristics for wallets with minimal activity, ensuring fair evaluation without compromising security. * **Expert Consultation**: Human analysts review findings, validate results, and provide tailored insights and recommendations. ### 3. Actionable Reports Receive detailed reports with clear classification, identified Sybil clusters, actionable recommendations, and guidance on implementation. ### 4. Ongoing Support (Optional) Continuous monitoring and periodic analyses for long-term campaigns or community management. ## Pricing * \$0.05 per address analyzed. * Bulk discounts available starting at 500,000 addresses. ## Getting Started Ready to leverage Passport’s Data Services? Fill out our [Data Services partner form](https://tally.so/r/3X81KL). Our team will contact you to discuss your use case, integration details, and next steps. [→ Contact the Passport Team](https://tally.so/r/3X81KL) --- ## Building with Passport > Stamps ### Passport Stamps URL: https://docs.passport.xyz/building-with-passport/stamps/introduction # Passport Stamps Passport Stamps are a way to collect and present data without exposing it or giving up ownership. Ready to get started? - [Generate API Key and Scorer ID](/building-with-passport/stamps/passport-api/getting-access) ## What are Stamps? Passport Stamps is an aggregate, real-time verification tool that can enable users to prove their unique humanity using a variety of different verification methods, and for developers to access these humanity proofs via the [Stamps API](/building-with-passport/stamps/passport-api) or [smart contracts](/building-with-passport/stamps/smart-contracts). **Verified Credentials do not contain any personal identifying information!** They simply demonstrate, using a cryptographic signature, that the user gave access to a specific app and that some criteria were met. Learn more about how Human Passport is [privacy preserving](https://passport.human.tech/privacy). **Choosing the right verification approach** Human Passport offers multiple verification methods: - **[Stamps](/building-with-passport/stamps)** - Aggregate multiple signals into a composite score. Best for general Sybil resistance. - **[Models](/building-with-passport/models)** - ML-powered scoring with zero user friction. Best for frictionless verification. - **[Individual Verifications](/building-with-passport/individual-verifications)** - Privacy-preserving KYC, phone, biometrics, and AML checks. Best for regulatory compliance or stronger identity guarantees. ## Use cases Developers can integrate Passport in a variety of different programs and apps in the web3 ecosystem, as demonstrated by the following use case examples: - Sybil resistance for faucets, bundlers and airdrops - Gating access to content, events, polls, or communities - Priority weighting votes - Proving trustworthiness Passport Stamps is a versatile and valuable tool for managing access, promoting transparency, and establishing trust within different web3 environments. [Learn more about Passport use cases](/overview/use-cases). ## Available developer tools Passport score and Stamp data can be retrieved in two ways: * **[Stamps API v2](/building-with-passport/stamps/passport-api):** Retrieves the Stamp-based Unique Humanity Score and associated metadata for a specified address. * **[Passport Smart Contracts](/building-with-passport/stamps/smart-contracts):** Interacts with a blockchain to retrieve Stamp-based Unique Humanity Scores associated with a specific address. Passport's Stamps-based product can also be delivered to users in a few different ways: * **[Passport App](https://app.passport.xyz):** The standard Passport app that allows users to manage their Stamps and view their Passport score. * **[Passport Embed](/building-with-passport/embed):** A widget that can be embedded on a website or app to allow users to verify their identity. * **[Custom Passport](/building-with-passport/stamps/custom-passport):** A dashboard that can be customized to the unique needs of your ecosystem. ### Stamps API v2 The Stamps API v2 serves as a powerful tool for developers, offering access to Passport scores and Stamps via several REST endpoints. - [Overview](/building-with-passport/stamps/passport-api) - [Get access](/building-with-passport/stamps/passport-api/getting-access) - [Quick start](/building-with-passport/stamps/passport-api/quick-start-guide) - [API reference](/building-with-passport/stamps/passport-api/api-reference) ### Passport Embed Passport Embeds enables partners to integrate Human Passport's Stamps-based verification directly on their website or dApp, ensuring that users can verify their identity without having to leave the protected user flow. - [Passport Embed](/building-with-passport/embed) ### Custom Passport Custom Passport is a premium offering that enables partners to develop a Human Passport dashboard that is customized to the unique needs of their ecosystem. This offering enables several additional features above and beyond what is offered on the standard Passport app, which can enable tailored proof of humanity solutions. - [Custom Passport](/building-with-passport/custom-passport) ### Onchain Passport Passport's smart contracts enable you to pull score and Stamp data directly from the blockchain to enable a truly decentralized integration. - [Onchain Passport](/building-with-passport/stamps/smart-contracts) ## Getting Started To begin your development journey with Human Passport, follow these steps: - [Get an API key and scorer ID for the APIs](/building-with-passport/stamps/passport-api/getting-access) - [Try the API playground](https://passport-api-playground.vercel.app) - [Get to "Hello World" with Stamps API v2](/building-with-passport/stamps/passport-api/quick-start-guide) By following these steps, you'll be well-equipped to start integrating Passport into your platform. If you have questions or need support, you can chat with us on our [developer support channel on Telegram](https://t.me/+Mcp9RsRV7tVmYjZh). --- ### Custom Passport URL: https://docs.passport.xyz/building-with-passport/stamps/custom-passport # Custom Passport Custom Passport enables partners to develop a Human Passport dashboard that is customized to the unique needs of their ecosystem. This offering enables several additional features above and beyond what is offered on the standard Passport app, which can enable tailored proof of humanity solutions. If you’re interested in building with Custom Passport, please reach out to our team: [Contact the Passport team](https://tally.so/r/3X81KL) ## What’s possible The custom Passport experience offers lots of customization options related to the look and feel of the experience, the stamp selection and even the scoring weights of stamps. Each of these options are configurable and still come with default values to guide the experience. Learn more about each feature below: | Customization | Description | |------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Branded dashboard and CTAs | Create a custom dashboard for your users to verify their humanity through. (Examples include [Scroll](https://app.passport.xyz/#/scroll/dashboard), [Shape](https://app.passport.xyz/#/shape/dashboard), & [Linea’s Verax](https://app.passport.xyz/#/verax/dashboard)) Access this dashboard via a distinct URL, and add your branding, messaging, and a CTA (push Passport onchain or point to a domain of your choosing) to a module at the top of the page. Display your custom Stamp weights and score threshold. | | Curate Stamps and weights | Remove any Stamps or credentials that don’t make sense for your ecosystem, and adjust the remaining [credential weights](./major-concepts/credential-map-and-weights) to better reflect your ecosystem’s needs. | | Create your own Stamps:
GuestList | Enable your known humans to easily obtain a passing score based on their inclusion on a pre-vetted list. This list could be based on POAP ownership, in-person event attendance, your own KYC, or other high-human or reputation signals. | | Create your own Stamps:
DeveloperList | Reward developers who have contributed to the development of specified GitHub repositories with points. This Stamp could be built around a set of company-owned repositories, or around different important programming languages or tools. | | Elevated rate limits | Access the custom score and Stamp data via the Stamps API with elevated rate limits. | ## Custom Passport Requirements To build a custom dashboard, we need assets, messages, and CTAs that will help to inform your users around the program that is being protected. Also, if you choose to take advantage of the custom scorer or custom Stamps, we will partner with you to identify the proper weights, lists, and repos needed to set up those features on the backend. ### Branded Dashboard The branded dashboard requires the following assets, messages, and CTAs to set it up: | Required element | Description | Example | |------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Custom URL path | This path element will be used in your branded dashboard’s unique URL, which is where your users will access it. | https://app.passport.xyz/#/verax | | Partner name | This will be used in a few different locations throughout the dashboard. | Verax | | Score threshold | The minimum score threshold that you will use to protect access to your program. | 20+ | | Branded module:
Logo | This will display in the branded module at the top of the dashboard.
Should be the negative version suitable for dark backgrounds, square or vertical aspect ratio for maximum visibility.
Must be SVG. | | | Branded module:
Primary description | This description helps your users understand the program that is being protected and how the score will be used.
Must be 200 characters or less. | Verax is a community maintained public attestation registry on Linea. Push your Passport Stamps onto Verax to gain rewards for early adopters in the Linea ecosystem. | | Branded module:
Secondary description | This additional, optional description can help to clarify certain elements from your protected campaign.
Must be 100 characters or less | This action requires ETH bridged to Linea Mainnet to cover network fees. | | Branded module:
CTA link | This can be one of two things:
A link to your website.
A button that enables users to push onchain to your network, assuming we have also partnered to enable this | https://poh.linea.build | | Branded module:
CTA text | The text that will be added to the button within the branded module. | Get Linea’s PoH badge | | Branded module:
Primary and secondary color | This color will be used to
Must be a hex color. | #d2dc95 | ### Custom Scorer If you decide that you’d like to remove any Stamps or reweight their credentials to better match your ecosystem’s needs, we will partner with you to come up with an updated set of weights. You can find the current Passport Stamp and credentialweights in the following link: [Credential Map and Weights](/building-with-passport/stamps/major-concepts/credential-map-and-weights) Please let us know the following if you’d like to customize the score: * Which Stamps and credentials would you like to remove * How you would like to reweight each of the individual Stamps We can then review your request and let you know if it will still provide effective Sybil defense for your program. ### GuestList Stamp If you would like to create your own Stamp based on a pre-vetted allowlist, please provide us with either the NFT, POAP, or list of addresses that should be provided access to this Stamp. We will also need you to provide the points that you would like to be awarded with this Stamp. ### DeveloperList Stamp If you would like to create a Stamp that awards points for developer contribution, we will need you to provide the list of repos that developers will have needed to make commits to, as well as the number of commits you would like to award points for, and the number of points to assign. For example, you can build a Stamp that awards developers for having made the following level of commitments: * 1 commit – 1 point * 5 commits – 2 points (additional, on top of the earlier tier) * 10 commits – 3 points (same as the above) ### Elevated Rate Limits Please let us know how many users you expect to participate in this campaign so we can help identify the right rate limit for you! ## The Process Once you identify that you’d like to take advantage of the Custom Passport offering, we can get started on putting together the above requirements. As you provide these, we will build out your branded dashboard for you, and will provide you review sessions along the way. We can adjust and optimize your dashboard for you before your campaign goes live. ## Requesting Custom Passport data If you are just checking scores from your Custom Passport offchain, you can use the [Stamps API v2](/building-with-passport/stamps/passport-api) to access your users' data. If, instead, you're enabling your users to push their Passport onchain and you are using a [custom scorer](#custom-scorer), you will need to use the [Decoder contract](/building-with-passport/stamps/smart-contracts/contract-reference#decoder-contract), and more specifically, the `getScore` (0xdaadd662) method, making sure to pass both your [scorer ID](/building-with-passport/stamps/passport-api/getting-access) and the specified wallet address to pull users' custom scores. --- ## Building with Passport > Stamps > Major concepts ### Scoring thresholds URL: https://docs.passport.xyz/building-with-passport/stamps/major-concepts/scoring-thresholds # Scoring thresholds A very common [use case](/overview/use-cases) for Human Passport is gating access based on Passport scores. In order to do this, application owners have to determine a cutoff for users that are, and are not, allowed to access some content or function. Typically, this cutoff is a certain Passport score above which users are allowed access; otherwise they are blocked. This is known as the **threshold score**. ## Human Passport's Scorer The `Unique Humanity (binary)` Scorer provided on the Passport app applies a threshold to users' Passport scores. This is how the Scorer is able to return a binary Sybil/non-Sybil response. The algorithm adds up the weights of each Stamp owned by each user and compares the result to a pre-defined threshold value. Each users score either exceeds that threshold or it doesn't, making it possible to assign them a binary score. **The threshold used by the Passport app is 20**. This is designed to be an effective default threshold value for general-purpose use. Passport data scientists use datasets of known Sybils and known humans to analyze how credentials are used by good and bad actors, and what threshold most effectively separates the two groups. However, it is important to note that it is not a perfect system. Not all Sybils will be eliminated at that threshold. On the other hand, higher thresholds might create excessively high barriers to entry that eliminate honest human users. ## Trade-offs Choosing a threshold is always a balance between eliminating bad actors on the one hand, and making your application useable for honest humans on the other. A very high threshold will be more effective at eliminating Sybils because the time, effort and possibly money expended to meet the threshold are greater. This means it is less economically viable for bad actors to create large numbers of fake accounts. However, your honest users also have to meet those same criteria. If they are too onerous or difficult, your honest users might be unable or unwilling to participate. Therefore, there is always a balance to strike between widening honest participation and reducing dishonest participation. Where the right balance lies will differ from project to project. The Passport default of 20 is thought to be a good all round starting point. |Unique Humanity score | Effectiveness at eliminating Sybils | Risk of screening out real users | |---------------|---------------|---------------| | 20 | Effective | Low | | 25 | More effective | Medium | |30 | Most effective | High | By implementing your own Scorer, you can tweak the entry requirements to your application more finely. Not only can you change the threshold, but you can upweight or downweight certain Stamps that are particularly strong signals for your specific use-case. You could even have certain Stamps as absolute requirements, or use a combination of required Stamps and an overall score threshold. Learn more about custom Scorers in our [API reference](/building-with-passport/stamps/passport-api/api-reference). --- ### Credential Map and Weights URL: https://docs.passport.xyz/building-with-passport/stamps/major-concepts/credential-map-and-weights # Credential Map and Weights The Stamp-based realtime verification product uses a set of Stamps and underlying weighted credentials to determine the Unique Humanity Score of a user. ## Stamps and credentials Each Stamp partner or concept has their own Stamp that users can see and interact with see in their Passport. Each Stamp can have one or multiple underlying weighted credentials, which represent an identity verification activity within the Stamp partner's ecosystem. The weights assigned to each credential represent how strong of a human signal the underlying verification activity represents. The higher the point allocation to a credential, the better the human signal. ## Customizations If you'd like to customize these credentials, you can do so with [Custom Passport](/building-with-passport/stamps/custom-passport) Custom Passport enables you to customize the Passport Stamp lineup around your ecosystem's unique needs. You can make the following adjustments: - Remove Stamps that don't fit your needs - Adjust the weights of existing Stamps - Create your own allowlist-based or GitHub activity-based Stamps If you're interested in learning more about how to customize the Passport Stamp lineup, please reach out to us via this [form](https://tally.so/r/3X81KL). ## Credential Map and Weights The following table will help you understand how to map the different available credentials to their corresponding Stamps and weights. It is sorted based on the Stamp, orderred highest points to least. *These weights were last updated November 2025 -- See [Stamp Changelog](#stamp-changelog) for more details* | Stamp | Credential | Weight | |--------------|--------------------------------------------------------------|------------| | Binance | BinanceBABT | 10.021 | | Biometrics | Biometrics | 6.000 | | Discord | Discord | 2.800 | | ENS | Ens | 0.208 | | ETH Activity | **total** | 22.541 | | | ETHScore#50 | 16.021 | | | ETHScore#90 | 2.926 | | | ETHScore#75 | 2.399 | | | ETHDaysActive#50 | 0.207 | | | ETHGasSpent#0.25 | 0.778 | | | ETHnumTransactions#100 | 0.210 | | Gitcoin | **total** | 6.237 | | | GitcoinContributorStatistics#totalContributionAmountGte#10 | 0.223 | | | GitcoinContributorStatistics#totalContributionAmountGte#100 | 1.017 | | | GitcoinContributorStatistics#totalContributionAmountGte#1000 | 4.997 | | GitHub | **total** | 6.026 | | | githubContributionActivityGte#30 | 1.879 | | | githubContributionActivityGte#60 | 1.888 | | | githubContributionActivityGte#120 | 2.259 | | Google | Google | 0.525 | | Government ID | HolonymGovIdProvider | 16.026 | | Guild | GuildAdmin | 0.468 | | Identity Staking | **total** | 12.506 | | | SelfStakingBronze | 0.897 | | | SelfStakingSilver | 2.066 | | | SelfStakingGold | 2.700 | | | BeginnerCommunityStaker | 0.673 | | | ExperiencedCommunityStaker | 2.161 | | | TrustedCitizen | 4.009 | | Linkedin | Linkedin | 1.531 | | NFT | **total** | 22.053 | | | NFTScore#50 | 16.246 | | | NFTScore#90 | 2.413 | | | NFTScore#75 | 2.362 | | | NFT | 1.032 | | Phone Verification | HolonymPhone | 1.521 | | Proof of Clean Hands | CleanHands | 3.000 | | Safe | GnosisSafe | 0.222 | | Snapshot | SnapshotProposalsProvider | 0.239 | | Steam | SteamGamingCredentials | 2.800 | | X | X | 3.200 | | zkEmail | **total** | 4.000 | | | ZKEmail#AmazonCasualPurchaser | 1.000 | | | ZKEmail#AmazonRegularCustomer | 0.600 | | | ZKEmail#AmazonHeavyUser | 0.400 | | | ZKEmail#UberOccasionalRider | 1.000 | | | ZKEmail#UberRegularRider | 0.600 | | | ZKEmail#UberPowerUser | 0.400 | ## Stamp Changelog January 2025 launch We launched several additions, subtractions, and updates to the Passport Stamp lineup that will help enable users who are new to web3, users from more global regions, and low-income users to more easily verify their identity and participate in the Passport-protected programs. | Stamp | Credential | Action | Date | Details | |--------------|-------------------------------------------|-------------------------|---------------| ----------------| | Physical Address | TBD | Adding | TBD | We are planning to add a new Physical Address Stamp, which awards points for verifying different activities related to a physical address. | | Biometrics | Biometrics | Updated | January 2025 | Graduating from beta. Weight increased from 5.0 to 6.0. | | Proof of Clean Hands | CleanHands | Updated | January 2025 | Graduating from beta. Weight increased from 1.0 to 3.0. | | Discord | Discord | Updated | January 2025 | Updated requirements: Account age > 365 days, member of 10+ servers, has 2+ verified external connections. Weight increased from 0.516 to 2.8. | | X | X | Added | January 2025 | Re-added the X Stamp with updated requirements: Premium, Premium+, Business, Government, or Legacy verification; at least 100 followers; account age > 365 days. Weight: 3.2. | | Steam | SteamGamingCredentials | Added | January 2025 | Added the Steam Stamp with requirements: 100+ hours total playtime, 10+ achievements earned, 3+ games with >1 hour each, no more than 50% playtime in a single game. Weight: 2.8. | | Guild | GuildPassportMember | Removed | January 2025 | Removed the GuildPassportMember credential from the Guild.xyz Stamp. | | Idena | IdenaState#Newbie, IdenaState#Verified, IdenaState#Human | Removed | January 2025 | This Stamp was too difficult for users to achieve, and the effort to maintain it was not sustainable for the Passport ecosystem. | | BrightID | Brightid | Removed | January 2025 | The effort to maintain, along with the lack of quality human signal, was not sustainable for the Passport ecosystem. | | zkEmail | ZKEmail#AmazonCasualPurchaser, ZKEmail#AmazonRegularCustomer, ZKEmail#AmazonHeavyUser, ZKEmail#UberOccasionalRider, ZKEmail#UberRegularRider, ZKEmail#UberPowerUser | Adding | November 4, 2025 | We launched the phase 1 version of the ZK Email Stamp, which awards points for Amazon and Uber activities. Phase 2 is in the ideation phase. | | Lens | Lens | Removed | August 7, 2025 | Lens protocol changed and the cost and effort to maintain the Lens Stamp was not sustainable for the Passport ecosystem | | Civic | CivicUniquenessPass, CivicLivenessPass | Removed | July 8, 2025 | Civic retired the Civic Pass product | | Biometrics | Biometrics | Added | July 3, 2025 | We introduced human.tech's biometrics verification to replace the Civic Pass biometrics Stamp | | Civic | CivicCaptchaPass | Removed | July 1, 2025 | Civic retired the Civic Pass product | | Proof of Clean Hands | CleanHands | Added | May 1, 2025 | We added the human.tech Proof of Clean Hands Stamp, which checks KYC and sanctions lists for the given address | | Coinbase | CoinbaseDualVerification | Removed | Feb 15, 2025 | Increased fraud rates from Coinbase caused us to temporarily remove this Stamp | | zkSync | zkSyncWallet | Removed | Dec 18, 2024 | We incorporated the zkSync model into the aggregate model, which makes up the backend of the ETH Activity Stamp | | Trusta | trusta | Removed | Dec 18, 2024 | Fraud rates associated to the Trusta stamp were increasing to levels that were not sustainable for the Passport ecosystem | | ETH Activity | ETHScore#50, ETHScore#75, ETHScore#90 | Updated | Dec 18, 2024 | We rebuilt the back end of the ETH Activity Stamp to use our [aggregate model](/building-with-passport/models/available-models) as opposed to just the ETH L1 model | --- ### Deduplicating Stamps URL: https://docs.passport.xyz/building-with-passport/stamps/major-concepts/deduplicating-stamps # Deduplicating Stamps ### Why is deduplication necessary? Stamp deduplication is a crucial feature that prevents users from amplifying their influence over some specific outcome by submitting the same Stamps across multiple Passports. It is important for users to be able to hold multiple Passports representing different user profiles that might be used to as identification in specific communities. However, without deduplication logic, this could allow users to repeatedly attach the same Stamps to multiple Passports, fooling an app into treating each Passport as a real, verified human. Deduplication ensures that a user can only associate an individual Stamp to one single identity within a specific context. ### Do you need to handle deduplication in your app? If your app uses a Passport default Scorer, then deduplication is already handled server-side. When you request a score through the API, we calculate scores after already deduplicating Stamps, meaning you don't have to implement any deduplication logic yourself. However, if you are using your own custom scoring mechanism based on Stamp data, you will have to implement deduplication for yourself. Each Stamp has a `hash` field that can be used as a unique identifer. You can store hashes and compare them across all your users' Passports to ensure they are not being used multiple times. Our Scorer uses a Last-In-First-Out mechanism to handle duplicates, but you might want to use your own algorithm in your custom Scorer. ### How does Human Passport handle duplicate Stamps? Passport handles the issue of Stamp duplication by automatically identifying and eliminating duplicate Stamps. This prevents users from using the same credentials to verify their Stamps and identity across multiple Passports. This ensures that each user in an application has a unique and consistent digital identity. By default, the Stamps API uses a **Last In, First Out (LIFO)** Stamp deduplication method. This means that, in a given scoring instance, if a Passport holder submits a Stamp that has already been submitted by another user, the _duplicate_ Stamp is ignored and not counted towards the score. For example, let’s say you build an application that uses the Stamps API to verify the unique humanity of your users. Two Passports, “Passport A” and “Passport B,” present the same Stamp based on the same Twitter account. In this scenario, the Last-in-First-out deduplication method would only count the Stamp instance that was submitted earliest, ignoring the one that was submitted later. For example, if Passport A submitted the Twitter Stamp first, followed by Passport B, your app would only count the instance of the Twitter Stamp submitted by Passport A. The same rule applies to any subsequent instances of the Stamp. This LIFO method ensures that each Passport’s score accurately reflects the unique identity of its holder. This prevents duplicate Stamps from skewing the verification process and prevents users from re-using evidence of personhood across multiple Passports within an application. ### Things to note Stamps are unique to scoring instances. For example, one user uses Passport holder A with one Twitter account in an application that uses scoring instance X, and another user uses the same Twitter account in a distinct Passport in an independent scoring instance Y. In this case, both users will get scored for the Twitter account. As long as the scoring instances are independent, there is no concern for double counting or interference between instances. This allows users to create multiple personas that they use in different contexts but prevents double-counting of their credentials within a context. The scores assigned to Passports will not change once they are issued. This means that there is no need to recalculate Passport scores or synchronize them again in case of duplicate Stamp submissions. Once a score is assigned to a Passport, it remains fixed and can be relied upon for future verifications, even if a duplicate Stamp is submitted by a new Passport. This makes the scoring process more efficient and streamlined, which is particularly important for large and complex applications that score a high volume of verifiable credentials. Also note that because Stamp deduplication is achieved using a 'last in, first out' model, it is possible for Passports with identical Stamps to return different scores from different Scorers. The reason is that if the identical passports A and B are submitted to Scorer 1 in the order `A,B`, the returned score could be different to the same Passports submitted to Scorer 2 in the order `B,A`, because different instances of duplicate Stamps would be removed. ### Summary The LIFO deduplication strategy has several benefits for Passport holders and developers. It ensures that each Passport holder (in other words, Ethereum address) is assessed based on their unique set of Stamps, and that no one receives an unfair advantage due to having the same Stamp as another Passport holder within a given scoring instance. This means that for applications using the Stamps API, there will be no double-counting of Stamps within the app, ensuring a fair and accurate assessment of each user’s unique identity. --- ### Stamp and score expiry URL: https://docs.passport.xyz/building-with-passport/stamps/major-concepts/expirations # Expirations Stamps and scores eventually become invalid. This is a security feature that provides a degree of confidence that the Stamps and scores you query in your application are still valid. Without some mechanism for Stamp expiry, a Stamp issued once would remain valid forever, even if the evidence supporting that Stamp or score had long since changed. For example, a user could mint a Stamp using an account on some Web2 service in the small window between creating the account and it being shut down by the service's compliance team. Without expiry, you would not be able to tell, but with expiry, after some time the user would simply not be able to reverify the Stamp. The shorter the time between the issuance date and the expiration date, the more security you gain, but the trade off is that the user experience deteriorates because users are forced to reverify frequently. ## Offchain Stamps Offchain Stamps expire after 90 days. This is handled by the Human Passport server. Users can bump the expiry date by another 90 days by reverifying your Stamps on the [Passport app](https://app.passport.xyz). ## Onchain Stamps Like offchain Stamps, onchain Stamps also expire. For Passport attestations, there is a key in the schema called `Expiration Dates`. An integrator can query this field to see whether the current time is later or earlier than the `expiryDate` and use this to determine whether a Stamp has expired. The `expiryDate` is automatically set to 90 days after the `issuanceDate`. Reverification requires issuing a new Passport attestation. Onchain scores do not have an explicit expiry date associated with them. Integrators can use the attestation transaction time as a proxy for the issuance date. As a rule of thumb, we recommend expiring scores 90 days after it was created. Offchain Stamps also expire after 90 days. [More details on onchain Stamp and score expiry](../smart-contracts/onchain-expirations). --- ### API pagination URL: https://docs.passport.xyz/building-with-passport/stamps/major-concepts/api-pagination # API pagination Some requests are likely to return a large amount of data. You can paginate it by adding `?limit=`, where `x` is the number of elements of the dataset you wish to return in each response, to the end of the request. This instructs the server to only send x "pages" of the response. For the Stamps endpoint, `x` refers to the number of Stamp objects to return in each response. The full request to the Stamp endpoint, including the pagination instruction and headers, could look as follows: ```bash curl --request GET 'https://api.passport.xyz/v2/stamps/{address}?limit=3' \ --header 'X-API-KEY: {API-KEY}' ``` In this example, the API will return three Stamps in each response. To help you navigate, the returned data includes values in the `prev` and `next` fields. These are endpoint URLs with pre-filled query parameters you can use to retrieve the previous or next chunk of data. Note that if you request a `limit` of 3, your `next` value is also going to have a `limit` of 3. For example, if the response contains Stamps 4, 5 and 6, the URL in `prev` will return Stamps 1, 2, and 3. The URL in `next` will return Stamps 7, 8, and 9. This is what a response looks like with the `next` and `prev` fields. Notice these fields values are endpoint URLs. ```json { "next": "https://api.passport.xyz/v2/stamps/{address}?token=bmVw%4dFNQ9fM3TcxMTcD%3D&limit=3", "prev": "https://api.passport.xyz/v2/stamps/{address}?token=c9fMTcHJlTcwdlxMNQ%3D%3D&limit=3", "items": [ { "version": "1.0.0", "credential": {...} } ] } ``` To retrieve the next page of results you can use the URL provided in the `next` field, in this case: ```bash curl --request GET 'https://api.passport.xyz/v2/stamps/{address}?token=bmVw%4dFNQ9fM3TcxMTcD%3D&limit=3' \ --header 'X-API-KEY: {API-key}' ``` --- ### Educating end users URL: https://docs.passport.xyz/building-with-passport/stamps/major-concepts/educating-users # Platform Integrator concepts This page is for platforms who integrate with Human Passport and make its sybil-resisting functionality available to their ecosystem partners. On this page, you will learn what types of attacks Human Passport can protect against, see examples of existing platform integrations, understand integration best-practices and identify the key information your users need to know. ### Audience definitions First off, some audience definitions: 1. **Platform Integrator:** An application that integrates with Passport and makes the functionality available to their ecosystem partners. 2. **Ecosystem partners:** Organizations or apps who use the platforms built by Platform Integrators. 3. **End-users:** People who are engaging with the ecosystem partner's content or programs within the platform. We'll use [Snapshot](https://snapshot.org/#/) as an example. Snapshot is an offchain voting platform that allows DAOs, DeFi protocols, or NFT communities to participate in decentralized governance. Within the Snapshot platform, Optimism Collective allows users to vote on proposals using Snapshot's technology. In this situation, Snapshot would be a platform integrator, Optimism Collective would be an ecosystem partner, and the users submitting and voting on proposals are end-users. Here are some examples and their Passport use cases: | Platform Integrator | Ecosystem Partner | End user | Why the Platform integrating Human Passport is a win for everyone | | ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | Snapshot | DAOs and other groups that need a proposal and voting system | DAO contributors and other voters | Voting outcomes that bias towards real democracy and less so algorithmic manipulation | | Guild | Guild admins | Guild members | Rewards going to unique humans instead of bots and Sybils | | Galxe | Community engagement campaign creators | People who want to earn rewards by participating in campaigns | Rewards going to unique humans instead of bots and Sybils | ### What are Sybils and why should you care? Sybil attacks describe the abuse of a digital network by creating many illegitimate virtual personas. There are several ways that users can become incentivized to create Sybil accounts, for example to receive a reward multiple times, or have additional influence over a vote. They prevent you from efficiently allocating power and/or capital among your community by capturing it for some dishonest person or group. Without some form of Sybil defense, you have no way to tell whether the users showing up to your application really represent individual human users or whether they are actually bots or fake accounts. ### What is Sybil defense? Sybil defense is a catch-all term for any actions that minimize the effect of Sybils. Typically, Sybil defense involves filtering out users that can't provide sufficient evidence that they are real human individuals. The more effective the Sybil defense, the more confident you can be that your users are real, and the more effectively you can distribute rewards, votes and other forms of capital and agency to your community. Human Passport is a Sybil defense tool. It provides everything you need to check the personhood of your users without invading their privacy. Read more about Sybil defense on the [blog](https://passport.human.tech/blog). ### How to integrate Human Passport into your platform The most common way platforms use Human Passport is to use Passport scores or specific combinations of Stamps to control access to some content or function. This can be handled in just a few simple functions in your app. We have detailed guides demonstrating various Passport integrations. After you have integrated Passport into your app, your users can connect their Ethereum wallet, and the app can make an API call to the Passport server to retrieve the user's Stamps and Passport score. The score is the sum of weights assigned to the user's Stamps. It is possible to create custom algorithms for scoring Passports from raw Stamp data, but using Passport's server is considered best practice for several reasons: 1. You benefit from [Stamp weights](/building-with-passport/stamps/major-concepts/credential-map-and-weights) that have been assigned by Human Passport data scientists. 2. You do not have to handle complications such as [Stamp deduplication](deduplicating-stamps) - the server does this for you. 3. You can follow our simple [quick start guide](/building-with-passport/stamps/passport-api/quick-start-guide) to quickly and easily start defending your app from Sybils! While utilizing the Passport score is a best practice, you could also use Stamp data in addition to the Passport score, or just use Stamp data to gate access. For example, a few specific Stamps might be particularly important to you (maybe you decide that having a Github account for over 180 days is a hard requirement to access your platform). In this case you can access your user's Stamp collection and confirm ownership of individual Stamps. Finally, you might not necessarily want to automatically gate access based on Passport scores or Stamps. Perhaps you want to display Stamp and score information about each user so platform administrators or end users can make real-time decisions based on the user's trustworthiness or reputation. For example, you might have to determine an honest user from several impersonator accounts. Quick access to Stamp and score data would give you a strong signal about who is the genuine user. There is a guide for displaying Stamp and score data in your app's UI in our [API reference](/building-with-passport/stamps/passport-api/api-reference). Read more on [How Passport works](/overview/). Start building using our [quick start guide](/building-with-passport/stamps/passport-api/quick-start-guide). ### **What does this look like for ecosystem partners?** It would be helpful to understand the [audience definitions](#audience-definitions) in the introduction of this page when reading this section. If integrated properly, ecosystem partners utilizing a platform's services will be able to utilize Passport functionality to ensure that their content or programs are minimally affected by Sybils. For example, an ecosystem partner runs a forum and voting platform in addition to their main application. Integrating Passport across all these platforms gives them confidence that your whole organization is protected to the same standard, with the same configuration. A Passport integration is straightforward, flexible and configurable to ecosystem partners' needs depending on how a platform integrator builds the integration. You can easily set global configurations that are standard across all platforms and partners, or you could tailor your Sybil defences to each platform, so that you can have stricter controls for more sensitive services. ### What does this look like for end users? End users benefit from a very straightforward verification process and proof of personhood they can use across web3. Human Passport is a very widely used Sybil defense tool that your users can set up once and then use to identify themselves to all kinds of apps and services. Your end users can follow this simple guide to set up their Passport: 1. To get started, you must have an Ethereum wallet. 2. Then, you can visit the [Passport app](https://app.passport.xyz/). 3. There, you can sign in with Ethereum and connect Stamps to your Passport in a few clicks. 4. When they want to utilize a tool that is Passport-gated, you can sign a message and provide access to the platform provider to read your Stamp and score data. ### More customization Some platforms will find that they have specific needs that are not met by the standard Stamp library. In that case, you can add a new Stamp specifically for your purpose! Creating a Stamp requires some provable action to be captured in the form of a Verifiable Credential. We have created a [step-by-step guide](/building-with-passport/stamps/create-a-stamp/integrating-a-new-stamp) to help platforms to create new Stamps. The weights assigned to individual Stamps in the Passport scoring app are also likely to change if re-weighting is likely to improve the overall Sybil defence efficacy of the Scorer. You can also implement your own scoring algorithm if the default weights aren't right for your use-case. ### Use cases Human Passport is already protecting many real world applications! You can read about active integrations on the [Active Integrations](/overview/active-integrations) page and on the [blog](https://passport.human.tech/blog). ### Where to go from here? * Read more about [how Passport works](/overview/why-human-passport) * Get you own Passport at [https://app.passport.xyz](https://app.passport.xyz) * You can join the [Passport Developer Telegram](https://t.me/+Mcp9RsRV7tVmYjZh) and ask questions to the developers, users and wider community --- ## Building with Passport > Stamps > Stamps API v2 ### Stamps API v2 overview URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/introduction # Stamps API v2 Passport Stamps is an aggregate, real-time verification tool that can enable users to prove their unique humanity using a variety of different verification methods, and for developers to access these humanity proofs via the Stamps API or [smart contracts](/building-with-passport/stamps/smart-contracts). Users can prove their humanity using Passport Stamps by visiting the [Passport App](https://app.passport.xyz) and completing a verification flow, or by using the [Passport Embed](/building-with-passport/embed) widget on a partner website or dApp. ## Why use the API The Stamps API offers a simple integration; one that requires just one request to receive users' Stamp-based Unique Humanity Score and associated metadata. This data is retrieved from the centralized Human Passport servers, meaning it is the most up-to-date data available for Human Passport users. All Passport Stamps user data can be accessed via the Stamps API, whereas only a portion of users' have minted their Passport onchain, making it available via our [smart contracts](/building-with-passport/stamps/smart-contracts). ### Example flow An excellent [use case](/overview/use-cases) for Human Passport is to protect access to a reward or governance program. To make this happen, follow these steps: 1. [Creating a Passport Project/Scorer and API key](/building-with-passport/stamps/passport-api/getting-access) 2. Retrieve a user's Passport score and Stamp data using the [GET /v2/stamps/\{scorer_id\}/score/\{address\}](/building-with-passport/stamps/passport-api/api-reference#retrieve-latest-score-for-a-single-address) endpoint. 3. Find the user's Unique Humanity Score or `passing_score` within the returned data. 3. Compare the Unique Humanity Score against a [threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) that you set, or utilize the binary `passing_score` field that uses our recommended threshold of 20. If a user was able to build up a score greater than this threshold, they've effectively proven their humanity and you can grant access to the protected program. ## Available endpoints Stamps API v2 base URL: https://api.passport.xyz | Endpoint action | Endpoint | | ----------------------------------------------- | ------------------------------------------- | | [Retrieve latest score for a single address](/building-with-passport/stamps/passport-api/api-reference#retrieve-latest-score-for-a-single-address) | `GET /v2/stamps/{scorer_id}/score/{address}` | | [Retrieve Stamps verified by a single address](/building-with-passport/stamps/passport-api/api-reference#retrieve-stamps-verified-by-a-single-address) | `GET /v2/stamps/{address}` | | [Retrieve all Stamps available in Passport](/building-with-passport/stamps/passport-api/api-reference#retrieve-all-stamps-available-in-passport) | `GET /registry/stamp-metadata` | Learn more about each of these endpoints on our [API Reference](/building-with-passport/stamps/passport-api/api-reference) page, or experiment with them using our [API playground](https://passport-api-playground.vercel.app). ## Next steps * [Try the API playground](https://passport-api-playground.vercel.app) * [Set up an API key and Scorer/Project](/building-with-passport/stamps/passport-api/getting-access) * [Make your first API request](/building-with-passport/stamps/passport-api/quick-start-guide) * [Review the API Reference to get to know the available endpoints](/building-with-passport/stamps/passport-api/api-reference) * [Get support via our Telegram channel](https://t.me/+Mcp9RsRV7tVmYjZh) --- ### Getting access to the Stamps API v2 URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/getting-access # Getting Access: Scorer ID and API Key The Stamps API provides programmatic access to a wallet's Passport score. Once you have your API key, you need to include it with each request you make to the API. This allows Human Passport to identify your app and verify that you are authorized to access the API. ### Getting Your API Key 1. **Log in to the developer portal:** Go to [developer.passport.xyz](https://developer.passport.xyz) and log in to your account by connecting your wallet. 2. **Navigate to the API Keys section:** After logging in, go to the "API Keys" section. 3. **Generate an API key:** Click on the "+ Create a Key" button to generate a unique API key for your account. 4. **Store your API key securely:** Store your API key in a secure place, as it will be used to access the Stamps API. ### Getting your Scorer ID A Scorer is an developer element that can be used to organize different use cases. You need to create a Scorer and associated Scorer ID to be able to request user data via the Stamps API. If you are using the Stamps API in multiple use cases, you should set up separate Scorers for each one. 1. **Log in to the Developer Portal:** Go to [developer.passport.xyz](https://developer.passport.xyz) and log in to your account by connecting your wallet. 2. **Navigate to the Scorer section:** After logging in, go to the "Scorer" section 3. **Create a Scorer:** Click on the "+ Create a Scorer" button and input a Scorer name, description, and [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) (recommended 20). You only need to add a score threshold if you plan to use the Passport Embed product, or plan to use the `passing_score` field in the Stamps API response. 4. **Find your Scorer ID:** Once created, you can find your Scorer ID from the main Scorers page in the Developer Portal. ### Next step * [Try the API playground](https://passport-api-playground.vercel.app) * [Make your first API request](quick-start-guide) * [Review the API Reference to learn more about the available endpoints](api-reference) --- ### Stamps API v2 quick start guide URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/quick-start-guide # Quick Start This page will help you make your first API request using the Stamps API v2. You can also experiment with the Stamps API using our [API playground](https://passport-api-playground.vercel.app). ## API basics Please make sure you have an [API key and Scorer ID](getting-access) before working through this guide. The base URL for the API methods we'll be using is `https://api.passport.xyz`. There are several API endpoints that can be accessed by extending this base URL. You can browse more specific API details in the [API reference](api-reference). ## How to retrieve a score There is one basic step to retrieve a user's Passport score and Stamp data. All you have to do is make a request to the following GET endpoint: ``` GET /v2/stamps/{scorer_id}/score/{address} ``` This endpoint requires a `scorer_id` and an `address` to be passed as path parameters. You can see an example of this in the following cURL request, using a scorer ID, `100`; an address, `0x2C1E111d7C3adc823B5fA3af3f07EB62831C3c5`; and a placeholder (`{your-api-key}`) that you need to replace with your API key: ```bash filename="Sample request" copy curl --request GET \ --url https://api.passport.xyz/v2/stamps/100/score/0x2C1E111d7C3adc823B5fA3af3f07EB62831C3c5 \ --header 'X-API-KEY: {your-api-key}' ``` An example response might look as follows: ```json filename="Sample response" { "address": "0x2C1E111d7C3adc823B5fA3af3f07EB62831C3c5", "score": "33.538", "passing_score": true, "last_score_timestamp": "2024-11-17T14:46:22.900951+00:00", "expiration_timestamp": "2025-02-06T14:28:06.879000+00:00", "threshold": "20", "error": null, "stamp_scores": { "Discord": "0.516", "Google": "0.525", "NFT": "1.032", "SnapshotProposalsProvider": "0.839", "zkSyncScore#5": "1.67", "zkSyncScore#20": "1.67", "zkSyncScore#50": "1.67", "ZkSyncEra": "0.606", "Lens": "0.93", "ETHGasSpent#0.25": "1.003", "GuildPassportMember": "0.54", "CivicUniquenessPass": "6.005", "TrustaLabs": "0.511", "BinanceBABT": "16.021" } } ``` This response indicates that the address was successfully able to prove their humanity with Passport since their score is above the recommended threshold of 20. It's worthwhile to note that you can manually set your own [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) within your code base based on your ecosystem's unique needs, but a score threshold of 20 is recommended for optimal results. ### Next Steps * [Try the API playground](https://passport-api-playground.vercel.app) * [Review the API Reference to learn more about the available endpoints](api-reference) * [Get support via our Telegram channel](https://t.me/+Mcp9RsRV7tVmYjZh) --- ### Stamps API v2 -- API reference URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/api-reference # Stamps API v2 -- API Reference The Stamps API enables developers to retrieve Human Passport scores and Stamp metadata for users who have created a Passport. You can also experiment with the Stamps API using our [API playground](https://passport-api-playground.vercel.app). In the examples below, replace the following placeholder values with your actual data: - `{scorer_id}` - Your Scorer ID from the developer portal - `{address}` - The Ethereum address you want to score - `{API_key}` - Your API key from the developer portal ## Authentication To access the Stamps API, you will need a [Scorer ID and an API key](getting-access). To make a successful request, you will need to include your API key in the "Authorization" header of each API request. The header should have the following format: ``` "X-API-KEY: {API_key}" ``` Replace `{API_key}` with your API key. For example, if you were using cURL, your request might look something like this: ```bash curl --request GET 'https://api.passport.xyz/v2/stamps/{scorer_id}/score/{address}' \ --header 'X-API-KEY: VwUi___.0yQU1HIAE4hLEMkVs___' ``` ## Rate limits Your API key will allow you to make up to a certain number of requests to any of the endpoints included on this page during a certain period of time. Requests made to the Stamps API v1 and v2 count towards the same rate limit. Access starts with Tier 1. If you need an elevation, please [request higher rate limits](https://docs.google.com/forms/d/e/1FAIpQLSeUATg0nTE9ws3qESGBktFcOX0brF19iv2L0BLoiub9pbSMeg/viewform). | Tier | Rate limit | | ------ | ----------------------------- | | Tier 1 | 125 requests per 15 minutes | | Tier 2 | 350 requests per 15 minutes | | Tier 3 | 2000 requests per 15 minutes | | Tier 4 | 2000+ requests per 15 minutes | ## Key concepts There are several key concepts you should be aware of when using the Stamps API: * **Timeouts:** The Stamps API endpoints have a timeout of 60 seconds. This means that if a request to one of these endpoints does not receive a response within 60 seconds, the request will be aborted. If your request times out, you should set up retry logic by calling the API again after a short delay, typically increasing the delay for each subsequent retry. * **Pagination:** Some requests return a large amount of data. To effectively retrieve this data, you will need to paginate the response. For more information, see [API pagination](/building-with-passport/stamps/major-concepts/api-pagination). * **Data dictionary:** For definitions of the data types used in Stamps API v2, see the [Data dictionary](/building-with-passport/stamps/passport-api/data-dictionary) page. ## Available endpoints Stamps API v2 base URL: https://api.passport.xyz | Endpoint action | Endpoint | |---------------------------------------------------------------------------------------------------|-------------------------------------------------------------| | [Retrieve latest score for a single address](#retrieve-latest-score-for-a-single-address) | `GET /v2/stamps/{scorer_id}/score/{address}` | | [Retrieve Stamps verified by a single address](#retrieve-stamps-verified-by-a-single-address) | `GET /v2/stamps/{address}` | | [Retrieve all Stamps available in Passport](#retrieve-all-stamps-available-in-passport) | `GET /v2/stamps/metadata` | ### Retrieve latest score for a single address This is the primary endpoint that integrators should use. This endpoint will return the latest score and Stamp data for a single address. > GET /v2/stamps/\{scorer_id\}/score/\{address\} ```bash filename="Sample request" copy curl --request GET \ --url https://api.passport.xyz/v2/stamps/{scorer_id}/score/{address} \ --header 'X-API-KEY: {API KEY}' ``` ```json filename="Sample response" { "address": "{address}", "score": "{overall_score}", "passing_score": true/false, "last_score_timestamp": "{last_score_time ISO 8601}", "expiration_timestamp": "{expiration_time ISO 8601}", "threshold": "20", "error": null, "stamps": { "Ens": { "score": "{credential_score}", "dedup": true/false, "expiration_date": "{expiration_time ISO 8601}" }, "ETHDaysActive#50": { "score": "{credential_score}", "dedup": true/false, "expiration_date": "{expiration_time ISO 8601}" }, "ETHGasSpent#0.25": { "score": "{credential_score}", "dedup": true/false, "expiration_date": "{expiration_time ISO 8601}" }, { ... } } } ``` Learn more about the [data dictionary](/building-with-passport/stamps/major-concepts/data-dictionary). ### Retrieve Stamps verified by a single address Use this endpoint to request all Stamps that have been verified by the specified Ethereum address. If you would like to retrieve the metadata for all available Stamps, please use the [Get Stamps metadata](#retrieve-all-stamps-available-in-passport) endpoint. > GET /v2/stamps/\{address\} #### Query parameters | Name | Required | Description | | ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `include_metadata` | No | Returns optional `metadata` object with additional details about connected Stamps.

Format: `true`/`false`
Default: `false` | | `limit` | No | Paginates response, providing the given number of Stamps per page (For example, use `limit=3` to request three Stamps) Learn more about [API pagination](/building-with-passport/stamps/major-concepts/api-pagination). | | `token` | No | Pass the `next` or `prev` value from the previous response to get the next or previous page of results. | ```bash filename="Sample request" copy curl --request GET \ --url 'https://api.passport.xyz/v2/stamps/{address}?include_metadata=true' \ --header 'X-API-KEY: {API KEY}' ``` ```json filename="Sample response" { "next": "string", "prev": "string", "items": [ { "version": "string", "credential": {}, "metadata": {} } ] } ``` ### Retrieve all Stamps available in Passport Use this endpoint to request all Stamps available on Passport. If you would like to retrieve just the Stamps that are connected to a specified Ethereum address, please use the [Get Stamps](#retrieve-stamps-verified-by-a-single-address) endpoint. > GET /v2/stamps/metadata ```bash filename="Sample request" copy curl --request GET \ --url https://api.passport.xyz/v2/stamps/metadata \ --header 'X-API-KEY: {API KEY}' ``` ```json filename="Sample request" [ { "id": "string", "icon": "string", "name": "string", "description": "string", "connectMessage": "string", "groups": [ { "name": "string", "stamps": [ { "name": "string", "description": "string", "hash": "string" } ] } ] } ] ``` --- If you have questions about the API, please reach out to us in our [developer support channel](https://t.me/+Mcp9RsRV7tVmYjZh). --- ### Data dictionary (Stamps API v2) URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/data-dictionary # Data dictionary (v2) On this page you will find definitions and explanations for the data types used in the Human Passport stack. The `Scorer`, `Stamp` , `Credential` and `Stamp-metadata` objects require the most explanation so they are handled separately here. ### The Scorer object | Value | Type | Description | How to use | | ---------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `address` | String (hexadecimal address) | The `string` of 20 bytes that uniquely identify an Ethereum account | Identifies a specific account to which the payload's data relates. | | `score` | Integer | The user's score, as calculated by the Stamps API. If you'd like to use your own [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds), you can compare this score against that threshold to identify which users should be provided access. | | `passing_score` | Boolean | Passing score will return either `true` or `false` as its value, depending on whether the user's score exceeded the `threshold` score of `20`, as recommended by the Passport team. You can also choose your own [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) and use the `score` value if you'd prefer. | If you'd like to use the Passport recommended score threshold, you can use this value to identify which users should be provided access. | | `last_score_timestamp` | String (ISO 8601 datetime) | The date and time of the request. | Can be used to identify when the snapshot of this data occured. | | `expiration_timestamp` | String (ISO 8601 datetime) | The date and time that the next Stamp will expire, which will subsequently reduce the `score`. To see when each specific Stamp expires, please use the [GET /v2/stamps\{address\}](api-reference#retrieve-stamps-verified-by-a-single-address) endpoint. | You might want to display this score expiration to the user to remind them to return to the Passport app to refresh their score before it expires | | `threshold` | Integer | The Passport recommended score threshold that the user's score must exceed to be considered passing. The current recommended threshold is `20`. You can also choose your own [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) and use the `score` value if you'd prefer. | If you'd like to use the Passport recommended score threshold, you can use this value to identify which users should be provided access. | | `error` | String | Describes any error returned by the server. Refer to the API [status and error codes page](status-and-error-codes) for more information. | Can be used to understand why a request failed. | | `stamps` | Object | Contains simplified credential objects for each [credential](/building-with-passport/stamps/major-concepts/credential-map-and-weights) that has been validated by the specified user. | The included credential objects within this object are the credentials that the user has verified. | | `stamps..score` | Integer | For each credential, you can see the score, that this verified [credential](/building-with-passport/stamps/major-concepts/credential-map-and-weights) contributes to your overall unique humanity score, or `score`, above.

If this specific credential is deduped, this score will be zero (0). | Can be used to understand how the overall unique humanity score was calculated. | | `stamps..dedup` | Boolean | If a specific credential has been [deduplicated](/building-with-passport/stamps/major-concepts/deduplicating-stamps) (in other words, if this same credential has been verified by another address), this boolean will come back as `true`.

IF `true`, the credential's score will be zero (0) and the credential will not contribute to the overall score. | This information can be used both to identify why a user's score is lower than expected and to publicly communicate these reasons to the user. | | `stamps..expiration_date` | String (ISO 8601 datetime) | Notes when this specific credential will expire.

If this specific credential is deduped, this expiration date will represent when the credential verified by the other address will expire, rather than when this credential will expire. | This information can be displayed to users to help them understand when their credential will expire. | ### The Stamp object | Value | Type | Description | How to use | | ------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `credential` | `object` | Message displayed in the Passport Scorer app alongside a button to trigger verification of a specific Stamp See [Credentials](#credentials) table below for more details. | This is what a Stamp actually comprises. It is associated with an Ethereum address. | | `items` | `array` | An array containing data for each individual Stamp. | Each object in this array represents a specific Stamp. | | `metadata` | `object` | Metadata is a object containing `id`, `icon`, `name`, `description`, and `connectMessage` fields for each provider and then more granular data for each of the provider's Stamps | Returned from the `GET /v2/stamps/{address}` endpoint if the parameter `include-metadata=true` is also passed. Returned from `GET v2/stamps/metadata` endpoint for all Stamps | | `next` | `string` | A pointer to the next page of returned data, if the returned data has been paginated. | You can use this is a request to access a page and the subsequent page of results for a paginated response. If the value is `null` you are already seeing all the available information. | | `prev` | `string` | A pointer to the preceding page of returned data, if the returned data has been paginated. | You can use this is a request to access a page and the previous page of results for a paginated response. If the value is `null` you are already seeing all the available information. | | `version` | `string` | A version identifier for a Stamp | Returned for each Stamp from `GET /v2/stamps{address}` | #### Credentials A `credential` is a object returned in the Stamp object. [Learn more about Verifiable Credentials via their w3 specification](https://www.w3.org/TR/vc-data-model-2.0/). This object has its own sub-fields as follows: | Value | Type | Description | How to use | | ------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `type` | `string` | A descriptor that shows what type of credential is present | Can be used to check that the returned data is of the expected objecture for a given credential type. This is usually going to have the value `VerifiableCredential`. | | `proof` | `object` | A object containing several fields comprising the proof that a certain action was taken, for example a signed auth token proving that an account was unlocked. | Used to verify ownership of a specific Stamp | | `issuer` | `hash` | Each Stamp issuer has a specific identifying hash provided in this field. | Used to identify a Stamp issuer | | `@context` | `url` | Link to the credential definition documentation. | Can be used to access reference documentation for the credential type | | `issuanceDate` | `datetime string` | The date and time that the Stamp was minted.
ISO 8601, `"2023-04-28T09:35:49.159Z"` | Can be used to check the age of a Stamp | | `expirationDate` | `datetime string` | The date and time the Stamp should expire.
ISO 8601, `"2023-04-28T09:35:49.159Z"` | Can be used to automatically expire a Stamp | | `credentialSubject` | `object` | Contains anonymized information about the user that the Stamp is issued to. This includes a unique ID, a hash, link to the data schema and the Stamp provider name in plaintext. | Can be used to connect Stamps to a user in a privacy preserving way | ### Stamp metadata | Value | Type | Description | How to use | | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `connectMessage` | `string` | Message displayed in the Passport scorer app alongside a button to trigger verification of a specific Stamp | Mainly used in the Passport app, but could be used to provide appropriate message for verification in other contexts | | `description` | `string` | Short description of what a specific Stamp demonstrates. For example, ownership of >0.5 ETH | Returned in Stamp metadata, can be used to understand a specific Stamp | | `groups` | `string` | Identifier for top-level groupings of Stamps for a given provider | Each provider may issue many Stamps which can be grouped together by theme, for example the Passport Provider groups Stamps by `Self GTC-staking` and `Community GTC-staking` | | `hash` | `string` | A unique hash representing a specific instance of a credential | Used to prevent the same Stamp being used multiple times in a specific Scorer instance | | `icon` | `string` | A URL for an image to represent each Stamp provider | Returned in Stamp metadata, can be used to load an icon for a Stamp provider | | `id` | `string` | An identifier for a Stamp | Returned in Stamp metadata, can be used to scrape data for a specific Stamp | | `name` | `string` | Name of the provider issuing a given Stamp | Returned as part of the Stamp metadata, can be used to scrape information for specific providers | | `stamps` | `array` | Array containing Stamp objects for each individual Stamp. Each Stamp has `name`, `description` and `hash` fields | Included in Stamp metadata. Used to identify specific instances of individual Stamps | --- ### Status and error codes URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/status-and-error-codes # Status and error codes ## HTTP Status codes | Code | Title | Description | | ---- | --------------------- | ------------------------------- | | 200 | OK | The request was successful. | | 400 | Bad request | Bad request | | 401 | Unauthorized | Your API key is invalid. | | 404 | Not found | The resource does not exist. | | 429 | Too Many Requests | The rate limit was exceeded. | | 500 | Internal Server Error | An error occurred with our API. | ## Error types All errors are returned in the form of JSON with a detail explaining the error > Example error response. ```json { "detail": "string" } ``` | Error Detail | Description | | ------------------------------------------ | -------------------------------------------------------------------------------- | | Invalid nonce | The `nonce` used in the submit Stamps API request could not be verified | | Address does not match signature | The signer could not be verified | | Invalid limit | The page limit of the Stamps API request is greater than 1000 | | Unable to get score for provided Scorer ID | Unable to validate that the Scorer ID belongs to the account holding the API key | | Unauthorized | `X-API-Key` was not specified in the header or an invalid API key was provided | | Internal Server Error | Something went wrong on our end | --- If you have questions about the API, please reach out to us in our [developer support channel](https://t.me/+Mcp9RsRV7tVmYjZh). More detailed information about this API's endpoints can be found in the [API reference](./api-reference). --- ### Stamps API migration guide URL: https://docs.passport.xyz/building-with-passport/stamps/passport-api/migrate # Stamps API v2 migration guide Migrating to Stamps API V2 is designed to be straightforward. This guide outlines the key changes and provides step-by-step instructions to help you update your integration smoothly. But first, why should you migrate? * Retrieve user scores with a single, intuitive GET request. * Gain access to more data to proactively prevent and resolve misunderstandings. * Retrieve both binary and numeric scores within the same payload * Benefit from a more unified API endpoint URI structure. If you'd prefer to learn by doing, please visit our [API playground](https://passport-api-playground.vercel.app) to see the changes in action. If you'd prefer to learn via our reference docs, please visit our [API reference](api-reference). ## Key changes to address 1. [The base URL](#the-base-url) 2. [Simplified score retrieval](#simplified-score-retrieval) 3. [Updated endpoint URIs](#updated-endpoint-uris) 4. [Unified Scorer types](#unified-scorer-types) 5. [Additional Stamp data in score payload](#additional-stamp-data-in-score-payload) ## The base URL In August 2024, the Passport workstream spun out of Gitcoin, creating Passport XYZ. We have been working on separating our infrastructure from Gitcoin, and the API base URL is finally getting its update. * Previous Base URL: https://api.passport.gitcoin.co * New Base URL: https://api.passport.xyz **Action Required:** Update all instances of the base URL in your application to the new URL. ## Simplified score retrieval ### Background In V1, retrieving a user's score involved: * Submitting the Passport for scoring using a POST request. * Retrieving the score using a GET request. This process was counterintuitive and could lead to confusion and stale scores if only the GET endpoint was used. ### What's new in v2 * **Single GET Request:** Retrieve the latest score and Stamp data with one GET request. * **No POST Required:** Eliminates the need to submit the Passport for scoring. ### Endpoint changes * **From V1:** `POST /registry/submit-passport` * **To V2:** `GET /v2/stamps/{scorer_id}/score/{address}` **Action Required:** Replace any `POST /registry/submit-passport` requests with GET requests to the new endpoint. ## Updated endpoint URIs We've adopted a more consistent, object-oriented design for our API endpoints. ### Endpoint mapping | From v1 | To v2 | |----------------------------------------------|-------------------------------------------------------| | `GET /registry/score/{scorer_id}/{address}` | `GET /v2/stamps/{scorer_id}/score/{address}` | | `GET /registry/stamps/{address}` | `GET /v2/stamps/{address}` | | `GET /registry/stamp-metadata` | `GET /v2/stamps/metadata` | | `GET /passport/analysis/{address}` | `GET /v2/models/score/{address}` | ## Unified Scorer types ### Background In V1, you had to choose between two Scorer types: * Unique Humanity * Unique Humanity: Binary This differentiation added complexity and could lead to confusion. ### What's New in V2 * **Unified Scoring:** Both numeric and binary scores are included in all payloads. * **Simplified Choices:** No need to choose a Scorer type; you can use the score that best fits your application. ### Example v2 Payload ```json {3-5} filename="Sample response" { "address": "0x9c4de275772297e8fd4c458e6844f4e92ac82b74", "score": "31.885", "passing_score": true, "threshold": "20", "last_score_timestamp": "2024-12-02T22:21:25.723470+00:00", "expiration_timestamp": "2025-01-05T20:29:44.441000+00:00", "error": null, "stamps": { "Discord": { "score": "0", "dedup": true, "expiration_date": "2025-2-05T03:25:24.321000+00:00" }, "Ens": { "score": "0.408", "dedup": false, "expiration_date": "2025-01-05T20:29:44.441000+00:00" } } } ``` **Action Required:** Adjust your application's logic to handle the new payload structure and use the appropriate score type. ## Additional Stamp data in score payload ### Deduplication field To prevent multiple Passports from verifying the same credential (enhancing security against Sybil attacks), Stamps are [deduplicated](/building-with-passport/stamps/major-concepts/deduplicating-stamps) across addresses. * **New Field:** `dedup` * **Purpose:** Indicates whether a Stamp has been deduplicated and thus does not contribute to the score. #### Example ```json /dedup/ "stamps": { "Discord": { "score": "0", "dedup": true, "expiration_date": "" }, "Ens": { "score": "0.408", "dedup": false, "expiration_date": "" } } ``` In the above example, you'll notice that the Discord Stamp is [deduplicated](/building-with-passport/stamps/major-concepts/deduplicating-stamps), meaning another address has also verified this same credential. As a result, the user received a 0 score for that Stamp. You will also note that a different expiration date returns when `dedup=true`. This date represents when the credential verified by the other address will expire, rather than when this credential will expire. You will also see that the ENS Stamp was not deduplicated, meaning the 0.408 score was included in the user's overall unique humanity score. **Action Required:** * **Handle Deduplication:** Update your application to interpret the dedup field and inform users if their Stamps are affected. * **User Communication:** Consider displaying warnings to users about deduplicated Stamps. ### Stamp expiration date * **New Field:** `expiration_date` for each credential. * **Purpose:** Indicates when each specific Stamp will expire. **Action required:** * **Monitor Expirations:** Use the `expiration_date` to notify users about upcoming Stamp expirations. * **Update Logic:** Ensure your application considers Stamp expiration dates in its functionality. ## Next Steps Checklist 1. Update Base URL to https://api.passport.xyz. 2. Modify all API endpoint URIs to the new V2 structure. 3. Replace POST requests with GET requests for score retrieval. 4. Update your data models and logic to accommodate new fields (`passing_score`, `dedup`, `expiration_date`). 5. Thoroughly test your application to ensure all changes work as expected. If you have questions or need support, you can chat with us on our [developer support channel on Telegram](https://t.me/+Mcp9RsRV7tVmYjZh). --- ## Building with Passport > Stamps > Onchain Passport ### Smart Contract Introduction URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/introduction # Onchain Passports Human Passport's onchain functionality enables users to store their verified Stamps and scores onchain, and makes this data available via smart contracts. We also discuss the onchain use cases in the following resources: * [Quick start: Get to "Hello World" with the smart contracts](/building-with-passport/stamps/smart-contracts/quick-start-guide) * [Tutorial: Building an app using onchain Passport data](/building-with-passport/stamps/smart-contracts/integrating-onchain-stamp-data) * [Reference: Learn about the available smart contracts and typical onchain developer flow](/building-with-passport/stamps/smart-contracts/contract-reference) ## Why onchain? In addition to accessing Human Passport data offchain using the Stamps API, Human Passport has also released a smart contract stack that enables developers to access Passport score and Stamp data directly from the blockchain. This onchain Passport data enables partners that want to maintain a decentralized, permissionless backend to engage directly with our smart contracts instead of storing and processing Passport data pulled from our API. ## Why not onchain? Minting Passports onchain is an optional feature for users. Not all users will add their Passports onchain. Also, onchain Passports may not reflect the most up-to-date data for users, since the onchain mint is point-in-time and users could verify more Stamps or Stamps could expire (note that onchain attestations expire). ## Onchain Passport Passport data can be converted into onchain attestations that are stored and engaged with via the [Ethereum Attestation Service (EAS)](https://attest.sh/) or [Verax](https://ver.ax/), which make that data accessible to developers via smart contracts. This enables quadratic funding, rewards, governance, access control, and other programs to exist entirely onchain with their Passport integration. A simplified onchain Passport data flow follows this process: 1. A user decides to [mint their Passport onchain](https://support.passport.xyz/passport-knowledge-base/using-passport/onchain-passport) to one of the available networks via the Passport App. 2. Passport creates a [Stamp (Passport)](https://optimism.easscan.org/schema/view/0xd7b8c4ffa4c9fd1ecb3f6db8201e916a8d7dba11f161c1b0b5ccf44ceb8e2a39) and [score](https://optimism.easscan.org/schema/view/0x6ab5d34260fca0cfcf0e76e96d439cace6aa7c3c019d7c4580ed52c6845e9c89) attestation, and mints them onchain to EAS and other attestation registries, depending on which network they choose. 3. A developer utilizes our [smart contract stack](/building-with-passport/stamps/smart-contracts/contract-reference#how-to-query-for-onchain-passport-data) and users' wallet addresses to request the Passport data from these onchain attestation registries. 4. The developer uses this Passport data in their web3 programs to satisfy their [use case](/overview/use-cases). Of course, there are some additional complexities to this, including [Stamp expirations](/building-with-passport/stamps/smart-contracts/onchain-expirations). ## Available networks This onchain smart contract stack is currently deployed to the following networks: Mainnet * Arbitrum * Base * Linea * Optimism * Scroll * Shape * ZkSync Testnet * Base Goerli * Optimism Sepolia * Scroll Sepolia * Shape Sepolia * ZkSync Sepolia Please note that you can explore our testnet functionality via the app using [Test Mode](/building-with-passport/stamps/smart-contracts/test-mode). ## Available registries Attestations will be minted to one or two different registries, depending on which network the user chose to push their Passport. * All onchain Passports will be minted to EAS, regardless of which network the user selects. * If the user selects Linea or Linea Goerli, the full attestation will be written to EAS, and a partial attestation will be written to Verax. ## Why isn't Human Passport onchain by default? Human Passport is entirely opt-in. Users can still use Human Passport without migrating your data onchain. While onchain Passports are in their infancy, the offchain Passport is useful as a single source. The offchain infrastructure is also perfectly sufficient for many use cases. ## Next steps Learn more about onchain Passports: * [Quick start](/building-with-passport/stamps/smart-contracts/quick-start-guide) * [Tutorial](/building-with-passport/stamps/smart-contracts/integrating-onchain-stamp-data) * [Contract reference](/building-with-passport/stamps/smart-contracts/contract-reference) * [Attestation schema](/building-with-passport/stamps/smart-contracts/attestation-schema) You can also ask questions about onchain Passports in our [developer support channel on Telegram](https://t.me/+Mcp9RsRV7tVmYjZh) --- ### Smart contract quick start guide URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/quick-start-guide # Smart contract quick start The Human Passport smart contracts are deployed on several chains, covering both testnets and live networks. There are several contracts that interact with each other to provide the Human Passport backend and API. This quick start will illustrate different ways that you can quickly test pulling data from the Passport `decoder` contract. ## Retrieving data from Block Explorers You can use a block explorer to find the Passport smart contracts and query their API directly in the browser, without having to write any code at all. 1. Navigate to the `decoder` contract on a [network](/building-with-passport/stamps/smart-contracts/contract-reference#contract-addresses) supported by onchain Passport. In this example, we'll use the [`decoder` deployed to the Optimism Sepolia network](https://sepolia-optimism.etherscan.io/address/0xe53C60F8069C2f0c3a84F9B3DB5cf56f3100ba56). 2. Make sure the `Read as Proxy` tab is open. This is where you can view the methods exposed by the contract. 3. Open the `getPassport()` or `getScore()` method. 4. Enter a ETH wallet address, click `Query`, and view the results. Available methods: * The `getPassport` method will provide the Stamps owned by the given address in the browser. * The `getScore` method will provide the user's score as a 4 digit number. Divide this by 100 to get the user's unique humanity score. * There are also several lower level functions that give access to encoded data and intermediate values. Here's what a response from `getPassport` function on the block explorer looks like: ![Basescan screenshot](/basescan.png) ## Retrieving data programmatically You can also query the API programmatically from the terminal or in an app. The steps are: - 1. instantiate a web3 provider - 2. instantiate the decoder contract - 3. call the contract functions Here's a minimal example of how to call the `getPassport()` and `getScore()` methods using `Web3js` in a Javascript app: ## Instantiate a web3 provider The provider is your entry point to the blockchain. Ultimately it is the address for a node that exposes a set of methods that allows you to interact with the blockchain. If you run your own node, you can use it as your provider. It is also common to use third party "RPC" providers. This is equivalent to using someone else's node. If you are not sure what to use as your provider, your wallet will expose the URLs it is using, and you can copy them into your Javascript application as shown below. To use an RPC provider: ```js const Web3 = require("web3"); const rpcUrl = ''; const web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl)); ``` To use a local node (in this case, Geth using IPC): ```js var web3 = new Web3(new Web3.providers.IpcProvider('/Users/myuser/Library/Ethereum/geth.ipc', net)) ``` Now you have a variable, `web3` representing your web3 connection. You can use this to interact with contracts on the blockchain. **Note** please ensure your web3 provider is connected to the correct network. ## Instantiate the decoder contract Instantiating a contract allows you to interact with a contract deployed on the blockhain as if it were a Javascript object. This requires you to pass the contract ABI (application Binary Interface) and the address on the blockchain where the contract is deployed. The contract ABI can usually be found by querying the contract address on a block explorer, or alternatively it is usually available on a project's Github if the project is open source. The Passport decoder contract ABI can be found on both block explorers and the [Passport Github](https://github.com/passportxyz/eas-proxy/blob/main/deployments/abi/GitcoinPassportDecoder.json). ```js var Contract = require('web3-eth-contract'); var abi = var contract = new Contract(jsonInterface, address); ``` The `contract` variable is a Javascript object exposing the contract methods. ## Call the contract methods You can use the contract methods just like Javascript object methods, i.e. `contract.method(args)`. To call the decoder contract's `getPassport()` method: ```js var passportInfo = contract.getPassport("") ``` To call the contract's `getScore()` method: ```js var score = contract.getScore("") ``` ## Summary This quick start guide demonstrated how to grab information from the Human Passport decoder contract. You have the option to query the contract using the block explorer UI or programatically using a library such as `web3js`. There are equivalent libraries in other languages too, such as [`web3py`](https://web3py.readthedocs.io/en/stable/) for Python, [`web3`](https://pkg.go.dev/github.com/gochain/web3) for Go, and `ethers` for [Rust](https://github.com/gakonst/ethers-rs) and [Javascript](https://docs.ethers.org/v5/). ## Next steps Explore our [contract reference page](./contract-reference) to find all the details about the various Human Passport contract deployments. Then you could try our more advanced [smart contract app tutorial](./integrating-onchain-stamp-data). If you have more questions you can chat in our [developer support channel on Telegram](https://t.me/+Mcp9RsRV7tVmYjZh). --- ### Integrating onchain Stamp data URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/integrating-onchain-stamp-data # Integrating onchain Stamp data In this tutorial, you'll learn how to show different content to users depending on their Passport data. Here, the Stamp data will be retrieved from the blockchain. Specifically, you will: * Fetch user Stamp data from the blockchain using the Human Passport smart contract stack * Use Stamp data to generate your own Passport score, using Passport's Stamp weights. * Conditionally display a user's Passport data depending on their onchain data. * Redirect users to instructions for improving their Passport scores and getting their Stamps onchain. You can learn more about Passport's available smart contracts and the typical developer flow via our [contract reference page](./contract-reference). ### Prerequisites To follow this tutorial, you'll need [Next.js](https://nextjs.org/), [Node](https://nodejs.org/en), and [Chakra-UI](https://chakra-ui.com/) installed on your machine. You will be using the Optimism Sepolia test network - you will need to import this network into your wallet. Some familiarity with smart contracts is recommended. This app uses a blockchain, rather than Passport's database server, as a backend. This means you **do not need an API key or Scorer ID,** but you do need to have a browser wallet that can connect to the Optimism Sepolia test network. ### App outline The app we will build will be a webpage where users can connect their wallet to check their onchain credentials. You can find the code from this tutorial in this [GitHub repo](https://github.com/passportxyz/passport-scorer/tree/main/examples/onchain-stamps-app). The app will work as follows: * When the user visits the sample app, they have access to several tabs - one to welcome them and then more where they can check their onchain data. The second tab shows whether there is any onchain data for the connected user. The third shows what Stamps the user has. The final tab shows the user's Passport score. * The user will connect their wallet and Human Passport to the app. Their Stamp data and Passport score will be retrieved from the blockchain and displayed in the UI. * If the user does not have any Stamps, the tabs contain information about how to create a Passport, add Stamps and migrate them onchain. This simple example demonstrates the principles you would use to gate a real app using Human Passport onchain. ### Smart contract logic The Human Passport smart contracts build on top of [EAS (Ethereum Attestation Service)](https://attest.sh/), using Attestations as the foundational building blocks. You can read the [contract reference](./contract-reference) page for a primer on how the contracts work. The `decoder` contract exposes an API that allows you to simply pass in an address and retrieve the decoded Stamp and score data, rather than having to retrieve raw `Attestations` and decode client-side. ### Setting up the app We'll create an app using [Next.js](https://nextjs.org/). We can bootstrap using `create-next-app`. This automatically creates all the necessary subdirectories, configuration and boilerplate code required to get us building as quickly as possible. Start by entering the following command into your terminal: ```sh npx create-next-app passport-onchain-app ``` This will create a new directory called `passport-app` and populate it with several sub-directories and files that form the skeleton of our app. `create-next-app` will ask for yes/no responses to a series of configuration questions - answer as follows: ```sh npx create-next-app passport-onchain-app ✔ Would you like to use TypeScript? … Yes ✔ Would you like to use ESLint? … Yes ✔ Would you like to use Tailwind CSS? … No ✔ Would you like to use `src/` directory? … Yes ✔ Would you like to use App Router? (recommended) Yes ✔ Would you like to customize the default import alias? … No ``` Next, change your working directory to the new `my-passport-app` directory and install `ethers`: ```sh npm install ethers ``` We also need the Ethereum Attestation Service software development kit: ```sh npm install @ethereum-attestation-service/eas-sdk ``` Finally, this tutorial will also use [Chakra-UI](https://chakra-ui.com/) for styling: ```sh npm i @chakra-ui/react @emotion/react @emotion/styled framer-motion ``` Since the data you will work with is all available on a public blockchain, there is no need to handle any sensitive information such as API keys. You can just get coding! ### Building the App Now that the app is set up, you can begin building. The code that controls what is rendered in the browser is contained in `src/app/page.tsx`. When you created your project, `create-next-app` saved a version of `page.tsx` with some default code. You can delete all the code in `page.tsx` and replace it with this boilerplate: ```typescript 'use client' import { useState, useEffect } from 'react' import { ethers } from 'ethers' import { ChakraProvider, Flex, Heading, Button } from '@chakra-ui/react' import { TabLayout } from './tab-contents' import { GITCOIN_PASSPORT_WEIGHTS } from './stamp-weights'; const decoderContractAddress = "0xe53C60F8069C2f0c3a84F9B3DB5cf56f3100ba56"; const abi = require('./PassportDecoderABI.json') declare global { interface Window { ethereum: any } } declare global { var provider: ethers.BrowserProvider } interface Stamp { id: number stamp: string } export default function Passport() { // here we deal with any local state we need to manage const [address, setAddress] = useState('default') const [connected, setConnected] = useState(false) const [hasStamps, setHasStamps] = useState(false) const [stamps, setStamps] = useState>([]) const [score, setScore] = useState(0) const [network, setNetwork] = useState('') useEffect(() => { checkConnection() async function checkConnection() { if (connected) { console.log("already connected") } else { const result = await connect() console.log(result) } } }, [address, connected]) async function connect() { try { globalThis.provider = new ethers.BrowserProvider(window.ethereum) const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) const network = await provider.getNetwork() setAddress(accounts[0]) setConnected(true) setNetwork(network.chainId.toString()) } catch (err) { console.log('error connecting...') } return true } const styles = { main: { width: '900px', margin: '0 auto', paddingTop: 90 } } return ( /* this is the UI for the app */
{connected &&

✅ Wallet connected

} {connected && network == "11155420" &&

✅ network: Optimism Sepolia

} {connected && network != "11155420" &&

🔴 Please switch to Optimism Sepolia network

}




Onchain Stamp Explorer!

) } ``` **Note** that you can swap out the contract addresses if you want to run an app on a different network. You can check all the deployed contract addresses on the [contract reference page](./contract-reference) There are some parts of this boilerplate code that might look unfamiliar even if you have been through the other [tutorials](/building-with-passport/stamps/passport-api-v1/tutorials) on this site. This is because there is some specific setup required to use smart contracts on the backend. First, the `provider` field is being assigned as a global variable. The `provider` is a connection to the blockchain. In this app, the connection is made by inheriting network configuration from your wallet. If you are using Metamask with default settings, your connection will be via Infura to whichever network your wallet is connected to. If you have a wallet pointing to your own node's RPC provider, it will use that. The reason `provider` is assigned to a global variable is so that it can be captured during the wallet connection but later it can be passed as an argument when you create instances of the smart contracts. The `chainID` for the network you are connected to is requested from the `provider` too and the value is stored in the app's state. This is used in the UI to warn the user if they are connected to a network other than Optimism Sepolia. There are two statuses presented in the UI - one that confirms that the user is connected and one that either confirms the wallet is connected to Optimism Sepolia or warns the user they are connected to the wrong network. Second, there are two contract addresses defined immediately below the import statements: ```typescript const decoderContractAddress = "0xe53C60F8069C2f0c3a84F9B3DB5cf56f3100ba56"; const abi = require('./abis.ts') ``` The `decoderContractAddress` is the address on the Optimism Sepolia blockchain where the `decoder` contract is stored. The data in `abis.ts` is a formatted set of function signatures that allow the contract bytecode to be decoded and instantiated in your app (an ABI - Application Binary Interface). The elements imported from `tab-contents` are components used to build the UI. This file should also be located in the `src/app` folder, called `tab-contents.tsx`, and should be populated with the code located in [this GitHub file](https://github.com/passportxyz/passport-scorer/blob/main/examples/onchain-stamps-app/src/app/tab-contents.tsx). Otherwise, the `create-next-app` boilerplate code is quite standard. There is a `connect()` function that instantiates the `provider` by grabbing network configuration from your browser wallet (make sure you are connected to Optimism Sepolia) and a `checkConnection()` function wrapped in `useEffect` that automatically triggers a connection when the page is first loaded. ### Getting Passport data Getting Passport data requires instantiating the `decoder` contract and calling its `getPassport` function. The `ethers` library provides everything we need to instantiate the contract. Create a contract using `new ethers.Contract()` passing the contract address, ABI and the provider object as arguments. One complication is that the ABI is divided up into sections specific to each chain where the contract has been deployed, so you actually need to pass a specifier with the hex-encoded chain ID too. Here are the hex-encoded chain IDs for each chain: - Arbitrum: `0xa4b1` - BaseGoerli: `0x1a433` - Ethereum: `0x1` - Linea: `0xe704` - Optimism: `0x1a4` - Optimism Sepolia: `0xaa37dc` - Scroll: `0x82750` - Scroll Sepolia: `0x8274f` - ZkSync: `0x144` - ZkSync Sepolia: `0x12c` Once the contract instance exists, you can simply call `getPassport` passing in the user address, which is stored in your app's state. If the function call returns some Stamp data, you can set the `hasStampData` flag to `true` and return the data. ```ts /** get passport info from decoder contract */ async function getPassportInfo() { console.log(address) const decoderContract: ethers.Contract = new ethers.Contract(decoderContractAddress, new ethers.Interface(abi.DecoderAbi['0xaa37dc']), provider) try { const passportInfo: [] = await decoderContract.getPassport(address) return passportInfo } catch { throw new Error("no passport information available") } } ``` ### Extracting Stamps The next step is to write a function to extract the Stamp names from `passportData` into an array. The following code snippet contains that function - you can paste it into your app: ```typescript /** parse out stamps from passport info object*/ function getStamps(passportInfo: []) { var stamps: Stamp[] = []; for (var i = 0; i < passportInfo.length; i++) { stamps.push({ id: i, stamp: passportInfo[i][0] }) } return stamps } ``` ### Retrieving a score Passport scores are calculated by summing weights assigned to each specific Stamp. Passport has defined a list of Stamp weights that are used when scoring is done by the smart contract. The contract exposes a public function, `getScore()` that returns the Passport score for a given user. You can call the function in the same way as for `getPassportInfo()`. ```typescript /** get poassport score from decoder contract */ async function getScore() { const decoderContract: ethers.Contract = new ethers.Contract(decoderContractAddress, new ethers.Interface(abi.DecoderAbi['0xaa37dc']), provider) try { const score = await decoderContract.getScore(address) return score } catch { throw new Error("no passport info available") } } ``` Now you have implemented all the logic required to retrieve and decode onchain Stamps and calculate a score in your app! ### Executing the functions Now you have all your app functions defined, you need to determine when and how they are executed. You can write a simple wrapper function that calls `getPassportInfo()` and `getScore()` and uses the returned values to update the appropriate state variables. ```typescript /** call getPassportInfo and getStamps and set state vars */ async function queryPassport() { const passportData = await getPassportInfo(); const stamps = getStamps(passportData); if (stamps.length > 1) { setHasStamps(true) setStamps(stamps) } const score = await getScore() setScore(parseInt(score) / 10000) } ``` Now, all you have to do is call `queryPassport()` to execute all the necessary logic to retrieve `stamps` and `score`. ### Stamps and scores in the UI The boilerplate code includes a basic UI that pulls in components from `tab-contents.tsx`. This will render five tabs to the webpage, each containing different information. This component can take your `stamp` and `score` data and render differently depending on their values. This is already handled in the boilerplate UI. What is not yet implemented is a way to trigger the `queryPassport()` function. You can add a button for this. Right below the existing `Button` component, inside the `Flex` tags, you can add the following: ```html ``` You can browse the contents of `tab-contents.tsx` to see how the `stamp` and `score` data is used to render content. Conceptually, this is what's happening in each tab: * **Home**: a general introduction that renders identically for any user * **About onchain Stamps**: Information about onchain Stamps that renders identically for any user * **Are your Stamps onchain?**: If the user has onchain Stamps, has connected their wallet and queried their Passport, the app will render a congratulatory message and confirm that they have onchain Stamps. If the user has _not_ queried their Passport or they don't have any onchain Stamps they see some sad emojis and a message informing them that they have either forgotten to connect or they don't have any onchain Stamps. They are directed to the Passport app to migrate their Stamps. * **Browse your Stamps**: If the user has onchain Stamps, has connected their wallet and queried their Passport, the app will render each Stamp in the browser. If the user has _not_ queried their Passport or they don't have any onchain Stamps they see some sad emojis and a message informing them that they have either forgotten to connect or they don't have any onchain Stamps. They are directed to the Passport app to migrate their Stamps. * **See your score**: If the user has onchain Stamps, has connected their wallet and queried their Passport, the app will render their Passport score. If the user has _not_ queried their Passport or they don't have any onchain Stamps they see some sad emojis and a message informing them that they have either forgotten to connect or they don't have any onchain Stamps. They are directed to the Passport app to migrate their Stamps. ### Run the app Well done - your app is ready to use! You can run it locally using `npm run dev` You can navigate to `localhost:3000` to try it out! The app looks as follows: ![Onchain stamp explorer 1](/onchain-stamp-explorer-1.png) ![Onchain stamp explorer 2](/onchain-stamp-explorer-2.png) ![Onchain stamp explorer 3](/onchain-stamp-explorer-3.png) ### Summary Congratulations - you have built an app that retrieves user Stamp data from the blockchain, calculates a Passport score and uses that information to conditionally render content to your webpage. Now you can use the principle demonstrated here to build creatively and integrate onchain Stamps into --- ### Attestation schema URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/attestation-schema # Attestation schema Onchain Passports use Attestations to verify that a particular address owns specific Stamps. Ultimately, an Attestation is just a piece of data with a cryptographic signature. The data follows a known structure, known as a 'schema'. The schema is critical because it ensures the signing participant knows what they are signing, and provides a uniform data layout that enables users to decode the Attestations. The schema is *the layout of information being attested*. The signature is the proof that a known, trusted verifier has seen the data and attested that it is truthful. There is currently a single attestation written when users mint their Passports onchain, the Human Passport attestation. ## Human Passport attestation schema [Human Attestation Schema on EAS](https://optimism.easscan.org/schema/view/0xda0257756063c891659fed52fd36ef7557f7b45d66f59645fd3c3b263b747254) The raw schema looks as follows: ``` bool passing_score, uint8 score_decimals, uint128 scorer_id, uint32 score, uint32 threshold, tuple(string provider, uint256 score)[] stamps ``` You can see an example Human Passport attestation on the Optimism network by visiting the following link: [Example Human Passport attestation on Optimism](https://optimism.easscan.org/attestation/view/0xb6612e9191aaf5741420f4933a509c60f558b6fd2ee769befe3cc07805690a68) ### Fields The fields in the Human Passport attestation are as follows: - `passing_score` (bool): A boolean flag indicating whether the address's score meets or exceeds the threshold value. - `score_decimals` (uint8): The number of decimal places used for score precision. Set to `4` - `scorer_id` (uint128): A unique identifier for the scoring algorithm instance. - `score` (uint32): The raw numerical score calculated for the address. - `threshold` (uint32): The minimum score required to achieve a passing grade. Default is set to `200000`, the recommendation from the Passport team. However, this can be updated by partners who have set a custom threshold using Custom Passport. - `stamps` (tuple[]): An array of tuples containing verified credentials and their weights, where each tuple contains: - A string representing the stamp provider/type (e.g., "CoinbaseDualVerification2", "HolonymGovIdProvider") - A uint256 representing the weight/score contribution to the overall score Example raw data: ```solidity { passing_score: true, score_decimals: 4, scorer_id: 335, score: 922910, threshold: 200000, stamps: [ ["CoinbaseDualVerification2", 100420], ["HolonymGovIdProvider", 160260], ["githubContributionActivityGte#60", 18880] // ... additional stamps ] } ``` ## Accessing User Attestation Data To access a user's attestation data, please use the decoder contract, which is documented via the [contract reference](/building-with-passport/stamps/smart-contracts/contract-reference#decoder-contract) ## Deprecated attestations (as of March 12th, 2025) ### Passport (Stamp) attestation schema The raw schema looks as follows: ``` uint256[] providers, bytes32[] hashes, uint64[] issuanceDates, uint64[] expirationDates, uint16 providerMapVersion ``` Notice that the types for all these fields are numerical types or raw bytes. This is because the human-readable information is compressed and encoded before being added to the attestation. You can see an example of a Stamp attestation on the Optimism network by visiting the following link: [Example Passport (Stamp) attestation on Optimism](https://optimism.easscan.org/attestation/view/0xd53526d72b9e9283a70894ddfba32513b722a939d85c1a6be402416d29cdc0b9) #### Fields The fields are as follows: - `providers`: a u256 that is actually a bitmap where each position maps to a provider name. The mapping is made available offchain. - `hashes`: an ordered array of elements, with each element being 32 raw bytes. Each element in the array is a 32-byte hash that maps to a known Stamp. A provider might have multiple Stamps that each have a hash. The mapping is made available offchain. - `issuanceDates`: an ordered array of elements, with each element being 32 raw bytes. Each element represents the UNIX timestamp when the Stamp was verified. - `expirationDates`: an ordered array of elements, with each element being 32 raw bytes. Each element represents the UNIX timestamp when the Stamp expires. - `providerMapVersion`: an unsigned integer specifying which version of the `providers` mapping the Attestation conforms to. This allows updates as providers are added and removed from the canonical set. ### Score attestation schema The raw schema looks as follows: ``` uint256 score, uint32 scorer_id, uint8 score_decimals ``` You can see an example of a score attestation on the Optimism network by visiting the following link: [Example score attestation on Optimism](https://optimism.easscan.org/attestation/view/0x1d7832d2f4e5e71da3d8b0ceee72faf4cd44990057b21a26d9f775b911fe1bfe) #### Fields The fields are as follows: - `score`: the user's Passport score as an unsigned integer - `scorer_id`: the ID number for the specific Scorer instance that issued the `score` - `score_decimals`: number of decimals in `score`, similar to how ETH is divided into 1e18 Wei. --- ### Onchain expirations URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/onchain-expirations # Onchain expirations Passport Stamps do not stay valid forever. There is an expiration date after which a Stamp must be reverified in order to keep it valid. This is true for onchain and offchain Stamps. ## Passport attestations For Passport attestations, there is a key in the schema called `Expiration Dates`. The value associated with this key is an array of hex-encoded dates, each corresponding to a specific Stamp. There is also an equivalent key, `IssuanceDate` whose values encode the date when a particular Stamp was verified. New attestations can be issued with updated `IssuanceDate` and `expirationDate` values through the Passport app. Here's an example of a [Passport attestation](https://optimism.easscan.org/attestation/view/0x6eefab4afe1610e21c8d7e7cd1d4f4d70fd753fc2bfe6b04ad4bd01dec86c81a) ## Score attestations Onchain scores do not have an explicit expiry date associated with them. If you are an integrator, you could use the attestation transaction time as a proxy for the issuance date if the age of the score is important for your application. As a rule of thumb, we recommend expiring scores 90 days after it was created. Offchain Stamps also expire after 90 days. Here's an example of a [score attestation](https://optimism.easscan.org/attestation/view/0x5beb4300ff732dce2bdec86fb97df3a23787c9f1ff90c06bff6bc86dea74aa6c). --- ### Test mode URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/test-mode # Testing Onchain Passport As developers, we often want to test our apps and integrations on testnets, where there is nothing of real world value at stake, before we go live on a live public mainnet. You can always deploy the Human Passport smart contracts to your own local ephemeral blockchain, but it is also recommended to test your integration on a public testnet too, as this more realistically simulates a mainnet environment. For this reason, the Passport team deployed the Passport smart contracts on public testnets, including OP Sepolia and Linea Goerli. ## Test mode in the Passport app The Passport app can be run in test mode by visitng URL and following the steps below: https://app.passport.xyz#/testing/dashboard This enables you to write Passport data and scores to the Human Passport smart contracts on several testnets, meaning you can experiment and get comfortable with the flows before trying it out on Mainnet. When you sign in to the Passport app, you first have to enable Test Mode. There is a button for this at the top of the page. Enabling Test Mode requires an additional signature from your Ethereum account. Once Test Mode is enabled, you can click on `Bring Passport onchain` towards the bottom of the Passport app to view the supported testnets in a panel that pops out from the right-hand side of the page. The app switches over to whichever network you select by clicking on the preferred network in the panel in the app's UI. Other than the network selection panel, the behavior of the test app is identical to the real, "live" Passport app. ## Test mode for developers Test mode also gives developers the ability to read and write to Passport smart contracts and also develop and test Passport integrations into their own smart contracts. On test networks, this can be done without spending any real ETH on gas fees and without putting any assets at risk from exploits. Since the Passport contracts are deployed on public testnets as can be used by anyone, there are proper Passport data and many integrations on these testnets that offer a much more realistic test environment than local, ephemeral blockchains and the Passport contracts are already deployed there and managed by the passport team, easing your development process. To work in Test Mode, developers simply have to switch their development environments onto one of the supported test networks and use the appropriate contract addresses for that network. ## Which networks are supported? The available test networks are: - [Optimism Sepolia](https://sepolia-optimism.etherscan.io/) - [Linea Goerli](https://docs.linea.build/) ## Testing on mainnet forks The Passport smart contracts may sometimes be upgraded after being deployed. If you are testing on a mainnet fork, you must make sure you fork the blockchain at a block *after* the latest contract deployment. Otherwise, the contracts stored in your forked blockchains state will be out of date. The block where the latest version of the contract is deployed is known as the `latest stable block` and you can find out what it is by looking at the contract deployment details on the appropriate block explorer for the network you want to fork. Then, fork the blockchain at a block greater to or equal to the `latest stable block`. For example, the latest stable block for OP mainnet is 115525426. Your test network must fork off OP mainnet at a block >= 115525426. --- ### Smart contract reference URL: https://docs.passport.xyz/building-with-passport/stamps/smart-contracts/contract-reference # Smart Contract Reference The Passport smart contract stack allows developers to pull Stamp data directly from the blockchain rather than having to make requests to a centralized server. The smart contract stack is built on top of the Ethereum Attestation Service (EAS). This page will outline the Human Passport smart contract stack and provide all the deployment details you need to integrate onchain Stamp data in your app. This page is broken into two sections: * [How Passport adds metadata to the blockchain](#how-passport-adds-data-to-the-blockchain) * [How to query for onchain Passport data](#how-to-query-for-onchain-passport-data) You can always chat in our [Telegram developer support channel](https://t.me/+Mcp9RsRV7tVmYjZh) if you have questions about the Passport smart contracts. ## How Passport adds data to the blockchain We will not cover this in depth, as it is already documented in our [GitHub docs](https://github.com/passportxyz/eas-proxy/blob/main/docs/00-onchain-data.md). Passport uses a combination of private Passport smart contracts and EAS contracts to create Passport attestations and mint them to the blockchain. This process is triggered when a user opts-in to minting their Passport's score and Stamps onchain via the Passport app, and ends with two attestations being minted on EAS that can be accessed by third-party developers. During this process, the user is charged a $2 mint fee to write the attestations onchain. ## How to query for onchain Passport data Human Passport, EAS, and Verax have created several smart contracts that can be used to retrieve users' Passport attestations. There are a couple of different flows you can follow, but we strongly recommend using the Decoder contract. Available flows: * **[Recommended]** [Decoder contract flow](#decoder-contract) * [GitcoinResolver >> EAS/Verax flow](#alternative-flow) ### Decoder contract The decoder contract is a greatly simplified version of the alternative flow, and delivers all data you would need to integrate with Passport in a human-readable format. Here is a rundown of the decoder contract flow: 1. A request is sent to the `Decoder` contract, passing the user address and method associated with the data you'd like to receive. 2. The smart contract delivers the data associated with the user and method. 3. Your integration then either gates access to just those users over a specified score threshold, or displays the Passport data to help prove a users reputation. #### GitHub links * Smart contract: https://github.com/passportxyz/eas-proxy/blob/main/contracts/GitcoinPassportDecoder.sol * Interface contract: https://github.com/passportxyz/eas-proxy/blob/main/contracts/IGitcoinPassportDecoder.sol * ABI: https://github.com/passportxyz/eas-proxy/blob/main/deployments/abi/GitcoinPassportDecoder.json #### Decoder contract addresses The decoder is currently deployed to the following networks: | Network | Contract address | Link | | --------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------- | | Arbitrum | 0x2050256A91cbABD7C42465aA0d5325115C1dEB43 | [Arbiscan](https://arbiscan.io/address/0x2050256A91cbABD7C42465aA0d5325115C1dEB43) | | Base | 0xaa24a127d10C68C8F9Ac06199AA606953cD82eE7 | [Basescan](https://basescan.org/address/0xaa24a127d10C68C8F9Ac06199AA606953cD82eE7) | | Linea | 0x423cd60ab053F1b63D6F78c8c0c63e20F009d669 | [Explorer](https://explorer.linea.build/address/0x423cd60ab053F1b63D6F78c8c0c63e20F009d669) | | Optimism | 0x5558D441779Eca04A329BcD6b47830D2C6607769 | [Optimism Explorer](https://explorer.optimism.io/address/0x5558D441779Eca04A329BcD6b47830D2C6607769) | | Optimism Sepolia | 0x5e9AA91850Fa444E99dEaA6c521a01639f6e6236 | [Optimism Explorer](https://sepolia-explorer.optimism.io/address/0x5e9AA91850Fa444E99dEaA6c521a01639f6e6236) | | Scroll | 0x8A5820030188346cC9532a1dD9FD2EF8d8F464de | [Scrollscan](https://scrollscan.com/address/0x8A5820030188346cC9532a1dD9FD2EF8d8F464de) | | Scroll Sepolia | 0x2443D22Db6d25D141A1138D80724e3Eee54FD4C2 | [Scrollscan](https://scrollscan.com/address/0x2443D22Db6d25D141A1138D80724e3Eee54FD4C2) | | Shape | 0x2443D22Db6d25D141A1138D80724e3Eee54FD4C2 | [Shapescan](https://shapescan.xyz/address/0x2443D22Db6d25D141A1138D80724e3Eee54FD4C2) | | Shape Sepolia | 0x2050256A91cbABD7C42465aA0d5325115C1dEB43 | [Shapescan](https://shapescan.xyz/address/0x2050256A91cbABD7C42465aA0d5325115C1dEB43) | | ZkSync Era | 0x1166FCDCA3B04311Ba9E2eD5ad2c660E730e1386 | [Explorer](https://explorer.zksync.io/address/0x1166FCDCA3B04311Ba9E2eD5ad2c660E730e1386) | | ZkSync Sepolia | 0x23AF92Af3b5D6faAD920C3CAA4F9A3d4352D6834 | [Explorer](https://explorer.zksync.io/address/0x23AF92Af3b5D6faAD920C3CAA4F9A3d4352D6834) | You can learn more about working with testnets via our guide on [Test Mode](test-mode). #### Available methods | Method | Description | | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getPassport(userAddress)` | Returns a list of valid credentials (Stamps) for a given ETH address.

Example response:
`tuple[] : [[CoinbaseDualVerification2, 100420],[githubContributionActivityGte#60, 18880],[githubContributionActivityGte#30, 18790],[Ens, 2080],[NFTScore#50, 162460],[NFTScore#75, 23620],[NFTScore#90, 24130],[NFT, 10320],[GitcoinContributorStatistics#totalContributionAmountGte#10, 2230]]` | | `getScore(userAddress)` (0xd47875d0) | Returns a specified address's score. Divide the value by 10000 to get the user's score.
This function will read the user's score first from the cache in the `GitcoinResolver` and fall back to reading the score from the EAS [Human Passport attestation schema](/building-with-passport/stamps/smart-contracts/attestation-schema#human-passport-attestation-schema). This method will revert with an error is a valid score is not found.

Example response:
`uint256 : 143890` | | `getScore(scorerId, userAddress)` (0xdaadd662) | Returns a specified address's score based on the specified scorer ID (also known as community ID). Divide the value by 10000 to get the user's score.
This function will read the user's score first from the cache in the `GitcoinResolver` and fall back to reading the score from the EAS [Human Passport attestation schema](/building-with-passport/stamps/smart-contracts/attestation-schema#human-passport-attestation-schema). This method will revert with an error is a valid score is not found.

Partners who are using [Custom Passport](/building-with-passport/stamps/custom-passport) can use this method to retrieve a custom score from a user | | `isHuman(userAddress)` | Returns a single boolean, indicating if the user's score is above the minimum threshold, which is currently set to 20. It uses `getScore()` to retrieve the value that is compared against this threshold.

Example responses:
`bool : false`
`bool : true` | --- ### Alternative flow -- Deprecated Please note that this method only enables you to receive decoded onchain Stamp data, and not score data. This alternative flow represents a subset of the tasks that the decoder contract automatically works thorugh, which is why we don't recommend using it. It is, however, useful to understand. If you decide to go this route, you will follow this flow: 1. A request is sent to the `Resolver` contract passing the user address 2. The `Resolver` contract returns a `UID` 3. The `UID` is passed to the `EAS` contract 4. The `EAS` contract returns an encoded `Attestation` 5. Decode the `Attestation` and extracts the Stamp data #### GitcoinResolver contract The `GitcoinResolver` contract is used to request a `UID` for an address. The Attestations are stored in a mapping, where the Attestation is stored as raw bytes (allowing Attestations with any schema to be included). In order to ensure the integrity of the data that the contract stores, the resolver smart contract shall only validate and store date from trusted sources: - a trusted EAS contract - a trusted Attester #### EAS contract The `EAS` contract is where you can pass the `UID`received from the `GitcoinResolver` contract to receive an `Attestation`. #### Alternative flow contract addresses The `GitcoinVerifier` addresses below are the verifiers deployed with automatic fee collection ([eas-proxy #74](https://github.com/passportxyz/eas-proxy/pull/74), merged 2025-09-02). They replaced the earlier verifiers and processed their first mints on 2025-09-08. The addresses on this page match [`deployments/onchainInfo.json`](https://github.com/passportxyz/eas-proxy/blob/main/deployments/onchainInfo.json) as of 2026-09-23. That file is the source of truth and changes over time. ##### Arbitrum The Arbitrum chain ID is [42161](https://chainlist.org/chain/42161). | contract | address | link | | --------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------- | | issuer | 0x804233b96cbd6d81efeb6517347177ef7bD488ED | [Arbiscan](https://arbiscan.io/address/0x804233b96cbd6d81efeb6517347177ef7bD488ED) | | EAS | 0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458 | [Arbiscan](https://arbiscan.io/address/0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458) | | GitcoinResolver | 0x90E2C4472Df225e8D31f44725B75FFaA244d5D33 | [Arbiscan](https://arbiscan.io/address/0x90E2C4472Df225e8D31f44725B75FFaA244d5D33) | | GitcoinVerifier | 0x62E6BE350d7b7116936EeD5DeB7951ed3AAfC3c4 | [Arbiscan](https://arbiscan.io/address/0x62E6BE350d7b7116936EeD5DeB7951ed3AAfC3c4) | | GitcoinAttester | 0x7848a3578Ff2E1F134659a23f64A404a4D710475 | [Arbiscan](https://arbiscan.io/address/0x7848a3578Ff2E1F134659a23f64A404a4D710475) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | | passport | 0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341 | [EasScan](https://arbitrum.easscan.org/schema/view/0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341) | | score | 0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915 | [EasScan](https://arbitrum.easscan.org/schema/view/0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915) | ##### Base | Contract | Address | Link | | -------- | ------- | ---- | | EAS | 0x4200000000000000000000000000000000000021 | [Basescan](https://basescan.org/address/0x4200000000000000000000000000000000000021) | | EASSchemaRegistry | 0x4200000000000000000000000000000000000020 | [Basescan](https://basescan.org/address/0x4200000000000000000000000000000000000020) | | GitcoinResolver | 0x90E2C4472Df225e8D31f44725B75FFaA244d5D33 | [Basescan](https://basescan.org/address/0x90E2C4472Df225e8D31f44725B75FFaA244d5D33) | | GitcoinVerifier | 0x45fA2E93d79Fc44d44b697A94330031b8ccbF68e | [Basescan](https://basescan.org/address/0x45fA2E93d79Fc44d44b697A94330031b8ccbF68e) | | GitcoinAttester | 0xCc90105D4A2aa067ee768120AdA19886021dF422 | [Basescan](https://basescan.org/address/0xCc90105D4A2aa067ee768120AdA19886021dF422) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | | passport | 0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341 | [EasScan](https://base.easscan.org/schema/view/0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341) | | score | 0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915 | [EasScan](https://base.easscan.org/schema/view/0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915) | ##### Linea The Linea chain ID is [59144](https://chainlist.org/chain/59144). | contract | address | link | | -------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x804233b96cbd6d81efeb6517347177ef7bD488ED | [Lineascan](https://lineascan.build/address/0x804233b96cbd6d81efeb6517347177ef7bD488ED) | | EAS | 0xaEF4103A04090071165F78D45D83A0C0782c2B2a | [Lineascan](https://lineascan.build/address/0xaef4103a04090071165f78d45d83a0c0782c2b2a#code) | | GitcoinVeraxPortal | 0xCAa9E817f02486cE076560B77A86235Ef91c5d5D | [Lineascan](https://lineascan.build/address/0xCAa9E817f02486cE076560B77A86235Ef91c5d5D) | | GitcoinResolver | 0x0a774AECE542a1A819107Eb3a06E9D515C67257a | [Lineascan](https://lineascan.build/address/0x0a774AECE542a1A819107Eb3a06E9D515C67257a) | | GitcoinVerifier | 0xEd551a95f76E96D60e6fE2bD2D845C3b4A6F8cA8 | [Lineascan](https://lineascan.build/address/0xEd551a95f76E96D60e6fE2bD2D845C3b4A6F8cA8) | | GitcoinAttester | 0xBC778313E52b1184A15D163b5d3a72AEF8d510A2 | [Lineascan](https://lineascan.build/address/0xBC778313E52b1184A15D163b5d3a72AEF8d510A2) | Verax schema | schema | uid | | -------- | ------------------------------------------------------------------ | | passport | 0x501e6fcade7e3483d0ae7fcfebb732907ebda12b209f5116e52c02697062a50e | | score | 0x01f031da36192c34057c764239eb77bb6ec8ebfb808f72a7bb172f37a5bec31f | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | passport | 0x69b9d63ff6b161097cb4930e197a722bcf423f832d4e4cd3692449d5a1e1319f | [EasScan](https://linea.easscan.org/schema/view/0x69b9d63ff6b161097cb4930e197a722bcf423f832d4e4cd3692449d5a1e1319f) | | score | 0x4da1eaac6346b8b79a705e3898a308062ca607f56c07762ef7b7ff8a7661843c | [EasScan](https://linea.easscan.org/schema/view/0x4da1eaac6346b8b79a705e3898a308062ca607f56c07762ef7b7ff8a7661843c) | ##### Optimism The Optimism chain ID is [10](https://chainlist.org/chain/10). Gitcoin | contract | address | link | | --------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------- | | issuer | 0x804233b96cbd6d81efeb6517347177ef7bD488ED | [Optimism Explorer](https://explorer.optimism.io/address/0x804233b96cbd6d81efeb6517347177ef7bD488ED) | | EAS | 0x4200000000000000000000000000000000000021 | [Optimism Explorer](https://explorer.optimism.io/address/0x4200000000000000000000000000000000000021) | | GitcoinResolver | 0xc94aBf0292Ac04AAC18C251d9C8169a8dd2BBbDC | [Optimism Explorer](https://explorer.optimism.io/address/0xc94aBf0292Ac04AAC18C251d9C8169a8dd2BBbDC#code) | | GitcoinVerifier | 0x5e3fDCbCEB58104E8547D5810EB2ED0Fb42eADf4 | [Optimism Explorer](https://explorer.optimism.io/address/0x5e3fDCbCEB58104E8547D5810EB2ED0Fb42eADf4) | | GitcoinAttester | 0x843829986e895facd330486a61Ebee9E1f1adB1a | [Optimism Explorer](https://explorer.optimism.io/address/0x843829986e895facd330486a61ebee9e1f1adb1a) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | | passport | 0xd7b8c4ffa4c9fd1ecb3f6db8201e916a8d7dba11f161c1b0b5ccf44ceb8e2a39 | [EasScan](https://optimism.easscan.org/schema/view/0xd7b8c4ffa4c9fd1ecb3f6db8201e916a8d7dba11f161c1b0b5ccf44ceb8e2a39) | | score | 0x6ab5d34260fca0cfcf0e76e96d439cace6aa7c3c019d7c4580ed52c6845e9c89 | [EasScan](https://optimism.easscan.org/schema/view/0x6ab5d34260fca0cfcf0e76e96d439cace6aa7c3c019d7c4580ed52c6845e9c89) | ##### Optimism Sepolia The Optimism Sepolia chain ID is [11155420](https://chainlist.org/chain/11155420). Gitcoin | contract | address | link | | --------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------- | | issuer | 0x5f603Ed913738d9105bAf3BD981AA4750016B167 | [Optimism Explorer](https://sepolia-explorer.optimism.io/address/0x5f603Ed913738d9105bAf3BD981AA4750016B167) | | EAS | 0x4200000000000000000000000000000000000021 | [Optimism Explorer](https://sepolia-explorer.optimism.io/address/0x4200000000000000000000000000000000000021) | | GitcoinResolver | 0xa2c832b63A20C06CCc2Ca31c12b8248452729a4D | [Optimism Explorer](https://sepolia-explorer.optimism.io/address/0xa2c832b63A20C06CCc2Ca31c12b8248452729a4D) | | GitcoinVerifier | 0x102f1b991E9B0fEe6d95617B4f1A42208562a9Ff | [Optimism Explorer](https://sepolia-explorer.optimism.io/address/0x102f1b991E9B0fEe6d95617B4f1A42208562a9Ff) | | GitcoinAttester | 0x8B1A76795e3CbadD79C5410d2C4D4827D9C1503a | [Optimism Explorer](https://sepolia-explorer.optimism.io/address/0x8B1A76795e3CbadD79C5410d2C4D4827D9C1503a) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | | passport | 0x838ceca409bb6b6d1423f9f31b439ecba38b9c89b917408624614216e0be70ba | [EasScan](https://optimism-sepolia.easscan.org/schema/view/0x838ceca409bb6b6d1423f9f31b439ecba38b9c89b917408624614216e0be70ba) | | score | 0x2e8b2534361637d20d91ad4de4d373d9418a2f8db1fcd5de66280d4249f3a161 | [EasScan](https://optimism-sepolia.easscan.org/schema/view/0x2e8b2534361637d20d91ad4de4d373d9418a2f8db1fcd5de66280d4249f3a161) | ##### Scroll The Scroll chain ID is [534352](https://chainlist.org/chain/534352). Gitcoin | contract | address | link | | --------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x804233b96cbd6d81efeb6517347177ef7bD488ED | [Scrollscan](https://scrollscan.com/address/0x804233b96cbd6d81efeb6517347177ef7bD488ED) | | EAS | 0xC47300428b6AD2c7D03BB76D05A176058b47E6B0 | [Scrollscan](https://scrollscan.com/address/0xC47300428b6AD2c7D03BB76D05A176058b47E6B0) | | GitcoinResolver | 0x90E2C4472Df225e8D31f44725B75FFaA244d5D33 | [Scrollscan](https://scrollscan.com/address/0x90E2C4472Df225e8D31f44725B75FFaA244d5D33) | | GitcoinVerifier | 0x0EDEBAEaE920a6BFCFe7115566ceF5120ED2ff4C | [Scrollscan](https://scrollscan.com/address/0x0EDEBAEaE920a6BFCFe7115566ceF5120ED2ff4C) | | GitcoinAttester | 0xCc90105D4A2aa067ee768120AdA19886021dF422 | [Scrollscan](https://scrollscan.com/address/0xCc90105D4A2aa067ee768120AdA19886021dF422) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- | | passport | 0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341 | [EasScan](https://scroll.easscan.org/attestation/view/0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341) | | score | 0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915 | [EasScan](https://scroll.easscan.org/attestation/view/0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915) | ##### Scroll Sepolia The Scroll chain ID is [534351](https://chainlist.org/chain/534351). Gitcoin | contract | address | link | | --------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x5f603Ed913738d9105bAf3BD981AA4750016B167 | [Scrollscan](https://scrollscan.com/address/0x5f603Ed913738d9105bAf3BD981AA4750016B167) | | EAS | 0xaEF4103A04090071165F78D45D83A0C0782c2B2a | [Scrollscan](https://scrollscan.com/address/0xaEF4103A04090071165F78D45D83A0C0782c2B2a) | | GitcoinResolver | 0x90E2C4472Df225e8D31f44725B75FFaA244d5D33 | [Scrollscan](https://scrollscan.com/address/0x90E2C4472Df225e8D31f44725B75FFaA244d5D33) | | GitcoinVerifier | 0x16db23c4b99bbC9A6Bf55dF7a787C9AEFD261185 | [Scrollscan](https://scrollscan.com/address/0x16db23c4b99bbC9A6Bf55dF7a787C9AEFD261185) | | GitcoinAttester | 0xCc90105D4A2aa067ee768120AdA19886021dF422 | [Scrollscan](https://scrollscan.com/address/0xCc90105D4A2aa067ee768120AdA19886021dF422) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | | passport | 0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341 | [EasScan](https://scroll-sepolia.easscan.org/attestation/view/0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341) | | score | 0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915 | [EasScan](https://scroll-sepolia.easscan.org/attestation/view/0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915) | ##### Shape The Shape chain ID is [360](https://chainlist.org/chain/360). Gitcoin | contract | address | link | | --------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x804233b96cbd6d81efeb6517347177ef7bD488ED | [Shapescan](https://shapescan.xyz/address/0x804233b96cbd6d81efeb6517347177ef7bD488ED) | | EAS | 0x4200000000000000000000000000000000000021 | [Shapescan](https://shapescan.xyz/address/0x4200000000000000000000000000000000000021) | | GitcoinResolver | 0x90E2C4472Df225e8D31f44725B75FFaA244d5D33 | [Shapescan](https://shapescan.xyz/address/0x90E2C4472Df225e8D31f44725B75FFaA244d5D33) | | GitcoinVerifier | 0xB2cE7d0470c55be6212e197FF812B8dAE44EFD86 | [Shapescan](https://shapescan.xyz/address/0xB2cE7d0470c55be6212e197FF812B8dAE44EFD86) | | GitcoinAttester | 0xCc90105D4A2aa067ee768120AdA19886021dF422 | [Shapescan](https://shapescan.xyz/address/0xCc90105D4A2aa067ee768120AdA19886021dF422) | EAS Schema | schema | uid | | -------- | ------------------------------------------------------------------ | | passport | 0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341 | | score | 0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915 | ##### Shape Sepolia The Shape chain ID is [11011](https://chainlist.org/chain/11011). Gitcoin | contract | address | link | | --------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x5f603Ed913738d9105bAf3BD981AA4750016B167 | [Shapescan](https://shapescan.xyz/address/0x5f603Ed913738d9105bAf3BD981AA4750016B167) | | EAS | 0x4200000000000000000000000000000000000021 | [Shapescan](https://shapescan.xyz/address/0x4200000000000000000000000000000000000021) | | GitcoinResolver | 0x90E2C4472Df225e8D31f44725B75FFaA244d5D33 | [Shapescan](https://shapescan.xyz/address/0x90E2C4472Df225e8D31f44725B75FFaA244d5D33) | | GitcoinVerifier | 0x3508ea66D2ccCEcD3aa9215b6471868431CF2AdC | [Shapescan](https://shapescan.xyz/address/0x3508ea66D2ccCEcD3aa9215b6471868431CF2AdC) | | GitcoinAttester | 0x39571bBD5a4c5d1a5184004c63F45FE426dB85Ea | [Shapescan](https://shapescan.xyz/address/0x39571bBD5a4c5d1a5184004c63F45FE426dB85Ea) | EAS Schema | schema | uid | | -------- | ------------------------------------------------------------------ | | passport | 0x8ae6ee946bf1c936584cacc969bf7e9d0b274631c818df7e45c246051b364341 | | score | 0x24620f482734b3806102678e4b8bb68baafb1adc1ec29e524bcd69c85f15b915 | ##### ZkSync Era The ZkSync chain ID is [324](https://chainlist.org/chain/324). | contract | address | link | | -------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x804233b96cbd6d81efeb6517347177ef7bD488ED | [Explorer](https://explorer.zksync.io/address/0x804233b96cbd6d81efeb6517347177ef7bD488ED) | | EAS | 0x21d8d4eE83b80bc0Cc0f2B7df3117Cf212d02901 | [Explorer](https://explorer.zksync.io/address/0x21d8d4eE83b80bc0Cc0f2B7df3117Cf212d02901) | | GitcoinResolver | 0x8789129C5968EdcA5Cb392C4a9A9D7EFB590A838 | [Explorer](https://explorer.zksync.io/address/0x8789129C5968EdcA5Cb392C4a9A9D7EFB590A838) | | GitcoinVerifier | 0xcC3eab33A77135A09770AcAF7D911E5FEf6622F2 | [Explorer](https://explorer.zksync.io/address/0xcC3eab33A77135A09770AcAF7D911E5FEf6622F2) | | GitcoinAttester | 0x2B5D97CBE50eA9bf809CbE18A2003E4Cb4D283cC | [Explorer](https://explorer.zksync.io/address/0x2B5D97CBE50eA9bf809CbE18A2003E4Cb4D283cC) | EAS Schema | schema | uid | link | | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | passport | 0x71b9da9e4a2ecd8c87ad57d29ef64b9e63887d54039c97c294a6ecba8a8dfb4e | [EasScan](https://zksync.easscan.org/schema/view/0x71b9da9e4a2ecd8c87ad57d29ef64b9e63887d54039c97c294a6ecba8a8dfb4e) | | score | 0xfa8f39bf31b38893697a46f2607ef58ef3ec66308840a1e351304d26823a297c | [EasScan](https://zksync.easscan.org/schema/view/0xfa8f39bf31b38893697a46f2607ef58ef3ec66308840a1e351304d26823a297c) | ##### ZkSync Sepolia The ZkSync chain ID is [300](https://chainlist.org/chain/300). | contract | address | link | | -------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- | | issuer | 0x5f603Ed913738d9105bAf3BD981AA4750016B167 | [Explorer](https://explorer.zksync.io/address/0x5f603Ed913738d9105bAf3BD981AA4750016B167) | | EAS | 0x21d8d4eE83b80bc0Cc0f2B7df3117Cf212d02901 | [Explorer](https://explorer.zksync.io/address/0x21d8d4eE83b80bc0Cc0f2B7df3117Cf212d02901) | | GitcoinResolver | 0x8789129C5968EdcA5Cb392C4a9A9D7EFB590A838 | [Explorer](https://explorer.zksync.io/address/0x8789129C5968EdcA5Cb392C4a9A9D7EFB590A838) | | GitcoinVerifier | 0x5332585ef953904e78b38a740Fc026f8bE9B9850 | [Explorer](https://explorer.zksync.io/address/0x5332585ef953904e78b38a740Fc026f8bE9B9850) | | GitcoinAttester | 0x2B5D97CBE50eA9bf809CbE18A2003E4Cb4D283cC | [Explorer](https://explorer.zksync.io/address/0x2B5D97CBE50eA9bf809CbE18A2003E4Cb4D283cC) | #### Attestation Schemas We discuss the Human Passport attestation schema in our [Attestation schema](/building-with-passport/stamps/smart-contracts/attestation-schema) guide. --- ## Building with Passport > Stamps > Create a Stamp ### Stamps developer overview URL: https://docs.passport.xyz/building-with-passport/stamps/create-a-stamp/introduction ## What is a Stamp? Stamps are the key identity verification mechanism of Passport. A Stamp is a collection of one or more [verifiable credentials](#verifiable-credentials-vcs) from an identity provider that is collected in a Passport. Stamps are provided by a variety of web2 and web3 identity authenticators including Google, BrightID, Holonym, Guild.xyz, ENS, and more. Stamps do not store any personally identifiable information, only the verifiable credentials issued by the identity authenticator. Passport aggregates Stamps and assigns each Stamp a different weight according to the needs of a particular community. This weight is used to calculate the cost of forgery of an identity, a score which reflects the credibility of a potential participant’s online identity. The Passport team is highly selective about the new Stamps that are added to the platform. To be considered, you can follow the steps outlined in on this page. ## Stamp assessment criteria When new Stamps are proposed we evaluate them according to some key criteria: - **Strong non-Sybil signal** Stamps should represent some strong method for identifying Sybils vs non-Sybils so that we can ensure that each Stamp helps to improve the Sybil-defense that Passport offers. We prioritize new signals that are unique or different to the signals we have already have in Passport. It’s ideal if there’s already data, from internal efforts, indicating the effectiveness of the credentials. - **Free** (or very cheap) We have heard feedback from end users who are frustrated by the costs of some of the existing Stamps. Where possible we'd like to expand the set of free or very cheap options available to our users. - **Easy to use** Ensuring that a user can quickly get set up and verified is important to the overall Passport and partner platform's success. We’ll prioritize those Stamps and credentials that can be included in the existing ‘1-click’ verification flow. - **Strong partnership** We pass Sybil data back and forth in an aggregate and anonymized way with our strongest partners to help all parties improve Sybil defense. We expect future partners to participate in this program as well. - **Substantial user base** The more users you have, the more users we can start offering Sybil defense to. This also helps grow the Passport ecosystem as each new partner helps grow all partners. ## What types of Stamps would we like to see more of? We are specifically interested in Stamps that are accessible in areas of the world that are currently under-represented, such as Asia, Africa, and Latin America. This is so people in those regions don't find it more difficult to prove themselves to be real users than people from other areas. Similarly, we are interested to see more Stamps that are accessible to new-comers to Web3, but still match our key criteria. ## Process If you believe your Stamp meets the criteria described above, then you should submit your Stamp using [this form](https://docs.google.com/forms/d/e/1FAIpQLSffvrP4JJiPnvCvHDz9B7-lpCJFGQVwWoI0nut8w57hmURwMg/viewform). We review form submissions periodically and will get back to partners who's Stamps we want to integrate as soon as possible. If we decide to move forward with your Stamp, the next step is to follow the instructions in [this guide](https://docs.passport.xyz/stamps/integrating-a-new-stamp). --- ### Stamp Integration Guide URL: https://docs.passport.xyz/building-with-passport/stamps/create-a-stamp/integration-guide # Developer Integration Guide This guide is for approved partners who are ready to build their Stamp integration. If you haven't been approved yet, start with the [Introduction](/building-with-passport/stamps/create-a-stamp/introduction). ## What is a Stamp? A Human Passport Stamp is a verifiable credential that proves a user has completed identity verification or demonstrated specific onchain/offchain activity. Each Stamp consists of: - **Platform**: The service/protocol providing verification (e.g., Discord, GitHub, Binance) - **Provider(s)**: Specific verification types within a platform (e.g., "Discord Account", "GitHub >30 commits") - **Verification Logic**: Backend code that validates user claims - **UI Integration**: Frontend components for user interaction ## Architecture Overview ``` ┌─────────────────┬─────────────────┬─────────────────┐ │ Frontend │ Backend │ Integration │ │ (App) │ (IAM) │ (Platforms) │ ├─────────────────┼─────────────────┼─────────────────┤ │ • User Interface│ • Verification │ • Platform Impl │ │ • OAuth Popups │ • Credential │ • Provider Impl │ │ • Wallet Connect│ Issuance │ • Configuration │ │ • Form Handling │ • Error Handling│ • Tests │ └─────────────────┴─────────────────┴─────────────────┘ ``` **Key Components:** - **App-Bindings**: Frontend platform implementation (user flows, OAuth, wallet connection) - **Providers**: Backend verification logic (API calls, onchain checks, credential issuance) - **Providers-config**: UI metadata, user guidance, display configuration - **Integration**: Registration with core system (platforms.ts, types, app config) ## Integration Patterns Human Passport supports four main integration patterns: ### 1. OAuth Integration **Best for:** Social platforms, web services with OAuth APIs **Examples:** Discord, Google, GitHub, LinkedIn **Flow:** User clicks → OAuth popup → Authorization → Token exchange → API verification → Credential issued ### 2. Onchain Verification **Best for:** Blockchain-based verification, token ownership, onchain activity **Examples:** Binance BABT, ETH balance, NFT ownership **Flow:** User connects wallet → Query blockchain/contract → Verify conditions → Credential issued ### 3. Custom API Integration **Best for:** Proprietary verification systems, complex workflows **Examples:** Guild.xyz, custom KYC providers **Flow:** Custom authentication → API calls to your service → Verification logic → Credential issued ### 4. Wallet Signature **Best for:** Proof of address ownership, simple onchain verification **Examples:** Message signing, proof of control **Flow:** User connects wallet → Sign message → Verify signature → Credential issued ## File Structure Requirements Every Stamp integration requires the following directory structure: ``` platforms/src/YourPlatform/ ├── index.ts # Main exports (REQUIRED) ├── App-Bindings.tsx # Frontend platform class (REQUIRED) ├── Providers-config.ts # UI config & metadata (REQUIRED) ├── Providers/ │ ├── index.ts # Provider exports (REQUIRED) │ └── yourProvider.ts # Verification logic (REQUIRED) └── __tests__/ └── yourProvider.test.ts # Test suite (REQUIRED) ``` ### Required Assets ``` app/public/assets/ └── yourPlatformIcon.svg # Platform icon (REQUIRED) ``` ## Core Development Steps ### Fork and Setup Repository 1. Fork the [Human Passport repository](https://github.com/passportxyz/passport) 2. Clone your fork locally 3. Install dependencies: `yarn install` 4. Create your platform directory: `mkdir platforms/src/YourPlatform` ### Choose Your Integration Pattern Select the pattern that best fits your verification method: - **OAuth**: For social platforms and web services - **Onchain**: For blockchain-based verification - **Custom API**: For proprietary systems - **Wallet Signature**: For address ownership proof ### Implement Core Files Create all required files following the pattern-specific templates: - `index.ts` - Main exports - `App-Bindings.tsx` - Frontend implementation - `Providers-config.ts` - UI configuration - `Providers/yourProvider.ts` - Verification logic - `__tests__/yourProvider.test.ts` - Test suite ### Integrate with Core System Update system files to register your platform: - Add to `platforms/src/platforms.ts` - Add provider ID to `types/src/index.d.ts` - Add app config to `app/config/platformMap.ts` ### Test and Validate - Write comprehensive tests - Test with real API endpoints - Validate error handling - Test all user scenarios ### Submit Pull Request Follow the [Submission Checklist](/building-with-passport/stamps/create-a-stamp/integrating-a-new-stamp) for PR requirements. ## Environment Configuration ### Required Environment Variables All Stamp integrations need appropriate environment variables: ```bash # OAuth Configuration (for OAuth patterns) NEXT_PUBLIC_YOURPLATFORM_CLIENT_ID=your_client_id YOURPLATFORM_CLIENT_SECRET=your_client_secret NEXT_PUBLIC_YOURPLATFORM_CALLBACK=callback_url # Feature Flag (optional, for gradual rollout) NEXT_PUBLIC_FF_YOURPLATFORM_STAMP=on ``` ### OAuth Setup For OAuth integrations, configure your application with these redirect URIs: - Development: `http://localhost:3000/auth/yourplatform/callback` - Staging: `https://staging.passport.xyz/auth/yourplatform/callback` - Production: `https://passport.xyz/auth/yourplatform/callback` ## UI Configuration (Post-Reskin) The July 2024 reskin introduced new required metadata fields in `PlatformDetails`: ### Required Fields - `timeToGet`: Estimated completion time (e.g., "5 minutes", "10 minutes") - `price`: Cost information (e.g., "Free", "$5 + gas fees") - `guide`: Structured user guidance with two types: - `steps`: Sequential instructions with optional action buttons - `list`: Requirements, warnings, or considerations ### Example Configuration ```typescript export const PlatformDetails: PlatformSpec = { icon: "./assets/yourPlatformIcon.svg", platform: "YourPlatform", name: "Your Platform Name", description: "Brief description of verification type", connectMessage: "Verify Account", website: "https://www.yourplatform.com", timeToGet: "5 minutes", // NEW REQUIRED FIELD price: "Free", // NEW REQUIRED FIELD // NEW REQUIRED FIELD: Detailed user guidance guide: [ { type: "steps", title: "How to Verify", items: [ { title: "Step 1: Create Account", description: "Sign up and verify your email", actions: [ { label: "Sign Up Now", href: "https://www.yourplatform.com/signup", }, ], }, // ... more steps ], }, { type: "list", title: "Requirements", items: [ "Valid email address required", "Account must be at least 30 days old", "Some regions may be restricted", ], }, ], }; ``` ## Next Steps - Review specific [Implementation Patterns](/building-with-passport/stamps/create-a-stamp/implementation-patterns) for your use case - Check out complete [Code Examples](/building-with-passport/stamps/create-a-stamp/examples) - Learn about [Testing & Security](/building-with-passport/stamps/create-a-stamp/testing-and-security) requirements - Use the [Submission Checklist](/building-with-passport/stamps/create-a-stamp/integrating-a-new-stamp) when ready to submit ## Support For technical questions during development: - Review the [troubleshooting guide](/building-with-passport/stamps/create-a-stamp/testing-and-security#troubleshooting) - Check existing implementations in the repository - Contact the Human Passport team for complex integration questions --- ### Implementation Patterns URL: https://docs.passport.xyz/building-with-passport/stamps/create-a-stamp/implementation-patterns # Implementation Patterns This guide covers the four main implementation patterns for Human Passport Stamps, with detailed code examples and best practices. ## Pattern Selection Guide | Pattern | Best For | Examples | Complexity | |---------|----------|----------|------------| | **OAuth** | Social platforms, web services | Discord, GitHub, LinkedIn | Medium | | **Onchain** | Blockchain verification, token ownership | Binance BABT, ETH balance | High | | **Custom API** | Proprietary systems, complex workflows | Guild.xyz, custom KYC | High | | **Wallet Signature** | Address ownership, simple verification | Message signing | Low | --- ## OAuth Integration Pattern **Use Case:** Verifying ownership of accounts on platforms that support OAuth 2.0 authorization. ### Frontend Implementation (App-Bindings.tsx) ```typescript import { AppContext, PlatformOptions, ProviderPayload } from "../types.js"; import { Platform } from "../utils/platform.js"; export class YourPlatformPlatform extends Platform { path = "yourplatform"; // URL path for routing platformId = "YourPlatform"; // Unique platform identifier clientId: string; redirectUri: string; constructor(options: PlatformOptions = {}) { super(); this.clientId = options.clientId as string; this.redirectUri = options.redirectUri as string; // Optional: User guidance banner this.banner = { heading: "Connect Your YourPlatform Account", content: (

This Stamp verifies your YourPlatform account and activity.

Requirements:
  • Verified email address
  • Account at least 30 days old
  • Minimum reputation score
), cta: { label: "Learn More", url: "https://docs.yourplatform.com/passport", }, }; } // Generate OAuth authorization URL async getOAuthUrl(state: string): Promise { const params = new URLSearchParams({ response_type: "code", client_id: this.clientId, state: state, redirect_uri: this.redirectUri, scope: "read:user read:email", // Platform-specific scopes }); return `https://api.yourplatform.com/oauth2/authorize?${params.toString()}`; } // For OAuth, wait for redirect with authorization code async getProviderPayload(appContext: AppContext): Promise { return await appContext.waitForRedirect(this); } } ``` ### Backend Implementation (Providers/yourProvider.ts) ```typescript import type { RequestPayload, VerifiedPayload } from "@gitcoin/passport-types"; import { ProviderExternalVerificationError, type Provider } from "../../types.js"; import axios from "axios"; import { handleProviderAxiosError } from "../../utils/handleProviderAxiosError.js"; interface YourPlatformUser { id: string; username: string; email_verified: boolean; reputation: number; account_created: string; status: 'active' | 'suspended' | 'banned'; } export class YourProvider implements Provider { type = "YourProviderName"; // Must match PROVIDER_ID in types async verify(payload: RequestPayload): Promise { try { // 1. Exchange OAuth code for access token const accessToken = await this.getAccessToken(payload.proofs.code); // 2. Fetch user data using access token const userData = await this.getUserData(accessToken); // 3. Apply validation logic const validation = this.validateUser(userData); if (!validation.valid) { return { valid: false, errors: validation.errors, }; } return { valid: true, record: { id: userData.id, username: userData.username, reputation: userData.reputation, verifiedAt: Date.now(), }, }; } catch (error) { throw new ProviderExternalVerificationError(`YourPlatform error: ${error}`); } } private async getAccessToken(code: string): Promise { try { const response = await axios.post("https://api.yourplatform.com/oauth2/token", { grant_type: "authorization_code", code: code, client_id: process.env.YOURPLATFORM_CLIENT_ID, client_secret: process.env.YOURPLATFORM_CLIENT_SECRET, redirect_uri: process.env.YOURPLATFORM_CALLBACK, }, { headers: { 'Content-Type': 'application/json', 'User-Agent': 'HumanPassport/1.0', }, }); return response.data.access_token; } catch (e) { handleProviderAxiosError(e, "error requesting YourPlatform access token", [code]); throw e; } } private async getUserData(accessToken: string): Promise { try { const response = await axios.get("https://api.yourplatform.com/user/profile", { headers: { Authorization: `Bearer ${accessToken}`, 'User-Agent': 'HumanPassport/1.0', }, }); return response.data as YourPlatformUser; } catch (error) { handleProviderAxiosError(error, "error fetching YourPlatform user data", []); throw error; } } private validateUser(userData: YourPlatformUser): { valid: boolean; errors?: string[] } { const errors: string[] = []; // Check email verification if (!userData.email_verified) { errors.push("Email address must be verified"); } // Check reputation requirement if (userData.reputation < 100) { errors.push("Must have at least 100 reputation points"); } // Check account age (30 days) const accountAge = Date.now() - new Date(userData.account_created).getTime(); const thirtyDays = 30 * 24 * 60 * 60 * 1000; if (accountAge < thirtyDays) { errors.push("Account must be at least 30 days old"); } // Check account status if (userData.status !== 'active') { errors.push("Account must be in good standing"); } return { valid: errors.length === 0, errors: errors.length > 0 ? errors : undefined, }; } } ``` --- ## Onchain Verification Pattern **Use Case:** Verifying blockchain-based credentials, token ownership, or onchain activity. ### Frontend Implementation (App-Bindings.tsx) ```typescript import { AppContext, PlatformOptions, ProviderPayload } from "../types.js"; import { Platform } from "../utils/platform.js"; export class YourOnChainPlatform extends Platform { platformId = "YourOnChain"; path = "youronchain"; isEVM = true; // Requires wallet connection banner = { heading: "Verify Your Onchain Activity", content: (

This Stamp verifies your onchain verification status.

Requirements:
  • Must hold at least 1000 EXAMPLE tokens
  • Tokens must be in the connected wallet
  • Wallet must have transaction history

How it works:
  1. Connect your wallet containing the required tokens
  2. Click "Verify" to check your onchain status
  3. Stamp is awarded if you meet requirements
), cta: { label: "Get EXAMPLE Tokens", url: "https://app.example.com/swap", }, }; // For onchain verification, payload comes from wallet context async getProviderPayload(_appContext: AppContext): Promise { return {}; } } ``` ### Backend Implementation (Providers/yourOnChainProvider.ts) ```typescript import type { RequestPayload, VerifiedPayload } from "@gitcoin/passport-types"; import { Provider } from "../../types.js"; import { getRPCProvider } from "../../utils/signer.js"; import { Contract, formatUnits } from "ethers"; // ERC-20 token ABI (minimal) const ERC20_ABI = [ { inputs: [{ name: "account", type: "address" }], name: "balanceOf", outputs: [{ name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "decimals", outputs: [{ name: "", type: "uint8" }], stateMutability: "view", type: "function", }, ]; export class YourOnChainProvider implements Provider { type = "YourOnChainToken"; private tokenAddress = "0x1234567890123456789012345678901234567890"; // Your token private rpcUrl = "https://mainnet.infura.io/v3/YOUR_PROJECT_ID"; private minTokenBalance = 1000; // Minimum required tokens async verify(payload: RequestPayload): Promise { const address = payload.address; try { // 1. Check token balance const { balance, formattedBalance } = await this.getTokenBalance(address); // 2. Check transaction history (anti-sybil measure) const hasTransactionHistory = await this.checkTransactionHistory(address); const meetsBalanceRequirement = parseFloat(formattedBalance) >= this.minTokenBalance; if (!meetsBalanceRequirement) { return { valid: false, errors: [`Must hold at least ${this.minTokenBalance} EXAMPLE tokens. Current: ${formattedBalance}`], }; } if (!hasTransactionHistory) { return { valid: false, errors: ["Wallet must have transaction history (cannot be a fresh wallet)"], }; } return { valid: true, record: { address: address, tokenBalance: formattedBalance, rawBalance: balance.toString(), verifiedAt: Date.now(), }, }; } catch (error) { return { valid: false, errors: [`Unable to verify onchain status: ${error.message}`], }; } } private async getTokenBalance(address: string) { const provider = getRPCProvider(this.rpcUrl); const tokenContract = new Contract(this.tokenAddress, ERC20_ABI, provider); try { const [balance, decimals] = await Promise.all([ tokenContract.balanceOf(address), tokenContract.decimals(), ]); const formattedBalance = formatUnits(balance, decimals); return { balance: balance, formattedBalance: formattedBalance, decimals: decimals, }; } catch (error) { throw new Error(`Token contract call failed: ${error.message}`); } } private async checkTransactionHistory(address: string): Promise { const provider = getRPCProvider(this.rpcUrl); try { const transactionCount = await provider.getTransactionCount(address); return transactionCount > 0; // Must have sent at least one transaction } catch (error) { throw new Error(`Failed to check transaction history: ${error.message}`); } } } ``` --- ## Configuration Template All patterns use the same `Providers-config.ts` structure: ```typescript import { PlatformSpec, PlatformGroupSpec, Provider } from "../types.js"; import { YourProvider } from "./Providers/yourProvider.js"; export const PlatformDetails: PlatformSpec = { icon: "./assets/yourPlatformIcon.svg", platform: "YourPlatform", name: "Your Platform Name", description: "Brief description of verification", connectMessage: "Verify Account", website: "https://www.yourplatform.com", timeToGet: "5 minutes", price: "Free", isEVM: false, // Set true for wallet-based patterns }; export const ProviderConfig: PlatformGroupSpec[] = [ { platformGroup: "Identity Verification", providers: [ { title: "Verified Account", description: "Proves account ownership and verification status", name: "YourProviderName_verified", }, ], }, ]; export const providers: Provider[] = [new YourProvider()]; ``` ```typescript export const PlatformDetails: PlatformSpec = { icon: "./assets/yourPlatformIcon.svg", platform: "YourPlatform", name: "Your Platform Name", description: "Verify your identity and activity on YourPlatform", connectMessage: "Verify Account", website: "https://www.yourplatform.com", timeToGet: "5-10 minutes", price: "Free", isEVM: false, // Post-reskin: Detailed user guidance guide: [ { type: "steps", title: "How to Verify", items: [ { title: "Step 1: Create Account", description: "Sign up at YourPlatform and verify your email", actions: [ { label: "Sign Up Now", href: "https://www.yourplatform.com/signup", }, ], }, { title: "Step 2: Build Reputation", description: "Participate to earn at least 100 reputation points", }, { title: "Step 3: Connect to Passport", description: "Return here and click 'Verify' to add your Stamp", }, ], }, { type: "list", title: "Requirements", items: [ "Verified email address required", "Account must be at least 30 days old", "Minimum 100 reputation points", "Account must be in good standing", ], }, ], }; export const ProviderConfig: PlatformGroupSpec[] = [ { platformGroup: "Community Reputation", providers: [ { title: "Active Community Member", description: "Demonstrates active participation with verified account and reputation", name: "YourProviderName_active", }, // Multiple tiers if applicable { title: "Premium Member", description: "Enhanced verification for premium account holders", name: "YourProviderName_premium", }, ], }, ]; ``` --- ## Next Steps 1. Choose your implementation pattern based on your verification method 2. Review complete [Code Examples](/building-with-passport/stamps/create-a-stamp/examples) for your pattern 3. Learn about [Testing & Security](/building-with-passport/stamps/create-a-stamp/testing-and-security) requirements 4. Follow the [Submission Checklist](/building-with-passport/stamps/create-a-stamp/integrating-a-new-stamp) when ready ## Pattern-Specific Considerations ### OAuth Pattern - **Security**: Never log access tokens or user data - **Rate Limiting**: Implement exponential backoff for API calls - **Token Validation**: Always validate token scopes and expiration - **Error Handling**: Provide clear error messages for OAuth failures ### Onchain Pattern - **RPC Reliability**: Use multiple RPC endpoints for redundancy - **Gas Optimization**: Batch multiple contract calls when possible - **Network Support**: Consider multi-chain support if applicable - **Anti-Sybil**: Implement transaction history checks to prevent fresh wallet attacks ### Custom API Pattern - **Authentication**: Use secure authentication methods (API keys, JWT, etc.) - **Data Validation**: Validate all external API responses - **Caching**: Cache API responses when appropriate to reduce load - **Monitoring**: Implement comprehensive error logging and monitoring ### Wallet Signature Pattern - **Message Format**: Use standardized message formats for consistency - **Signature Validation**: Properly validate signature format and recovery - **Replay Protection**: Include nonces or timestamps to prevent replay attacks - **User Experience**: Provide clear explanation of what users are signing --- ### Testing & Security URL: https://docs.passport.xyz/building-with-passport/stamps/create-a-stamp/testing-and-security # Testing & Security This guide covers comprehensive testing requirements and security best practices for Human Passport Stamp development. --- ## Testing Requirements All Stamp integrations must include a comprehensive test suite with >80% code coverage. PRs will be rejected without proper tests. ### Test Suite Structure Every Stamp must include tests in `__tests__/yourProvider.test.ts`: ```typescript import { YourProvider } from "../Providers/yourProvider.js"; import { RequestPayload } from "@gitcoin/passport-types"; import axios from "axios"; jest.mock("axios"); const mockedAxios = axios as jest.Mocked; describe("YourProvider", () => { let provider: YourProvider; beforeEach(() => { provider = new YourProvider(); jest.clearAllMocks(); // Set required environment variables process.env.YOURPLATFORM_CLIENT_ID = "test_client_id"; process.env.YOURPLATFORM_CLIENT_SECRET = "test_client_secret"; }); describe("verify method", () => { const validPayload: RequestPayload = { address: "0x1234567890123456789012345678901234567890", proofs: { code: "valid_auth_code" }, type: "YourProviderName", version: "0.0.0", }; it("should return valid payload for successful verification", async () => { // Test implementation }); it("should return invalid payload for failed verification", async () => { // Test implementation }); it("should handle external API errors", async () => { // Test implementation }); }); }); ``` ### Required Test Cases #### 1. Success Scenarios Test all paths that should result in `valid: true`: ```typescript it("should verify valid user with all requirements met", async () => { // Mock successful OAuth flow mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: { id: "user123", username: "testuser", email_verified: true, reputation: 150, account_created: "2023-01-01T00:00:00Z", status: "active", }, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); expect(result.record).toMatchObject({ id: "user123", username: "testuser", reputation: 150, }); expect(result.errors).toBeUndefined(); }); ``` ```typescript it("should verify valid token holder with sufficient balance", async () => { // Mock ethers Contract const mockContract = { balanceOf: jest.fn().mockResolvedValue(BigInt("2000000000000000000000")), // 2000 tokens decimals: jest.fn().mockResolvedValue(18), }; const mockProvider = { getTransactionCount: jest.fn().mockResolvedValue(5), // Has transaction history }; (Contract as jest.Mock).mockImplementation(() => mockContract); (getRPCProvider as jest.Mock).mockReturnValue(mockProvider); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); expect(result.record).toMatchObject({ address: validPayload.address, tokenBalance: "2000.0", }); }); ``` #### 2. Failure Scenarios Test all validation rules and edge cases: ```typescript it("should reject user with insufficient reputation", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: { id: "user123", email_verified: true, reputation: 50, // Below minimum requirement account_created: "2023-01-01T00:00:00Z", status: "active", }, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Must have at least 100 reputation points"); }); it("should reject user with unverified email", async () => { // Mock successful token but unverified email mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: { id: "user123", email_verified: false, // Not verified reputation: 150, account_created: "2023-01-01T00:00:00Z", status: "active", }, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Email address must be verified"); }); ``` #### 3. Error Handling Test external API failures and network issues: ```typescript it("should throw ProviderExternalVerificationError for OAuth failures", async () => { mockedAxios.post.mockRejectedValueOnce({ response: { status: 400, data: { error: "invalid_grant" }, }, }); await expect(provider.verify(validPayload)).rejects.toThrow( "YourPlatform verification error" ); }); it("should handle API rate limiting", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockRejectedValueOnce({ response: { status: 429, data: { error: "rate_limit_exceeded" }, }, }); await expect(provider.verify(validPayload)).rejects.toThrow(); }); it("should handle malformed API responses", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: null, // Malformed response }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toBeDefined(); }); ``` #### 4. Edge Cases Test boundary conditions and unusual scenarios: ```typescript it("should handle account exactly at minimum age requirement", async () => { const exactlyThirtyDaysAgo = new Date(Date.now() - (30 * 24 * 60 * 60 * 1000)).toISOString(); mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: { id: "user123", email_verified: true, reputation: 150, account_created: exactlyThirtyDaysAgo, status: "active", }, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); }); it("should handle empty or missing user data fields", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: { id: "", // Empty ID username: null, // Null username }, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); }); ``` ### Running Tests Test your implementation with these commands: ```bash # Run specific test file yarn test platforms/src/YourPlatform/__tests__/yourProvider.test.ts # Run with coverage yarn test --coverage platforms/src/YourPlatform/ # Run in watch mode during development yarn test --watch platforms/src/YourPlatform/ ``` --- ## Security Best Practices Security is critical for Stamp integrations. Follow these guidelines to protect user data and prevent vulnerabilities. ### 1. Data Protection #### Never Log Sensitive Information ```typescript // ❌ BAD - Logs sensitive data console.log("Access token:", accessToken); console.log("User data:", userData); // ✅ GOOD - Safe logging console.log("Token received, length:", accessToken?.length || 0); console.log("User verification completed for ID:", userData.id); ``` #### Validate All External Data ```typescript // ✅ Always validate API responses const validateUserData = (data: any): boolean => { return ( data && typeof data.id === 'string' && typeof data.verified === 'boolean' && data.id.length > 0 ); }; const userData = await this.getUserData(accessToken); if (!validateUserData(userData)) { return { valid: false, errors: ["Invalid user data received from platform"], }; } ``` #### Secure Record Storage ```typescript // ✅ Only store necessary, non-sensitive data return { valid: true, record: { id: userData.id, // Platform user ID (not email) username: userData.username, // Public username only verificationLevel: userData.level, // Verification tier verifiedAt: Date.now(), // Timestamp // ❌ DON'T store: email, phone, address, tokens, etc. }, }; ``` ### 2. API Security #### Implement Rate Limiting Protection ```typescript const makeAPICall = async (url: string, options: any, retries = 3): Promise => { try { return await axios(url, { ...options, timeout: 10000, // 10 second timeout }); } catch (error) { if (error.response?.status === 429 && retries > 0) { // Exponential backoff for rate limiting const delay = Math.pow(2, 4 - retries) * 1000; await new Promise(resolve => setTimeout(resolve, delay)); return makeAPICall(url, options, retries - 1); } throw error; } }; ``` #### Secure Error Messages ```typescript // ❌ BAD - Exposes internal details return { valid: false, errors: [`Database error: ${dbError.message}`] }; // ❌ BAD - Exposes API structure return { valid: false, errors: [`API call to /internal/user/${userId} failed`] }; // ✅ GOOD - User-friendly, no internal details return { valid: false, errors: ["Unable to verify account. Please try again later."] }; ``` ### 3. OAuth Security #### Validate OAuth Scopes ```typescript private validateOAuthScopes(tokenResponse: any): boolean { const requiredScopes = ['read:user', 'read:email']; const grantedScopes = tokenResponse.scope?.split(' ') || []; return requiredScopes.every(scope => grantedScopes.includes(scope)); } // Use in token exchange const tokenResponse = await this.getAccessToken(code); if (!this.validateOAuthScopes(tokenResponse)) { throw new Error("Insufficient OAuth scopes granted"); } ``` #### Secure Token Storage ```typescript // ❌ BAD - Token stored in memory too long class BadProvider { private accessToken: string; // Don't store tokens as instance variables async verify() { this.accessToken = await this.getAccessToken(code); // Token persists in memory } } // ✅ GOOD - Minimal token lifetime class GoodProvider { async verify(payload: RequestPayload) { const accessToken = await this.getAccessToken(payload.proofs.code); const userData = await this.getUserData(accessToken); // Token goes out of scope immediately return this.validateUser(userData); } } ``` ### 4. On-Chain Security #### Multiple RPC Endpoints ```typescript const RPC_ENDPOINTS = [ "https://mainnet.infura.io/v3/YOUR_PROJECT_ID", "https://mainnet.alchemyapi.io/v2/YOUR_API_KEY", "https://rpc.ankr.com/eth", ]; private async getRobustProvider(): Promise { for (const rpc of RPC_ENDPOINTS) { try { const provider = getRPCProvider(rpc); // Test connection await provider.getBlockNumber(); return provider; } catch (error) { continue; // Try next endpoint } } throw new Error("No RPC endpoints available"); } ``` #### Contract Call Validation ```typescript private async safeContractCall(contract: Contract, method: string, ...args: any[]): Promise { try { const result = await contract[method](...args); // Validate result based on expected type if (method === 'balanceOf' && typeof result !== 'bigint') { throw new Error("Invalid balance response"); } return result; } catch (error) { if (error.message.includes("execution reverted")) { throw new Error("Contract call reverted - invalid parameters or state"); } throw error; } } ``` ### 5. Anti-Sybil Measures Implement multiple checks to prevent Sybil attacks: ```typescript private async validateAntiSybil(address: string, userData: any): Promise { const errors: string[] = []; // 1. Account age requirement const accountAge = Date.now() - new Date(userData.created).getTime(); const minAge = 30 * 24 * 60 * 60 * 1000; // 30 days if (accountAge < minAge) { errors.push("Account too new"); } // 2. Activity requirement if (userData.activity_score < 100) { errors.push("Insufficient platform activity"); } // 3. Verification requirement if (!userData.email_verified || !userData.phone_verified) { errors.push("Account not fully verified"); } // 4. On-chain history (for EVM stamps) if (this.isEVM) { const txCount = await provider.getTransactionCount(address); if (txCount === 0) { errors.push("No transaction history"); } } return errors; } ``` --- ## Troubleshooting ### Common Issues #### OAuth Flow Problems **Issue:** `redirect_uri_mismatch` - **Cause:** OAuth redirect URI doesn't match registered URI exactly - **Solution:** Ensure exact match including protocol, domain, path, and trailing slashes - **Debug:** Log the constructed OAuth URL and compare with registered URIs **Issue:** `invalid_grant` - **Cause:** Authorization code expired, already used, or invalid - **Solution:** Implement proper error handling and direct users to restart OAuth flow - **Prevention:** Don't cache or reuse authorization codes **Issue:** Token exchange fails - **Cause:** Incorrect client credentials or malformed request - **Solution:** Verify environment variables and request format - **Debug:** Check API documentation for exact token exchange format #### Integration Issues **Issue:** Provider not appearing in UI - **Checklist:** - [ ] Platform registered in `platforms/src/platforms.ts` - [ ] App config added to `app/config/platformMap.ts` - [ ] PROVIDER_ID added to `types/src/index.d.ts` - [ ] Feature flag enabled (if applicable) - [ ] Environment variables set correctly **Issue:** Tests failing - **Common causes:** - External dependencies not mocked properly - Environment variables not set in test environment - Async/await handling issues - TypeScript type mismatches **Issue:** Verification always fails - **Debug steps:** 1. Check API endpoint accessibility 2. Verify authentication credentials 3. Test API calls manually with curl/Postman 4. Check for rate limiting 5. Validate request/response format #### On-Chain Issues **Issue:** Contract calls failing - **Causes:** - Wrong contract address - Incorrect ABI - Network connectivity issues - Invalid method parameters **Issue:** Balance checks incorrect - **Causes:** - Wrong token decimals - Incorrect unit conversion - Contract not implementing standard interface ### Debug Tools #### Enable Debug Logging ```typescript const DEBUG = process.env.NODE_ENV === 'development'; if (DEBUG) { console.log('OAuth URL:', oauthUrl); console.log('Token exchange request:', { client_id: clientId.substring(0, 8) + '...', grant_type: grantType }); console.log('User data received, fields:', Object.keys(userData)); } ``` #### Manual API Testing ```bash # Test OAuth URL generation curl -X GET "https://api.yourplatform.com/oauth2/authorize?client_id=test&response_type=code&redirect_uri=http://localhost:3000/callback" # Test token exchange curl -X POST https://api.yourplatform.com/oauth2/token \ -H "Content-Type: application/json" \ -d '{"grant_type":"authorization_code","code":"test_code","client_id":"your_id","client_secret":"your_secret"}' # Test user data endpoint curl -X GET https://api.yourplatform.com/user/me \ -H "Authorization: Bearer YOUR_TEST_TOKEN" ``` #### Contract Debugging ```bash # Check contract exists curl -X POST https://mainnet.infura.io/v3/YOUR_PROJECT_ID \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xCONTRACT_ADDRESS","latest"],"id":1}' # Test balance call curl -X POST https://mainnet.infura.io/v3/YOUR_PROJECT_ID \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0xCONTRACT_ADDRESS","data":"0x70a08231000000000000000000000000USER_ADDRESS"},"latest"],"id":1}' ``` --- ## Security Checklist Before submitting your PR, verify: ### Code Security - [ ] No sensitive data logged to console - [ ] All external API responses validated - [ ] Proper error handling without internal detail exposure - [ ] No hardcoded secrets or API keys - [ ] Secure record data (no PII stored) ### OAuth Security (if applicable) - [ ] OAuth scopes properly validated - [ ] Access tokens not stored as instance variables - [ ] Proper handling of expired/invalid tokens - [ ] Redirect URI validation implemented ### On-Chain Security (if applicable) - [ ] Multiple RPC endpoints configured - [ ] Contract call validation implemented - [ ] Proper unit conversion (decimals handling) - [ ] Anti-sybil measures (transaction history checks) ### Testing Security - [ ] All success scenarios tested - [ ] All failure scenarios tested - [ ] Error handling tested - [ ] Edge cases tested - [ ] >80% code coverage achieved ### Anti-Sybil Measures - [ ] Account age requirements - [ ] Activity/reputation requirements - [ ] Email/phone verification checks - [ ] Transaction history validation (for on-chain) - [ ] Multiple validation criteria implemented --- ### Submitting a Stamp pull request URL: https://docs.passport.xyz/building-with-passport/stamps/create-a-stamp/integrating-a-new-stamp # Submitting a Stamp pull request This guide is reserved for those partners who have been approved by the Passport team to submit a pull request. If you haven't been approved yet, please visit the [Stamps overview for developers](/building-with-passport/stamps/create-a-stamp) page, and follow the steps there. Creating a new Stamp involved defining verification logic and adding configuration details to our existing Stamp infrastructure. We have a standardized format for Stamps and this page will help you to understand all the information you need to provide. The process begins by creating your own copy of our GitHub repository. The instructions on this page will walk you through how to change the codebase to support your Stamp and submit the changes back to the Passport team. *** ### 1. Fork the Passport GitHub repository Whether you want to create an EVM or a non-EVM Stamp, the process begins by forking the Passport GitHub repository. Clone your fork and navigating to the `platforms` directory. Here is our [GitHub repository](https://github.com/passportxyz/passport). This is the [`platforms` directory](https://github.com/passportxyz/passport/tree/main/platforms), located at `passport/platforms.` *** ### 2. Create new files Adding a Stamp requires you to create some new files inside the `platforms/src` directory. Inside `platforms/src` create a new directory and name it according to your Stamp. In the test here we will use the word `example.` For example, the following would be an appropriate command for a bash user: ```bash cd platforms/src && mkdir example ``` Inside `example`, create the following subdirectories and files: ```bash # files to create inside platforms/src/example: __tests__ |-- example.test.ts Providers |-- example.ts App-Bindings.ts index.ts Providers-config.ts ``` Each of the files you just created has a distinct purpose, as described in the following table: | file | purpose | | ----------------------------- | ----------------------------------------------------------------------------------------- | | \_\_tests\_\_/example.test.ts | includes thorough test cases for the Stamp | | Providers/example.ts | includes a `verify()` function that receives a proof and verifies it. | | App-bindings.ts | Collects all the Stamp data and formats for communication with the Passport server | | Providers-config.ts | Collects Stamp metadata. For example, icon image, name and description, provider settings | | index.ts | Exports the providers, config and app bindings | | | | You will also need to update some information in existing files in `platforms/src` but for now we can focus on adding the right information to these newly created files. For the `App-bindings.ts` file specifically, the instructions are slightly different for EVM and non-EVM Stamps. #### `App-bindings.ts` Updating `App-bindings.ts` is slightly different depending upon whether you are creating an EVM Stamp or a non-EVM Stamp. _**What is an EVM Stamp?**_ Some Stamps rely upon the Ethereum Virtual Machine (EVM) while some rely upon OAuth to determine ownership. If your Stamp represents some web3 native credential such as ownership of a digital asset (for example, ETH, some ERC20 token, NFT or POAP) or onchain activity (for example, certain transaction) that can be verified by querying the blockchain, then your Stamp is an EVM Stamp. If your Stamp relies on ownership of some web2 account that your users login to, then it is a non-EVM Stamp. #### `EVM Stamps` Copy the following code into the file, replacing `` with your Stamp name. Note that for EVM Stamps the `AppContext` and `ProviderPayload` types are imported from `"../types"` and the`Platform` class is imported from `"../utils/platform".` The new Stamp is exported as a class extending the `Platform` class. ```typescript //App-bindings.ts - EVM import \{ AppContext, ProviderPayload } from "../types"; import \{ Platform } from "../utils/platform"; export class extends Platform \{ platformId = ""; path = ""; clientId: string = null; redirectUri: string = null; isEVM = true; // if the Stamp requires extra information to be displayed to the user, add // here banner = \{ heading: "Your Stamp heading here" }; async getProviderPayload(appContext: AppContext): Promise \{ const result = await Promise.resolve(\{}); return result; } } ``` #### Non-EVM Stamps Copy the following code into the file, replacing `` with your Stamp name. Note that for non-EVM Stamps the `PlatformOptions` type is imported from `"../types"` and the `Platform` class is imported from `"../utils/platform".` The new Stamp is exported as a class extending the `Platform` class. ```typescript //App-bindings.ts - OAuth import \{ PlatformOptions } from "../types"; import \{ Platform } from "../utils/platform"; export class extends Platform \{ platformId = ""; path = ""; clientId: string = null; redirectUri: string = null; constructor(options: platformOptions = \{}) \{ super(); this.clientId = options.clientId as string; this.redirectUri = options.redirectUri as string; } async getOauthUrl(state: string): Promise \{ const Url = await Promise.resolve( ` URL` ); return Url; } } ``` #### `Providers-config.ts` Copy the following code into `Providers-config.ts` replacing `` with your Stamp name. This file imports the `PlatformSpec` and `PlatformGroupSpec` from `"../types"` and exports the Stamp details and provider config data. ```typescript //Providers-config.ts import \{ PlatformSpec, PlatformGroupSpec, Provider } from "../types"; import \{ Provider } from export const PlatformDetails: PlatformSpec = \{ icon: "./assets/StampIcon.svg", platform: "", name: "", description: "Description to user about how they're going to use the Stamp", connectMessage: "Connect Account", }; export const ProviderConfig: PlatformGroupSpec[] = [ \{ platformGroup: "Name of the Stamp platform group", providers: [ \{ title: "Title of the provider", name: "", }, ] }, ]; export const providers: Provider[] = [new ()] ``` #### `index.ts` Copy and paste the following code into `index.ts` replacing `` with your Stamp name. This code is used to export the providers, provider config data and app bindings. ```typescript //index.ts export \{ Platform } from "./App-Bindings"; export \{ ProviderConfig, PlatformDetails, providers } from "./Providers-config"; export \{ Provider } ``` *** #### `Providers/example.ts` Remember your file name will not be "example.ts" - it will be your stamp name. Some existing examples include "google.ts", "EthErc20Possession.ts" and "github.ts"._ This is where the hard work is done, because it is in this file that you will define your custom verification logic. The code will vary between applications depending on precisely what information is being verified. The verification could include communication with API servers, blockchain nodes or RPC providers, smart contracts or other external resources. We can walk through an example here, but bear in mind that you will have to adapt to your specific use case. Let's look at the Ethereum activity Stamp. This is an EVM Stamp that checks whether a user owns a certain threshold amount of ETH or ERC-20 tokens. ```typescript // EthErc20Possession.ts // ----- Types import type \{ Provider, ProviderOptions } from "../../types"; import type \{ RequestPayload, VerifiedPayload } from "@gitcoin/passport-types"; // ----- Ethers library import \{ Contract } from "ethers"; import \{ formatUnits } from "@ethersproject/units"; // ----- RPC Getter import \{ getRPCProvider } from "../../utils/signer"; /* Eth ERC20 Possession Provider can be used to check a greater than balance for ethereum or any other EVM token (ERC20). By default this will verify the ethereum balance for the address in the parameter. To customize the token set the contract_address or decimal number in the options passed to the class. The default decimal number for formatting is 18. */ // define ERC20 contract ABI here // set the network rpc url based on env export const RPC_URL = process.env.RPC_URL; export async function getTokenBalance( address: string, tokenContractAddress: string, decimalNumber: number, payload: RequestPayload ): Promise \{ // define a provider using the rpc url const staticProvider = getRPCProvider(payload); // load Token contract const readContract = new Contract(tokenContractAddress, ERC20_ABI, staticProvider); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call const tokenBalance: string = await readContract?.balanceOf(address); const balanceFormatted: string = formatUnits(tokenBalance, decimalNumber); return parseFloat(balanceFormatted); } export async function getEthBalance(address: string, payload: RequestPayload): Promise \{ // define a provider using the rpc url const staticProvider = getRPCProvider(payload); const ethBalance = await staticProvider?.getBalance(address); // convert a currency unit from wei to ether const balanceFormatted: string = formatUnits(ethBalance, 18); return parseFloat(balanceFormatted); } export type ethErc20PossessionProviderOptions = \{ threshold: number; recordAttribute: string; contractAddress: string; decimalNumber: number; error: string; }; // Export an Eth ERC20 Possessions Provider. This is intended to be a generic implementation that should be extended export class EthErc20PossessionProvider implements Provider \{ // The type will be determined dynamically, from the options passed in to the constructor type = ""; // Options can be set here and/or via the constructor _options: ethErc20PossessionProviderOptions = \{ threshold: 1, recordAttribute: "", contractAddress: "", decimalNumber: 18, error: "Coin Possession Provider Error", }; // construct the provider instance with supplied options constructor(options: ProviderOptions = \{}) \{ this._options = \{ ...this._options, ...options }; this.type = `$\{this._options.recordAttribute}#$\{this._options.threshold}`; } // verify that the proof object contains valid === "true" async verify(payload: RequestPayload): Promise \{ const \{ address } = payload; let valid = false; let amount = 0; try \{ if (this._options.contractAddress.length > 0) \{ amount = await getTokenBalance(address, this._options.contractAddress, this._options.decimalNumber, payload); } else \{ amount = await getEthBalance(address, payload); } } catch (e) \{ return \{ valid: false, error: [this._options.error], }; } finally \{ valid = amount >= this._options.threshold; } return \{ valid, record: valid ? \{ // store the address into the proof records address, [this._options.recordAttribute]: `$\{this._options.threshold}`, } : \{}, }; } } ``` There is a lot going on in this file, but we can break it down to make it easier to digest. The first thing to notice is that this contract requires information from the Ethereum blockchain, which requires access to a node or an RPC ([remote procedure call](https://www.ibm.com/docs/en/aix/7.1?topic=concepts-remote-procedure-call)) provider - these enable requests to be made to Ethereum, roughly equivalent to getting access to an API server in the Web2 world. In the code above, the following line instantiates an RPC provider. ```typescript // set the network rpc url based on env export const RPC_URL = process.env.RPC_URL; ``` This grabs an RPC endpoint from the environment variables. You can set this to your own node's RPC or use a third party RPC service. Either way, this is your code's entry point to the Ethereum network. This step is common to any verification method that relies on Ethereum blockchain data. Next there are two function definitions: `getEthBalance()` and `getTokenBalance()`. The `getEthBalance()` function calls the `getBalance()` function, which is part of the standard [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/), passing the user's address. The amount of ETH they own is returned. The `getTokenBalance()` function is slightly more complicated because it interacts with a smart contract rather than using the result of a JSON-RPC API request directly. Instead of token accounts and balances being stored directly in Ethereum's state trie, they are stored in the contract's storage. The values are accessed using contract functions, rather than using the JSON-RPC API directly. The ERC-20 token contract includes a function `balanceOf()` that returns the token balance for a given address. This function is common to all contracts that conform to the ERC-20 token standard. It is also necessary to specify which specific token you are interested, by providing the contract address. This is why `getEthBalance()` only takes the user address as an argument, whereas `getTokenBalance()` also takes a contract address (and a decimal number which is used to ensure the correct precision for token balances). Both functions take a [`requestPayload`](https://github.com/passportxyz/passport/blob/9ece5cd399851ccd5a9b76447ad47667181faf6f/types/src/index.d.ts) argument that is used to pass user-defined values from the client into the verification logic. _**Every Stamp has to have a `verify()` function**_ that returns a boolean (true/false) indicating whether or not the verification was successful and some proof details. In this example, the `verify()` function is quite simple. It checks whether a contract address has been provided. If so, it calls `getTokenBalance()` and assigns the return value to `amount`. If no contract address was provided, it calls `getEthBalance()`instead and assigns that return value to `amount`. The value of `amount` is then compared to the user-defined threshold. If `amount` exceeds the threshold then the verification is successful, `valid` is set to `true` and `verify()` returns the user address along with some basic details about the verification (name and threshold value). Otherwise, `verify()` returns an empty object. _**For a new Stamp, you will need to extend the logic explained here to your precise use case.**_ For EVM Stamps you will likely have some specific contract to call that may or may not conform to the ERC-20 standard. For non-EVM Stamps you probably want to make API calls to some server for verification information instead of interacting with Ethereum. You can browse the verification logic for all the existing EVM and non-EVM Stamps on the [Passport Github repository](integrating-a-new-stamp) #### `__tests__/example.test.ts` This is where you will add tests for your verification logic. Precisely how the tests are organized is up to you, as the tests will be specific to the individual Stamp. A standard pattern is to mock endpoints that return a range of responses that could be expected from your real external server and design tests to ensure your verification logic handles them all well. You should mock all possible responses to ensure complete test coverage. As an example, see the tests for the [ETH transaction credential](https://github.com/passportxyz/passport/blob/main/platforms/src/ETH/\_\_tests\_\_/ethTransactions.test.ts). ### 3. Update existing files You have now created all the new files you need to create a new Stamp. The remaining steps all focus on pulling the new information you created into the existing Passport infrastructure, so that Passport can recognize and handle your new Stamp. You will need to navigate up a level, out of your newly created files and into `platforms/src` to find the relevant files to update. #### `platforms.ts` First, you will need to import the newly created platforms from the folders you just created, and export the instances from a single central location. `platforms/src/platforms.ts` acts as that central location. This file already contains the relevant code for the existing platforms, so you just need to follow the syntax for adding your own. The code snippet below shows what code you need to add. Just bear in mind that many lines of code referring to existing platforms have been removed from this example for clarity - your real file will have much more code in it! Remember to replace `EXAMPLE` with your platform name! ```typescript //platforms.ts ... import * as Twitter from "./Twitter"; import * as Ens from "./Ens"; import * as from "./"; ... // Order of this array determines order in the Passport UI const platforms: Record = \{ Twitter, Ens, , ... }; export default platforms; ``` Next navigate into `types`. The file you need to update is `types/src/index.d.ts`. You will add the new Stamp's Platform ID and Provider ID to the bottom of their respective union types (`PLATFORM_ID` and `PROVIDER_ID`). ```typescript //index.d.ts export type PLATFORM_ID = | "Google" | "Ens" ... | ""; export type PROVIDER_ID = | "Twitter" | "TwitterTweetGT10" ... | "" | ""; ``` #### `app/context/ceramicContext.tsx` In this file you will import the Stamp from `@gitcoin/passport-platforms` again. Then create and add the Stamp to the platforms map by adding it to the bottom of the existing list of platforms. ``` //ceramicContext.tsx ... import \{ Brightid, Coinbase, ..., , } = stampPlatforms; export const platforms = new Map(); ... platforms.set("", \{ platform: new .Platform() \, platformGroupSpec: .ProviderConfig, }); ``` The final thing to do in the `app` package is to save a copy of your Stamp's icon, in `.svg` format, to the `app/public/assets` directory. The rest of the files only need to be updated **if your app has new environment variables** that need to be added to the infrastructure, app or `iam` packages. If, for example, your Stamp can be verified using the Etherscan or Alchemy keys that are already made available through Passport, then you can skip straight past these updates. The next few files to update live in the `app` package: #### `.env-example.env` First, add the new Stamp's client ID, callback URL and any other environment variables that are necessary for your new Stamp to `.env-example.env`. This is an example file that contains dummy variables to avoid exposing sensitive data on the public Github repository. **Please DO NOT add any real values to .env-example.env** or they will be exposed publicly! Add the relevant fields for your new Stamp and then add DUMMY values that are not the same as your real values! ```typescript NEXT_PUBLIC_PASSPORT__CLIENT_ID=DUMMY_CLIENT _ID NEXT_PUBLIC_PASSPORT__CALLBACK=http://localhost:300 0/ ``` #### `.env` Now add the **real** values for your Stamp's environment variables to your local `.env` file. ```typescript NEXT_PUBLIC_PASSPORT__CLIENT_ID=_CLIENT _ID NEXT_PUBLIC_PASSPORT__CALLBACK=http://localhost:300 0/ ``` Net we will update some files in the `iam` package. This is where the IAM authority is configured which is responsible for issuing `verifiableCredentials`. These verifiable credentials are issued based on a successful response from the `verify()` function for each Stamp. You defined your verification logic in a `verify()` function in [this earlier step](#providers-example.ts). All you need to do in the `iam` package is update the environment variables so that the necessary data for your Stamp is available. In the next section we will configure the `infra` package so that these environment variables, and those created earlier, are instantiated and provided as context to a remote server responsible for doing the actual Stamp issuance. #### `iam/.env-example.env` Add your **dummy** environment variables to `.env-example.env`. ```typescript _CLIENT_ID=EXAMPLE_CLIENT_ID _CLIENT_SECRET=EXAMPLE_CLIENT_SECRET _CALLBACK=http://localhost:3000/ ``` #### `iam/.env` Add your **real** environment variables to `.env`. ```typescript _CLIENT_ID=123456abcdef _CLIENT_SECRET=123456abcdef _CALLBACK=http://localhost:3000/ ``` Now we can leave the `iam` package and update a few files in the `infra` package. This is where we configure the remote server to issue Stamps based on your Stamp details and verification logic. #### `infra/review/index.ts` Here you will add secrets objects for each of the environment variables you added to your `.env` files. This allows your secrets to be transmitted securely to the remote server so your Stamp verification logic can be executed without having to expose any keys or other sensitive information on the public repository. In this file you will find an instance of the `Fargate` service assigned to the variable `service` . In there, you will find an array named `secrets` nested inside several other objects. You need to add a `secrets` object to this array for each of your environment variables. ```typescript //index.ts const service = new awsx.ecs.FargateService("dpopp-iam", \{ cluster, ..., taskDefinitionArgs: \{ containers: \{ iam: \{ ..., secrets: [ \{ name: " _CLIENT_ID ", valueFrom: `$\{IAM_SERVER_SSM_ARN}: _CLIENT_ID:: `, }, \{ name: " _CLIENT_SECRET ", valueFrom: `$\{IAM_SERVER_SSM_ARN}: _CLIENT_SECRET:: `, }, \{ name: " _CALLBACK ", valueFrom: `$\{IAM_SERVER_SSM_ARN}: _CALLBACK:: `, }, ], } } } }); ``` This step should then be **repeated identically** for the `staging` and `production` versions of this file. To be clear, update `infra/staging/index.ts`and `infra/production/index.ts` in exactly the same way as you just updated `infra/review/index.ts`. ### 4. Further customization You may need additional procedures for your Stamp. You can create a procedures folder inside of the Stamp folder to hold any additional verification, auth, etc. you may need. Every Stamp is slightly different and will require different materials in order to function correctly - since the design space is so large, it's up to you to know what you need for your specific purpose! ### 5. Build and run the services You will need to have [Node (v16 LTS)](https://nodejs.org/en/download/), [Yarn](https://classic.yarnpkg.com/en/docs/install/) and [Git](https://git-scm.com/downloads) installed in order to follow these steps. Now you have updated your local copy of the Human Passport repository, you can build and run it. You can do this by navigating to the top level project directory (`passport`) and running: ```bash npm install --global lerna lerna init lerna bootstrap ``` Next, you can start the `iam` app and `ceramic` services concurrently. This step will only work if you have created your environment variables as explained in the previous steps on this page. ```bash yarn start ``` ### 6. Raise a Pull Request Finally, having seen your app running successfully, you can raise a pull request against the Human Passport GitHub repository. This will make the changes you have made to support your app part of the canonical public Stamp repository. However, before this happens your changes will be reviewed by the Passport team who may request changes. When you raise a pull request, it is important to include the following checklist. This helps you to verify that all the necessary steps have been taken to create your Stamp, and also helps the reviewers of the pull request check your work and merge it faster. ``` ## Stamp Provider - [ ] The Stamp provider name is globally unique (and should not have been used previously). This is because the provider name will be included in the record used to create the Stamp hash: - [ ] The implementation has been unit tested - [ ] Verification payload json valid: true / false, record: \{ ... // Unique payload identifying user } - [ ] The attribute `valid` is false if the Stamp verification fails - [ ] The record must contain the following attributes: - 1 or more attributes uniquely identifying the user: - An ETH address - it should always be lower case (not checksummed) - An email (in case of Google for example) - The users unique ID (like for Facebook, Twitter, Github) - [ ] The payload should never contain a field named `pii` - This field is reserved for internal use ``` You can use the code snippet above as a template - copy and paste it into your pull request and tick the boxes to show that each item has been completed. The following is an example of a pull request that uses a similar checklist: [Integrate Phi Stamp in Passport](https://github.com/passportxyz/passport/issues/1233#top) ### 7. Note on context and cache It is important to understand the difference between context and cache, and for you to use them appropriately when developing your Stamp. They both refer to holding information in memory. **`Context`** is used to pass the results of expensive operations performed during the verification process for a specific Stamp between calls to `verify` within each provider. This is the expected way for Stamps to handle their data. _`Context` should be used wherever possible, in preference to using the `cache`._ The `cache` exists to support unusual or complex authentication mechanisms that cannot work within the`context` logic. The **`cache`** is used to store data between multiple HTTP requests, for example if data stored in the `App-bindings` request needs to be referenced in a `/verify` request. This may occur when objects need to be shared across multiple `Providers`. In this case, the caching _**must**_ be done using the caching mechanism defined in `platforms/src/utils/cache.ts`. If the cache is used, its payload should be moved to `context` and then the cache should be explicitly cleared. The following example shows the `cache` mechanism being used correctly. ```typescript const loadTwitterCache = (token: string): TwitterCache => loadCacheSession(token, "Twitter"); // retrieve the instantiated Client shared between Providers export const getAuthClient = async (sessionKey: string, code: string, context: TwitterContext): Promise => \{ if (!context.twitter?.authClient) \{ const session = loadTwitterCache(sessionKey); const \{ oauthUser } = session; if (!context.twitter) context.twitter = \{}; context.twitter.authClient = new Client(oauthUser); clearCacheSession(sessionKey, "Twitter"); } return context.twitter.authClient; }; ``` ## Need support? You can ask questions in our [developer support channel on Telegram](https://t.me/+Mcp9RsRV7tVmYjZh). --- ## Building with Passport > Stamps > Create a Stamp > Code Examples ### OAuth Integration Example URL: https://docs.passport.xyz/building-with-passport/stamps/create-a-stamp/examples/oauth-pattern # OAuth Integration Example This example demonstrates a complete OAuth-based Stamp integration for a fictional platform called "DevCommunity" that verifies developer reputation and activity. This is a complete, working example you can use as a template. Replace "DevCommunity" with your platform name and customize the validation logic. ## Example Scenario **Platform:** DevCommunity (fictional developer community) **Verification:** User has verified email, 100+ reputation points, and account >30 days old **OAuth Flow:** Standard OAuth 2.0 with access token exchange --- ## Complete File Structure --- ## Implementation Files ### 1. Main Exports (`index.ts`) ```typescript export { DevCommunityPlatform } from "./App-Bindings.js"; export { PlatformDetails, ProviderConfig, providers } from "./Providers-config.js"; export { DevCommunityProvider } from "./Providers/devCommunity.js"; ``` ### 2. Frontend Platform (`App-Bindings.tsx`) ```typescript import { AppContext, PlatformOptions, ProviderPayload } from "../types.js"; import { Platform } from "../utils/platform.js"; import React from "react"; export class DevCommunityPlatform extends Platform { path = "devcommunity"; platformId = "DevCommunity"; clientId: string; redirectUri: string; constructor(options: PlatformOptions = {}) { super(); this.clientId = options.clientId as string; this.redirectUri = options.redirectUri as string; this.banner = { heading: "Connect Your DevCommunity Account", content: (

This Stamp verifies your DevCommunity account and developer activity.


Requirements:
  • Verified email address
  • At least 100 reputation points
  • Account at least 30 days old
  • Account in good standing

What we verify:
  • Account ownership through OAuth
  • Email verification status
  • Community reputation score
  • Account age and activity
), cta: { label: "Join DevCommunity", url: "https://devcommunity.example.com/signup", }, }; } async getOAuthUrl(state: string): Promise { const params = new URLSearchParams({ response_type: "code", client_id: this.clientId, state: state, redirect_uri: this.redirectUri, scope: "read:user read:profile", // Minimal required scopes }); return `https://api.devcommunity.example.com/oauth2/authorize?${params.toString()}`; } async getProviderPayload(appContext: AppContext): Promise { return await appContext.waitForRedirect(this); } } ``` ### 3. Configuration (`Providers-config.ts`) ```typescript import { PlatformSpec, PlatformGroupSpec, Provider } from "../types.js"; import { DevCommunityProvider } from "./Providers/devCommunity.js"; export const PlatformDetails: PlatformSpec = { icon: "./assets/devCommunityIcon.svg", platform: "DevCommunity", name: "DevCommunity", description: "Verify your developer reputation and community activity", connectMessage: "Connect Account", website: "https://devcommunity.example.com", timeToGet: "3 minutes", price: "Free", guide: [ { type: "steps", title: "How to Verify Your DevCommunity Account", items: [ { title: "Step 1: Create Account", description: "Sign up at DevCommunity and verify your email address", actions: [ { label: "Sign Up Now", href: "https://devcommunity.example.com/signup", }, ], }, { title: "Step 2: Build Your Reputation", description: "Participate in discussions, answer questions, and help other developers to earn reputation points", }, { title: "Step 3: Connect to Human Passport", description: "Once you have 100+ reputation points, return here and click 'Verify' to add your Stamp", }, ], }, { type: "list", title: "Verification Requirements", items: [ "Valid email address must be verified", "Minimum 100 community reputation points", "Account must be at least 30 days old", "Account must be active and in good standing", "No recent violations or suspensions", ], }, { type: "list", title: "Why This Matters", items: [ "Proves genuine developer community participation", "Demonstrates consistent engagement over time", "Validates identity through email verification", "Shows commitment to helping other developers", ], }, ], }; export const ProviderConfig: PlatformGroupSpec[] = [ { platformGroup: "Developer Community", providers: [ { title: "Active Community Member", description: "Demonstrates active participation in the developer community with verified reputation and engagement", name: "DevCommunityReputation", }, ], }, ]; export const providers: Provider[] = [new DevCommunityProvider()]; ``` ### 4. Provider Exports (`Providers/index.ts`) ```typescript import { DevCommunityProvider } from "./devCommunity.js"; export const providers = [new DevCommunityProvider()]; ``` ### 5. Verification Logic (`Providers/devCommunity.ts`) ```typescript import type { RequestPayload, VerifiedPayload } from "@gitcoin/passport-types"; import { ProviderExternalVerificationError, type Provider, type ProviderOptions } from "../../types.js"; import axios from "axios"; import { handleProviderAxiosError } from "../../utils/handleProviderAxiosError.js"; interface DevCommunityTokenResponse { access_token: string; token_type: string; expires_in: number; scope: string; } interface DevCommunityUser { id: string; username: string; email: string; email_verified: boolean; reputation: number; account_created: string; last_active: string; status: 'active' | 'suspended' | 'banned'; profile: { bio?: string; location?: string; website?: string; }; stats: { posts_count: number; answers_count: number; helpful_votes: number; }; } export class DevCommunityProvider implements Provider { type = "DevCommunityReputation"; constructor(options: ProviderOptions = {}) { // Initialize provider if needed } async verify(payload: RequestPayload): Promise { const errors: string[] = []; let valid = false; let record = undefined; try { // 1. Exchange OAuth code for access token const accessToken = await this.getAccessToken(payload.proofs.code); // 2. Fetch user data from DevCommunity API const userData = await this.getUserData(accessToken); // 3. Validate user meets all requirements const validation = this.validateUser(userData); if (!validation.valid) { return { valid: false, errors: validation.errors, }; } // 4. Build verification record (no PII) record = { id: userData.id, username: userData.username, reputation: userData.reputation, accountAge: this.calculateAccountAge(userData.account_created), verificationLevel: this.getVerificationLevel(userData.reputation), verifiedAt: Date.now(), }; return { valid: true, record: record, errors: undefined, }; } catch (error) { throw new ProviderExternalVerificationError( `DevCommunity verification error: ${error.message}` ); } } private async getAccessToken(code: string): Promise { const clientId = process.env.DEVCOMMUNITY_CLIENT_ID; const clientSecret = process.env.DEVCOMMUNITY_CLIENT_SECRET; const redirectUri = process.env.DEVCOMMUNITY_CALLBACK; if (!clientId || !clientSecret || !redirectUri) { throw new Error("Missing DevCommunity OAuth configuration"); } try { const response = await axios.post( "https://api.devcommunity.example.com/oauth2/token", { grant_type: "authorization_code", code: code, client_id: clientId, client_secret: clientSecret, redirect_uri: redirectUri, }, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': 'HumanPassport/1.0', }, timeout: 10000, // 10 second timeout } ); const tokenData = response.data as DevCommunityTokenResponse; if (!tokenData.access_token) { throw new Error("No access token received"); } return tokenData.access_token; } catch (error) { handleProviderAxiosError(error, "error requesting DevCommunity access token", [code]); throw error; } } private async getUserData(accessToken: string): Promise { try { const response = await axios.get( "https://api.devcommunity.example.com/user/profile", { headers: { 'Authorization': `Bearer ${accessToken}`, 'Accept': 'application/json', 'User-Agent': 'HumanPassport/1.0', }, timeout: 10000, } ); const userData = response.data as DevCommunityUser; // Validate response structure if (!this.isValidUserResponse(userData)) { throw new Error("Invalid user data structure received"); } return userData; } catch (error) { handleProviderAxiosError(error, "error fetching DevCommunity user data", []); throw error; } } private validateUser(userData: DevCommunityUser): { valid: boolean; errors?: string[] } { const errors: string[] = []; // 1. Email verification requirement if (!userData.email_verified) { errors.push("Email address must be verified on DevCommunity"); } // 2. Reputation requirement const minReputation = 100; if (userData.reputation < minReputation) { errors.push(`Must have at least ${minReputation} reputation points (current: ${userData.reputation})`); } // 3. Account age requirement (30 days) const accountAge = this.calculateAccountAge(userData.account_created); const minAge = 30; // days if (accountAge < minAge) { errors.push(`Account must be at least ${minAge} days old (current: ${accountAge} days)`); } // 4. Account status requirement if (userData.status !== 'active') { errors.push("Account must be active and in good standing"); } // 5. Minimum activity requirement const totalActivity = userData.stats.posts_count + userData.stats.answers_count; if (totalActivity < 10) { errors.push("Must have at least 10 posts or answers showing community participation"); } // 6. Recent activity requirement (must be active within last 90 days) const lastActiveDate = new Date(userData.last_active); const daysSinceActive = Math.floor((Date.now() - lastActiveDate.getTime()) / (24 * 60 * 60 * 1000)); if (daysSinceActive > 90) { errors.push("Account must have been active within the last 90 days"); } return { valid: errors.length === 0, errors: errors.length > 0 ? errors : undefined, }; } private calculateAccountAge(accountCreated: string): number { const createdDate = new Date(accountCreated); const now = new Date(); const diffTime = now.getTime() - createdDate.getTime(); return Math.floor(diffTime / (24 * 60 * 60 * 1000)); // Convert to days } private getVerificationLevel(reputation: number): string { if (reputation >= 1000) return 'expert'; if (reputation >= 500) return 'advanced'; if (reputation >= 100) return 'intermediate'; return 'beginner'; } private isValidUserResponse(data: any): data is DevCommunityUser { return ( data && typeof data.id === 'string' && typeof data.username === 'string' && typeof data.email_verified === 'boolean' && typeof data.reputation === 'number' && typeof data.account_created === 'string' && typeof data.status === 'string' && data.stats && typeof data.stats.posts_count === 'number' ); } } ``` ```typescript // Key OAuth token exchange function private async getAccessToken(code: string): Promise { const response = await axios.post( "https://api.devcommunity.example.com/oauth2/token", { grant_type: "authorization_code", code: code, client_id: process.env.DEVCOMMUNITY_CLIENT_ID, client_secret: process.env.DEVCOMMUNITY_CLIENT_SECRET, redirect_uri: process.env.DEVCOMMUNITY_CALLBACK, }, { headers: { 'Content-Type': 'application/json', 'User-Agent': 'HumanPassport/1.0', }, timeout: 10000, } ); return response.data.access_token; } // User data fetching with proper headers private async getUserData(accessToken: string): Promise { const response = await axios.get( "https://api.devcommunity.example.com/user/profile", { headers: { 'Authorization': `Bearer ${accessToken}`, 'Accept': 'application/json', 'User-Agent': 'HumanPassport/1.0', }, timeout: 10000, } ); return response.data as DevCommunityUser; } ``` ```typescript // Comprehensive validation logic private validateUser(userData: DevCommunityUser): { valid: boolean; errors?: string[] } { const errors: string[] = []; // Email verification if (!userData.email_verified) { errors.push("Email address must be verified"); } // Reputation threshold if (userData.reputation < 100) { errors.push(`Must have at least 100 reputation points`); } // Account age (30+ days) const accountAge = this.calculateAccountAge(userData.account_created); if (accountAge < 30) { errors.push(`Account must be at least 30 days old`); } // Account status if (userData.status !== 'active') { errors.push("Account must be active and in good standing"); } // Activity requirement const totalActivity = userData.stats.posts_count + userData.stats.answers_count; if (totalActivity < 10) { errors.push("Must have at least 10 posts or answers"); } // Recent activity (within 90 days) const lastActiveDate = new Date(userData.last_active); const daysSinceActive = Math.floor((Date.now() - lastActiveDate.getTime()) / (24 * 60 * 60 * 1000)); if (daysSinceActive > 90) { errors.push("Account must be active within last 90 days"); } return { valid: errors.length === 0, errors: errors.length > 0 ? errors : undefined, }; } ``` ### 6. Complete Test Suite (`__tests__/devCommunity.test.ts`) ```typescript import { DevCommunityProvider } from "../Providers/devCommunity.js"; import { RequestPayload } from "@gitcoin/passport-types"; import axios from "axios"; jest.mock("axios"); const mockedAxios = axios as jest.Mocked; describe("DevCommunityProvider", () => { let provider: DevCommunityProvider; beforeEach(() => { provider = new DevCommunityProvider(); jest.clearAllMocks(); // Set environment variables for tests process.env.DEVCOMMUNITY_CLIENT_ID = "test_client_id"; process.env.DEVCOMMUNITY_CLIENT_SECRET = "test_client_secret"; process.env.DEVCOMMUNITY_CALLBACK = "http://localhost:3000/callback"; }); afterEach(() => { // Clean up environment variables delete process.env.DEVCOMMUNITY_CLIENT_ID; delete process.env.DEVCOMMUNITY_CLIENT_SECRET; delete process.env.DEVCOMMUNITY_CALLBACK; }); const validPayload: RequestPayload = { address: "0x1234567890123456789012345678901234567890", proofs: { code: "valid_oauth_code" }, type: "DevCommunityReputation", version: "0.0.0", }; const mockValidUser = { id: "user123", username: "testdeveloper", email: "test@example.com", email_verified: true, reputation: 250, account_created: "2023-01-01T00:00:00Z", last_active: new Date().toISOString(), status: "active" as const, profile: { bio: "Full-stack developer", location: "San Francisco", }, stats: { posts_count: 15, answers_count: 8, helpful_votes: 42, }, }; ``` ```typescript describe("successful verification", () => { it("should return valid payload for qualified user", async () => { // Mock successful token exchange mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); // Mock successful user data fetch mockedAxios.get.mockResolvedValueOnce({ data: mockValidUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); expect(result.record).toMatchObject({ id: "user123", username: "testdeveloper", reputation: 250, verificationLevel: "intermediate", }); expect(result.errors).toBeUndefined(); }); it("should handle expert level user", async () => { const expertUser = { ...mockValidUser, reputation: 1500, }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: expertUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); expect(result.record?.verificationLevel).toBe("expert"); }); }); ``` ```typescript describe("validation failures", () => { it("should reject user with unverified email", async () => { const unverifiedUser = { ...mockValidUser, email_verified: false, }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: unverifiedUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Email address must be verified on DevCommunity"); }); it("should reject user with insufficient reputation", async () => { const lowRepUser = { ...mockValidUser, reputation: 50, }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: lowRepUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Must have at least 100 reputation points (current: 50)"); }); it("should reject user with new account", async () => { const newUser = { ...mockValidUser, account_created: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString(), // 10 days ago }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: newUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Account must be at least 30 days old (current: 10 days)"); }); it("should reject suspended user", async () => { const suspendedUser = { ...mockValidUser, status: "suspended" as const, }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: suspendedUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Account must be active and in good standing"); }); it("should reject user with insufficient activity", async () => { const inactiveUser = { ...mockValidUser, stats: { posts_count: 2, answers_count: 1, helpful_votes: 5, }, }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: inactiveUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(false); expect(result.errors).toContain("Must have at least 10 posts or answers showing community participation"); }); }); ``` ```typescript describe("error handling", () => { it("should throw error for OAuth token failure", async () => { mockedAxios.post.mockRejectedValueOnce({ response: { status: 400, data: { error: "invalid_grant" }, }, }); await expect(provider.verify(validPayload)).rejects.toThrow( "DevCommunity verification error" ); }); it("should throw error for user data fetch failure", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockRejectedValueOnce({ response: { status: 401, data: { error: "invalid_token" }, }, }); await expect(provider.verify(validPayload)).rejects.toThrow( "DevCommunity verification error" ); }); it("should throw error for missing environment variables", async () => { delete process.env.DEVCOMMUNITY_CLIENT_ID; await expect(provider.verify(validPayload)).rejects.toThrow( "Missing DevCommunity OAuth configuration" ); }); it("should handle rate limiting", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockRejectedValueOnce({ response: { status: 429, data: { error: "rate_limit_exceeded" }, }, }); await expect(provider.verify(validPayload)).rejects.toThrow(); }); it("should handle malformed user data", async () => { mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: { invalid: "response" }, // Malformed response }); await expect(provider.verify(validPayload)).rejects.toThrow( "Invalid user data structure received" ); }); }); describe("edge cases", () => { it("should handle user at exact reputation threshold", async () => { const exactThresholdUser = { ...mockValidUser, reputation: 100, // Exactly at threshold }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: exactThresholdUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); }); it("should handle user at exact account age threshold", async () => { const exactAgeUser = { ...mockValidUser, account_created: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString(), // Exactly 30 days }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: exactAgeUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); }); it("should handle user with exactly minimum activity", async () => { const minActivityUser = { ...mockValidUser, stats: { posts_count: 10, // Exactly at threshold answers_count: 0, helpful_votes: 5, }, }; mockedAxios.post.mockResolvedValueOnce({ data: { access_token: "mock_access_token" }, }); mockedAxios.get.mockResolvedValueOnce({ data: minActivityUser, }); const result = await provider.verify(validPayload); expect(result.valid).toBe(true); }); }); }); ``` --- ## Integration Setup ### Environment Variables Add these to your `.env` files: ```bash # Development NEXT_PUBLIC_DEVCOMMUNITY_CLIENT_ID=dev_client_id_here DEVCOMMUNITY_CLIENT_SECRET=dev_client_secret_here NEXT_PUBLIC_DEVCOMMUNITY_CALLBACK=http://localhost:3000/auth/devcommunity/callback # Production NEXT_PUBLIC_DEVCOMMUNITY_CLIENT_ID=prod_client_id_here DEVCOMMUNITY_CLIENT_SECRET=prod_client_secret_here NEXT_PUBLIC_DEVCOMMUNITY_CALLBACK=https://passport.xyz/auth/devcommunity/callback ``` ### System Integration Add these updates to integrate with the core system: **`platforms/src/platforms.ts`** ```typescript import * as DevCommunity from "./DevCommunity/index.js"; const platforms: Record = { // ... existing platforms DevCommunity, }; ``` **`types/src/index.d.ts`** ```typescript export type PROVIDER_ID = // ... existing providers | "DevCommunityReputation" ``` **`app/config/platformMap.ts`** ```typescript const { DevCommunity } = platforms; defaultPlatformMap.set("DevCommunity", { platform: new DevCommunity.DevCommunityPlatform({ clientId: process.env.NEXT_PUBLIC_DEVCOMMUNITY_CLIENT_ID, redirectUri: process.env.NEXT_PUBLIC_DEVCOMMUNITY_CALLBACK, }), platFormGroupSpec: DevCommunity.ProviderConfig, }); ``` ### OAuth Application Setup Configure your OAuth application with: 1. **Redirect URIs:** - Development: `http://localhost:3000/auth/devcommunity/callback` - Staging: `https://staging.passport.xyz/auth/devcommunity/callback` - Production: `https://passport.xyz/auth/devcommunity/callback` 2. **Required Scopes:** - `read:user` - Access to basic user information - `read:profile` - Access to profile and reputation data 3. **Application Settings:** - Application Type: Web Application - Grant Types: Authorization Code - Token Endpoint Auth Method: Client Secret Post --- ## Testing Your Integration Run the test suite to verify your implementation: ```bash # Run the specific test file yarn test platforms/src/DevCommunity/__tests__/devCommunity.test.ts # Run with coverage yarn test --coverage platforms/src/DevCommunity/ # Run in watch mode for development yarn test --watch platforms/src/DevCommunity/ ``` Expected test output: ``` PASS platforms/src/DevCommunity/__tests__/devCommunity.test.ts DevCommunityProvider successful verification ✓ should return valid payload for qualified user ✓ should handle expert level user validation failures ✓ should reject user with unverified email ✓ should reject user with insufficient reputation ✓ should reject user with new account ✓ should reject suspended user ✓ should reject user with insufficient activity error handling ✓ should throw error for OAuth token failure ✓ should throw error for user data fetch failure ✓ should throw error for missing environment variables ✓ should handle rate limiting ✓ should handle malformed user data edge cases ✓ should handle user at exact reputation threshold ✓ should handle user at exact account age threshold ✓ should handle user with exactly minimum activity Test Suites: 1 passed, 1 total Tests: 14 passed, 14 total ``` --- ## Customization Guide To adapt this example for your platform: ### 1. Replace Platform Names - Change `DevCommunity` to your platform name throughout - Update API endpoints to your actual URLs - Modify environment variable names ### 2. Customize Validation Logic Modify the `validateUser()` method to match your requirements: ```typescript private validateUser(userData: YourPlatformUser): { valid: boolean; errors?: string[] } { const errors: string[] = []; // Add your specific validation requirements if (userData.yourRequirement < yourThreshold) { errors.push("Your custom error message"); } return { valid: errors.length === 0, errors: errors.length > 0 ? errors : undefined, }; } ``` ### 3. Update OAuth Configuration - Modify OAuth scopes for your platform's requirements - Update API endpoints for token exchange and user data - Adjust request headers as needed for your API ### 4. Customize UI Content Update the `banner` content and `guide` sections in `Providers-config.ts` to match your platform's verification process. This complete example provides a solid foundation for any OAuth-based Stamp integration with Human Passport. --- ## Building with Passport > Embed ### Passport Embed URL: https://docs.passport.xyz/building-with-passport/embed/introduction # Passport Embed **Try it out:** Use the [Embed Playground](https://embed-playground.passport.xyz) to configure the widget visually, preview it in real-time, and generate ready-to-use code. ## Introduction Passport Embed lets websites integrate Human Passport's [Stamps-based verification](/building-with-passport/stamps) directly on their website or app, so users are not redirected elsewhere​. In essence, Passport Embed provides an on-site component for proof of humanity, ensuring that communities and applications remain Sybil-resistant (protected from fake or duplicate accounts) without adding user friction. Core Benefits: * **Frictionless User Experience:** Users can verify their identity within your app or site (no external redirects), leading to higher conversion and less drop-off​. The verification process is quick and preserves privacy, requiring only a crypto wallet and approved credentials rather than personal data. * **Powerful Sybil Protection:** Backed by the Human Passport scoring system, it effectively distinguishes real users from bots. You can gate content or features based on Unique Humanity Scores (for example, only users above a certain score can access an airdrop) to keep out malicious actors​. * **Targeted for Web3 Communities:** Ideal for dApps, DAOs, forums, or any platform where one-person-one-account is vital. It enables ecosystems to protect and grow their communities organically by ensuring each participant is unique​. * **Key Differentiators:** Passport Embed is a privacy-preserving alternative to traditional KYC or CAPTCHA. It uses verifiable credentials ("Stamps") to calculate a humanity score, so site owners never receive sensitive personal info – only a score or pass/fail status. Unlike other solutions, Passport Embed is decentralized and user-first​, meaning users maintain control over their data and can prove their humanity without sacrificing anonymity. Overall, the Passport Embed component brings the power of Human Passport's identity verification directly into your application. It's designed for both developers and decision-makers who want to boost security and trust in their platform while keeping the user experience seamless and on-brand. **Please Note:**
While Embed currently only works with the [Passport Stamps verificaiton flow](/building-with-passport/stamps/passport-api), we are also working on enabling individual verification flows within Embed, including zk KYC, zk Biometrics, and zk Proof of Clean Hands.

Join our [Developer Telegram group](https://t.me/+Mcp9RsRV7tVmYjZh) to stay updated on the latest features and get support. ## User flow The user flow for Passport Embed is as follows: 1. The user visits your website or app and encounters a program that's protected by the Passport Embed component. 2. If the user is not connected to a wallet, the component will prompt them to connect their wallet. 3. Once connected, the component will fetch the user's Passport score if they have one. 4. If the user's score is above a specified threshold (20 by default), the component will show a success state and inform you that the user is verified. If not, the component will automatically verify any web3 Stamps that the user qualifies for. 5. If the user's score is still below the threshold, the component will walk users through pages of different Stamps that they can verify to build up their score. Once they build up a high enough score, they will be notified that the program is unlocked and they can participate. 6. [Future optional feature] Once a user builds up a high enough score, they can mint their Passport onchain to one of Passport's supported networks. Once done, they will be notified that the program is unlocked and they can participate. ## Customizations The component can be [customized](/building-with-passport/embed/customization) in a number of ways, including: * Set the theme to dark or light. * Adjust several color, font, and spacing options. * Set the component to collapse to a smaller size, and the behavior of surrounding content when it expands. * [Future customization] Choose which Stamps display, which order those Stamps are displayed, and what each Stamp's weighting is. * [Future customization] Require users to mint their Passport onchain to one of Passport's supported networks. ## Next Steps * [Getting access to Passport Embed](/building-with-passport/embed/getting-access) * [Quick start guide](/building-with-passport/embed/quick-start-guide) * [Tutorial: Protecting Sensitive Programs with Passport Embed](/building-with-passport/embed/tutorials/protecting-sensitive-programs-with-passport-embed) * [Component reference](/building-with-passport/embed/component-reference) ## Try It Out **[Open the Embed Playground](https://embed-playground.passport.xyz)** to configure themes, test different scenarios, and generate code — all without writing any code first. For a complete implementation walkthrough, see our [Tutorial](/building-with-passport/embed/tutorials/protecting-sensitive-programs-with-passport-embed). --- ### Getting access to Passport Embed URL: https://docs.passport.xyz/building-with-passport/embed/getting-access # Getting Access: Scorer ID and API Key Once you have your API key, you need to include it in your integration with Passport Embed. This allows Human Passport to identify your app and verify that you are authorized to access the API. **Please Note:**
You will need to create two API keys to use the Passport Embed product. One will be used for the actual Embed component, while the other will be used to make requests to the Stamps API. You should only use a single Scorer for both the Embed and the Stamps API requests. ### Getting Your API Key 1. **Log in to the developer portal:** Go to [developer.passport.xyz](https://developer.passport.xyz) and log in to your account by connecting your wallet. 2. **Navigate to the API Keys section:** After logging in, go to the "API Keys" section. 3. **Generate an API key:** Click on the "+ Create a Key" button to generate a unique API key for your account. Make sure to create one for the embed component and another for the Stamps API requests. 4. **Store your API key securely:** Store your API key in a secure place. ### Getting your Scorer ID A Scorer is an developer element that can be used to organize different use cases. You need to create a Scorer and associated Scorer ID to be able to set up Passport Embed and your Stamps API requests. 1. **Log in to the Developer Portal:** Go to [developer.passport.xyz](https://developer.passport.xyz) and log in to your account by connecting your wallet. 2. **Navigate to the Scorer section:** After logging in, go to the "Scorer" section 3. **Create a Scorer:** Click on the "+ Create a Scorer" button and input a Scorer name, description, and [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds) (recommended 20). You will *only need one* for both the embed component and the Stamps API. 4. **Find your Scorer ID:** Once created, you can find your Scorer ID from the main Scorers page in the Developer Portal. ### Next step * [Quick start guide to Passport Embed](quick-start-guide) * [Review the Component Reference guide](component-reference) * [Try our live demo](https://passport-sample-embed-demo.vercel.app) to see Passport Embed in action --- ### Installation URL: https://docs.passport.xyz/building-with-passport/embed/installation # Installation **Try it out:** Use the [Embed Playground](https://embed-playground.passport.xyz) to configure the widget visually, preview it in real-time, and generate ready-to-use code. This guide covers installing the Passport Embed package and rendering the widget in your React application. ## Prerequisites Before installing, make sure you have: - A React application (v18+) - Your **Embed API key** and **Scorer ID** from the [Developer Portal](https://developer.passport.xyz) If you don't have credentials yet, follow the [getting access guide](getting-access) to generate them. ## Install the Package Add the Passport Embed package to your project: ```bash npm install @human.tech/passport-embed@latest ``` or ```bash yarn add @human.tech/passport-embed@latest ``` ## Basic Setup Import and render the `PassportScoreWidget` component: ```jsx import { PassportScoreWidget, DarkTheme } from "@human.tech/passport-embed"; const EMBED_API_KEY = ""; const SCORER_ID = ""; function MyPage() { // Your wallet connection logic provides userAddress const userAddress = "0x..."; const signMessage = async (message: string): Promise => { const accounts = await window.ethereum.request({ method: "eth_requestAccounts" }); return await window.ethereum.request({ method: "personal_sign", params: [message, accounts[0]] }); }; return ( ); } ``` ### Required Props | Prop | Description | | --- | --- | | `apiKey` | Your Embed API key from the Developer Portal | | `scorerId` | Your Scorer ID from the Developer Portal | | `generateSignatureCallback` | Function to sign messages for OAuth-based stamps (see example above) | ### Optional Props | Prop | Description | | --- | --- | | `address` | User's wallet address (if already known) | | `connectWalletCallback` | Function to prompt wallet connection if address isn't provided | | `theme` | `DarkTheme` or `LightTheme` (defaults to `DarkTheme`) | | `collapseMode` | `"shift"`, `"overlay"`, or `"off"` | For the complete props reference, see the [Component Reference](component-reference). ## Next Steps - [Pulling user data](pulling-user-data) — Retrieve scores and stamps from your application - [Customization](customization) — Theme and style the widget - [Component Reference](component-reference) — Full props and hooks documentation ## Try Before You Code Use the **[Embed Playground](https://embed-playground.passport.xyz)** to configure your widget visually and generate ready-to-use code for your project. --- ### Pulling User Data URL: https://docs.passport.xyz/building-with-passport/embed/pulling-user-data # Pulling User Data Once you've integrated Passport Embed, you'll likely want to access the user's Passport score and stamps data to make decisions in your application. This guide covers how to retrieve this data using the provided React hook and the Stamps API. ## Prerequisites: Two API Keys Required **Secure integrations require two separate API keys:** 1. **Embed API Key** — Used with the `PassportScoreWidget` component and `usePassportScore` hook on your frontend. 2. **Stamps API Key** — Used on your backend to verify scores server-side via the Stamps API. This separation is essential because frontend data can be spoofed. The Embed API key powers the user-facing widget, while the Stamps API key allows your backend to independently verify a user's score before granting access to protected features. You can generate both API keys in the [Developer Portal](https://developer.passport.xyz). See the [getting access guide](getting-access) for detailed instructions. ## Using the usePassportScore Hook The `usePassportScore` hook is the simplest way to access a user's score in your React application. It returns the score and verification status for a given wallet address. ### Installation ```bash npm install @human.tech/passport-embed@latest ``` ### Usage ```jsx import { usePassportScore } from "@human.tech/passport-embed"; // Use your Embed API key here (frontend) const EMBED_API_KEY = "YOUR_EMBED_API_KEY"; const SCORER_ID = "YOUR_SCORER_ID"; function MyComponent() { const { score, isPassing, loading, error } = usePassportScore({ apiKey: EMBED_API_KEY, scorerId: SCORER_ID, address: userAddress }); if (loading) return

Loading score...

; if (error) return

Error: {error.message}

; return (

Score: {score}

Status: {isPassing ? "Passing" : "Not passing"}

); } ``` ### Return Values | Property | Type | Description | | --- | --- | --- | | **score** | `number` | The user's Passport score for the configured scorer. | | **isPassing** | `boolean` | `true` if the score meets the threshold, `false` otherwise. | | **loading** | `boolean` | `true` while the score is being fetched. | | **error** | `Error` | Any error that occurred during the fetch. | **Security note:** Frontend values can be spoofed. Do not use `isPassing` or `score` from this hook to gate access to sensitive features. Instead, use these values as a signal to trigger a backend verification request via the Stamps API. ## Retrieving Stamps Data via Backend To get detailed information about which stamps a user has verified, you need to call the Stamps API directly from your backend. This is the only secure way to verify a user's score before granting access to protected features. Use your **Stamps API key** (not your Embed API key) for these backend requests. This key should be kept secret and never exposed in frontend code. ### API Endpoint ``` GET https://api.passport.xyz/v2/stamps/{scorer_id}/score/{address} ``` ### Example Request ```bash # Use your Stamps API key here (backend only - keep secret) curl -H "X-API-KEY: YOUR_STAMPS_API_KEY" \ "https://api.passport.xyz/v2/stamps/YOUR_SCORER_ID/score/0x..." ``` ### Example Response ```json { "address": "0x...", "score": "25.5", "passing_score": true, "last_score_timestamp": "2024-01-15T10:30:00Z", "expiration_timestamp": "2024-04-15T10:30:00Z", "threshold": "20", "error": null, "stamps": { "Google": { "score": "2.25", "expiration_date": "2024-04-15T10:30:00Z" }, "Github": { "score": "3.75", "expiration_date": "2024-04-15T10:30:00Z" } } } ``` For complete API documentation, see the [Stamps API reference](/building-with-passport/stamps/passport-api). ## Recommended Pattern: Frontend + Backend Verification For secure applications, combine the frontend hook with backend verification: 1. **Frontend:** Use `usePassportScore` with your **Embed API key** to show the user their score and provide immediate UI feedback. 2. **Backend:** When the user attempts to access a protected feature, verify their score server-side using the Stamps API with your **Stamps API key**. ### Frontend Component ```jsx import { usePassportScore } from "@human.tech/passport-embed"; // Embed API key is safe to use in frontend code const EMBED_API_KEY = "YOUR_EMBED_API_KEY"; const SCORER_ID = "YOUR_SCORER_ID"; function ProtectedFeature() { const { isPassing, loading } = usePassportScore({ apiKey: EMBED_API_KEY, scorerId: SCORER_ID, address: userAddress }); const handleAccess = async () => { // Verify server-side before granting access const response = await fetch("/api/verify-passport", { method: "POST", body: JSON.stringify({ address: userAddress }) }); const { verified } = await response.json(); if (verified) { // Grant access to protected feature } }; if (loading) return

Checking eligibility...

; return (
{isPassing ? ( ) : (

You need a higher score to access this feature.

)}
); } ``` ### Backend Verification Endpoint ```js // Example Node.js/Express endpoint // Stamps API key must be kept secret on the backend const STAMPS_API_KEY = process.env.STAMPS_API_KEY; const SCORER_ID = process.env.SCORER_ID; app.post("/api/verify-passport", async (req, res) => { const { address } = req.body; const response = await fetch( `https://api.passport.xyz/v2/stamps/${SCORER_ID}/score/${address}`, { headers: { "X-API-KEY": STAMPS_API_KEY } } ); const data = await response.json(); res.json({ verified: data.passing_score === true }); }); ``` ## Next Steps - [Tutorial: Protecting Sensitive Programs](/building-with-passport/embed/tutorials/protecting-sensitive-programs-with-passport-embed) - Complete walkthrough with backend verification - [Stamps API Reference](/building-with-passport/stamps/passport-api) - Full API documentation for server-side verification - [Component Reference](component-reference) - All available props and hooks --- ### Passport Embed - Customization URL: https://docs.passport.xyz/building-with-passport/embed/customization # Passport Embed - Customization **Try it out:** Use the [Embed Playground](https://embed-playground.passport.xyz) to configure the widget visually, preview it in real-time, and generate ready-to-use code. The Passport Embed component is fully themeable, allowing you to match its appearance to your application's design system. You can customize colors, fonts, border radius, padding, transition timing, and z-index positioning. ## Collapse Mode With Passport Embed, you can control the component’s **collapsible behavior** and how it is displayed relative to your page layout. There are three options for collapse mode: * **`"shift"`** (default): the component is embedded in the flow and expanding it will push/shift surrounding content (useful if placing at top of a page, for example). * **`"overlay"`**: the component will overlay on top of content when expanded (using CSS `position:absolute` or similar, on top of the page, with an overlay background perhaps – the `overlayZIndex` theme can be used to adjust stacking). * **`"off"`**: collapse functionality is disabled; the component is always fully expanded (use this if you want the full component visible at all times in a particular spot). You can experiment with these modes to see which best fits your UI. ## Using Built-in Themes Passport Embed provides two built-in themes: `DarkTheme` and `LightTheme`. You can import them from the package and pass them directly to the component’s theme prop. By default, the component will use `DarkTheme`. ```jsx import { PassportScorecomponent, DarkTheme, LightTheme } from "@human.tech/passport-embed"; ``` If your app supports dynamic theming, you can toggle between these based on the user's preference: ```jsx const theme = isDarkMode ? DarkTheme : LightTheme; ``` These built-in themes provide a solid foundation and follow best practices for accessibility and contrast. ### Extending or Overriding Theme Properties You can also override specific theme values by spreading one of the defaults and replacing the properties you'd like to change: ```jsx const customTheme = { ...DarkTheme, colors: { ...DarkTheme.colors, primary: "255, 255, 0" } }; ``` ### Full Theme Schema The PassportcomponentTheme object lets you customize the look and feel of the component. All fields are optional — if a value is not specified, the defaults from the selected base theme (DarkTheme or LightTheme) will be used. ```jsx export type PassportcomponentTheme = { colors?: { primary?: string; secondary?: string; background?: string; success?: string; failure?: string; }; padding?: { component?: { x?: string; y?: string; }; }; radius?: { component?: string; button?: string; }; transition?: { speed?: string; }; font?: { family?: { body?: string; heading?: string; alt?: string; }; }; position?: { overlayZIndex?: string; }; }; ``` ### Tips & Requirements * `colors.*` must be defined using RGB format — for example: "255, 255, 0" (Hex codes and named colors are not supported) * Font families must reference fonts that are already loaded on the page, except for the component defaults * `overlayZIndex` is only applied when `collapseMode` is set to `overlay` * Use `transition.speed` to fine-tune component animation timing (e.g. `0.2s`, `0.5s`) * All values are optional — anything you omit will fall back to the base theme ### Example ```jsx ``` ## Next Step Once your theme is set, head over to the [Component Reference](component-reference) to see all other available props. **Tip:** Use the **[Embed Playground](https://embed-playground.passport.xyz)** to experiment with themes visually and preview your customizations in real-time. --- ### Component reference URL: https://docs.passport.xyz/building-with-passport/embed/component-reference # Passport Embed -- Component Reference **Try it out:** Use the [Embed Playground](https://embed-playground.passport.xyz) to configure the widget visually, preview it in real-time, and generate ready-to-use code. This section is a technical reference for the PassportScoreWidget React component. It covers all configurable props, their types and meanings, as well as notes on component behavior and usage. Use this as a guide when integrating or troubleshooting the Passport Embed component in your codebase. You will need to have a valid API key and Scorer ID to use the component. You can get these by following the steps in our [getting access guide](getting-access). ## Installing the Package You can install the package using npm or yarn: ```bash npm install @human.tech/passport-embed@latest ``` or ```bash yarn add @human.tech/passport-embed@latest ``` ## Component Import Make sure you have imported the component from the library: ```jsx import { PassportScoreWidget, DarkTheme, LightTheme } from "@human.tech/passport-embed"; ``` ## Rendering the component Once imported, you can render the `PassportScoreWidget` component anywhere in your React app where you want the verification UI to appear — for example, in a gated page, modal, or call-to-action section. Here’s a basic example: ```jsx ``` ## Props The PassportScoreWidget accepts the following props: | Prop Name | Type / Values | Description and Usage | | ----------------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **apiKey** (required) | `string` | _Required._ Learn how to [get an API key](getting-access) for your project. This is required to authorize requests to the Passport scoring API. Example: `apiKey="abc123..."`. Without a valid API key, the component will not be able to retrieve scores (you may receive an authorization error). Note that you should have two API keys: one for the actual Embed component, and one for the Stamps API request. | | **scorerId** (required) | `string` or `number` | _Required._ Learn how to [get a Scorer ID](getting-access) for your project. The identifier of the **Scorer** configuration to use. This tells the component _which scoring model_ to apply to the user. For example, `scorerId="5"` might correspond to the “Unique Humanity (binary)” scorer which returns a yes/no based on threshold​. Ensure this ID matches one configured in your Passport dashboard. | | **address** | `string` (Ethereum address) or `undefined` | _Optional._ The user’s wallet address to check. If you already have the user’s address (e.g., they logged in via wallet), pass it here. If not provided, the component can prompt the user to connect their wallet (see `connectWalletCallback`). When `address` is set/updated, the component will automatically fetch and display the Passport score for that address. | | **connectWalletCallback** | `() => Promise` | _Optional._ If you don't already have the user's wallet address (`address` prop is undefined), you can provide this callback function to prompt the user to connect their wallet. The component will render a "Connect Wallet" button. When clicked, this function is executed and should handle connecting the user’s wallet (e.g., via MetaMask), then set the wallet address externally in your component's state. The component will then detect the updated address prop and proceed to fetch the score. If omitted, manage the wallet connection entirely outside the component. | | **generateSignatureCallback** | `(message: string) => Promise` | _Required._ A callback to confirm that the user completing the OAuth verification's (OAuth-based Stamps, such as GitHub, Google, etc.) also controls the wallet address they’re associating with the Stamp. After the user’s address is known, the component will request a signature to prove ownership of that address. Passport will supply a challenge `message` (string) which needs to be signed by the user’s wallet. Provide a function that takes the message and returns a signed message (signature string). If this callback is missing, the OAuth-based Stamps will not work within the component. | | **collapseMode** | `"shift"`, `"overlay"`, or `"off"` | _Optional._ Controls the component's collapsible behavior and how it is displayed relative to your page layout.

**`"shift"`** (default): the component is embedded in the flow and expanding it will push/shift surrounding content (useful if placing at top of a page, for example).
**`"overlay"`**: the component will overlay on top of content when expanded. The `overlayZIndex` theme property can be used to adjust stacking.
**`"off"`**: collapse functionality is disabled; the component is always fully expanded (use this if you want the full component visible at all times in a particular spot). You can experiment with these modes to see which best fits your UI. | | **theme** | `PassportWidgetTheme` object | _Optional._ Defaults to `DarkTheme`Customizes the component’s look and feel. You can pass your own theme object or import and extend the default `LightTheme` or `DarkTheme` from the package. If your app supports dark mode, you can dynamically choose which to use based on a `prefers-color-scheme` check or similar logic. | | **className** | `string` | _Optional._ Additional CSS class name to apply to the component’s container. Use this if you want to target the widget with your own CSS (for example, to adjust its width, margin, or to apply custom styles beyond what the theme covers). The component’s root element always has a default class (.passport-widget-container), but className lets you add your own custom styles (e.g. for spacing or layout overrides). | | ## Hooks In addition to the main PassportScoreWidget component, the Passport Embed package provides a set of React hooks for developers who want to work with Unique Humanity Scores programmatically, or build a custom verification UI. ### usePassportScore Fetches the user's Passport score and verification status for a given wallet address and Scorer ID. **Please note:**
If you are simply displaying a user's score, relying on the data returned by the `usePassportScore` should suffice.

However, since frontend values can be spoofed, don’t trust it for sensitive program protection. Instead, use `isPassing` as a signal to trigger a backend verification request via the [Stamps API](/building-with-passport/stamps/passport-api). The Stamps API will actually confirm the score server-side, meaning you can confidently unlock protected features based on the user's score. #### Returns | Prop Name | Type | Description | | --- | --- | --- | | **score** | `number` | The user's Passport score for the given scorer. | | **isPassing** | `boolean` | `true` if the user's score is passing for the given scorer, `false` otherwise. | | **loading** | `boolean` | `true` if the score is currently being fetched, `false` otherwise. | | **error** | `Error` | Any error that occurred while fetching the score. | #### Example Here is an example of how to use the hook without making a request to the Stamps API to confirm the score server-side (not recommended for protecting sensitive programs): ```jsx import { usePassportScore } from "@human.tech/passport-embed"; const { score, isPassing, loading, error } = usePassportScore({ apiKey: PASSPORT_API_KEY, scorerId: PASSPORT_SCORER_ID, address: userAddress }); if (loading) return

Loading score...

; if (error) return

Error fetching score.

; return (

Your Passport score: {score}

{isPassing ? (

✅ You meet the threshold!

) : (

⚠️ You don't meet the required score yet.

)}
); ``` Please refer to our [tutorial](/building-with-passport/embed/tutorials/protecting-sensitive-programs-with-passport-embed) to see an example of how to use this hook with a request to the Stamps API to confirm the score server-side (recommended for protecting sensitive programs). ## Usage Example Suppose we want to embed the component in a page and allow it to handle wallet connection. We also want it to appear as a small badge that the user can expand. We might use the following props: ```jsx import { PassportScoreWidget, DarkTheme } from "@human.tech/passport-embed"; ``` To review a more in-depth example, see our [tutorial](/building-with-passport/embed/tutorials/protecting-sensitive-programs-with-passport-embed). You can also use the **[Embed Playground](https://embed-playground.passport.xyz)** to configure the widget visually and generate code. ## Component Behavior * **Initial State:** The component will detect if an `address` is provided. If not, it typically shows a prompt or button to connect a wallet (assuming `connectWalletCallback` is given). If an address is already provided, it will immediately attempt to fetch the Passport score for that address (calling `generateSignatureCallback` internally when needed). * **Loading & Error Handling:** While the score is being fetched, the component may show a loading indicator. If an error occurs (e.g., network issues or invalid API key), the component will handle it by showing an error message in the UI (and you might see errors in the console for debugging). You don’t need to manually catch errors from the callbacks – the component will display a user-friendly message (“Failed to load score,” etc.) if something goes wrong. * **Display of Score:** Once retrieved, the component will display a user's Stamp-based unique humanity score. A partner's score threshold can be set via the Developer Portal. This threshold will be used to identify if a user is passing or failing the verification. * **Verify additional stamps:** If the user’s score is below the score threshold, the component will guide them on next steps, which involves verifying additional stamps via the embed component. After the user verifies additional stamps, the component will automatically update the score via the UI. * **Collapsing/Expanding:** With `collapseMode` set to `"shift"` or `"overlay"`, the component will start in a minimized state – often an icon or small bar. When clicked, it expands to show the full details (score, message, etc.). If "off" is used, it’s always expanded. The expanded component could be a panel that either pushes content (shift) or overlays above it. The user can likely collapse it back after viewing. This behavior allows the verification UI to stay out of the way until needed, which is especially useful on content-heavy pages. --- ## Building with Passport > Embed > Tutorials ### Tutorial - Protecting Sensitive Programs with Passport Embed URL: https://docs.passport.xyz/building-with-passport/embed/tutorials/protecting-sensitive-programs-with-passport-embed # Tutorial: Protecting Sensitive Programs with Passport Embed This tutorial walks you through building a complete application that uses Passport Embed to protect sensitive content behind a Unique Humanity Score threshold. You'll learn how to implement wallet connection, display the Passport verification component, and conditionally unlock protected content. **Want to see the complete implementation?** Check out our [live demo](https://passport-sample-embed-demo.vercel.app) and [source code](https://github.com/passportxyz/passport-sample-embed-demo) to see all these concepts working together in a production-ready application. ## What You'll Build By the end of this tutorial, you'll have a Next.js application featuring: - **Wallet Connection**: Users can connect their Ethereum wallet using Reown AppKit - **Passport Embed Component**: Display the user's Unique Humanity Score and verification interface - **Protected Content**: Content that's only accessible when the user meets your score threshold - **Secure Verification**: Both client-side and server-side score validation for security ## Prerequisites Before starting, make sure you have: - Node.js 18+ installed - Basic familiarity with React and Next.js - A Passport API key and Scorer ID ([get access here](../getting-access)) - A Reown Project ID ([create one here](https://cloud.reown.com)) ## Project Setup Let's start by creating a new Next.js project and installing the required dependencies. ### Step 1: Initialize the Project We're using Next.js 14 for its excellent TypeScript support and API routes, which we'll need for secure server-side score verification. The configuration ensures compatibility with our wallet connection and Passport integration libraries. ```bash npx create-next-app@14 passport-embed-tutorial --typescript --tailwind --eslint --app=false --src-dir=false --import-alias="@/*" cd passport-embed-tutorial ``` **Key choices explained:** - `--typescript`: Essential for type safety with web3 libraries - `--tailwind`: For utility-first styling that matches Passport's design system - `--app=false`: Using Pages Router for simpler API routes - `--eslint`: Code quality enforcement for production readiness ### Step 2: Install Dependencies These packages provide the core functionality for wallet connection, Passport integration, and secure state management: ```bash npm install @human.tech/passport-embed@latest @reown/appkit @reown/appkit-adapter-wagmi @tanstack/react-query wagmi ``` **Package breakdown:** - `@human.tech/passport-embed`: Passport Embed component and hooks - `@reown/appkit`: Multi-wallet connection UI and management - `@reown/appkit-adapter-wagmi`: Bridge between Reown and Wagmi React hooks - `@tanstack/react-query`: Server state management for async blockchain data - `wagmi`: React hooks for Ethereum, handles caching and synchronization ### Step 3: Environment Configuration Environment variables keep your API keys secure and allow different configurations for development vs. production. Quick reminder that you can create your API keys and Scorer ID in the [Passport Developer Portal](https://developer.passport.xyz/). You should have **two separate API keys**: one for the Embed component (client-side) and another for the Stamps API (server-side). You can use the **same Scorer ID** for both. You can also generate your Reown project ID in the [Reown Cloud](https://cloud.reown.com/). Create a `.env.local` file in your project root: ```env # Passport Configuration NEXT_PUBLIC_PASSPORT_API_KEY=your_embed_api_key_here NEXT_PUBLIC_PASSPORT_SCORER_ID=your_scorer_id_here # Server-side API Key for Stamps API verification (keep secret!) PASSPORT_API_KEY=your_stamps_api_key_here # Reown Configuration NEXT_PUBLIC_REOWN_PROJECT_ID=your_reown_project_id_here ``` **Environment variables explained:** - **NEXT_PUBLIC_PASSPORT_API_KEY**: Client-side Embed API key (accessible in browser) - **PASSPORT_API_KEY**: Server-side Stamps API key (secure, server-only) - **NEXT_PUBLIC_PASSPORT_SCORER_ID**: Your scorer configuration ID (same for both client and server) - **NEXT_PUBLIC_REOWN_PROJECT_ID**: Wallet connection configuration - Variables with `NEXT_PUBLIC_` prefix are accessible in the browser - Non-prefixed variables like `PASSPORT_API_KEY` remain server-only for security ## Building the Application Now let's build our application step by step, starting with wallet configuration and moving through each component. ### Step 4: Configure Wallet Connection Modern web3 applications need to support various wallet providers (MetaMask, WalletConnect, Coinbase Wallet, etc.) while maintaining a consistent user experience. Reown AppKit provides this abstraction layer and automatically handles wallet state management. Create `config/wallet.ts` to set up Reown AppKit: ```typescript import { createAppKit } from '@reown/appkit' import { WagmiAdapter } from '@reown/appkit-adapter-wagmi' import { mainnet } from '@reown/appkit/networks' import type { AppKitNetwork } from '@reown/appkit/networks' // Get projectId from environment export const projectId = process.env.NEXT_PUBLIC_REOWN_PROJECT_ID if (!projectId) { throw new Error('NEXT_PUBLIC_REOWN_PROJECT_ID is not set') } // Create networks array const networks: [AppKitNetwork, ...AppKitNetwork[]] = [mainnet] // Create Wagmi Adapter export const wagmiAdapter = new WagmiAdapter({ networks, projectId, ssr: true }) // Create modal export const modal = createAppKit({ adapters: [wagmiAdapter], networks, projectId, metadata: { name: 'Passport Embed Tutorial', description: 'Learn how to integrate Passport Embed', url: 'https://docs.passport.xyz', icons: ['https://docs.passport.xyz/favicon.ico'] }, features: { analytics: false } }) export const config = wagmiAdapter.wagmiConfig ``` **Key concepts explained:** - **WagmiAdapter**: Creates a bridge between Reown AppKit's UI components and Wagmi's React hooks for blockchain interaction - **Networks array**: Defines which blockchains your app supports (we're using Ethereum mainnet) - **Metadata**: Shows in wallet connection prompts to build user trust - **SSR: true**: Enables server-side rendering compatibility ### Step 5: Set Up App Configuration Web3 applications have unique state management needs. Blockchain data is asynchronous, can change frequently, and needs efficient caching. React Query handles the caching and synchronization, while Wagmi provides the blockchain-specific hooks. Update `pages/_app.tsx` to configure React Query and Wagmi: ```typescript import type { AppProps } from 'next/app' import { WagmiProvider } from 'wagmi' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { config } from '../config/wallet' import '../styles/globals.css' // Create React Query client const queryClient = new QueryClient() export default function App({ Component, pageProps }: AppProps) { return ( ) } ``` **Critical setup notes:** - **Provider order matters**: `WagmiProvider` must wrap `QueryClientProvider` because Wagmi hooks depend on React Query internally - **QueryClient**: Handles caching and synchronization of blockchain state across your entire application - **Config import**: Uses the wallet configuration we set up in Step 4 ### Step 6: Create the Main Page Component This is where the magic happens. We're creating a dual-verification system that provides immediate user feedback through client-side hooks while maintaining security through server-side validation. The UI handles multiple states: disconnected, connecting, verifying, and different score levels. Replace `pages/index.tsx` with our main application: ```typescript import { useState, useEffect } from 'react' import { useAccount } from 'wagmi' import { PassportScoreWidget, DarkTheme, usePassportScore } from '@human.tech/passport-embed' const PASSPORT_API_KEY = process.env.NEXT_PUBLIC_PASSPORT_API_KEY! const PASSPORT_SCORER_ID = process.env.NEXT_PUBLIC_PASSPORT_SCORER_ID! interface VerifiedScore { score: number isPassing: boolean } export default function Home() { const { address, isConnected } = useAccount() const [verifiedScore, setVerifiedScore] = useState(null) // Client-side score fetching const passportData = usePassportScore({ apiKey: PASSPORT_API_KEY, scorerId: PASSPORT_SCORER_ID, address: address }) const { score, isPassing, loading } = passportData // Server-side score verification - only when client-side shows passing score useEffect(() => { if (address && isConnected && passportData?.passingScore && !verifiedScore) { console.log('🔍 Client-side shows passing score, starting server-side verification') fetch('/api/verify-score', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ address }) }) .then(res => res.json()) .then(data => { if (data.verified) { const numericScore = parseFloat(data.score) setVerifiedScore({ score: numericScore, isPassing: numericScore >= 20 }) } else { setVerifiedScore(null) } }) .catch(err => { console.error('🚨 Server-side score verification error') setVerifiedScore(null) }) } else if (!address || !isConnected) { setVerifiedScore(null) } }, [address, isConnected, passportData?.passingScore, verifiedScore]) // Signature callback for OAuth-based Stamps const signMessage = async (message: string): Promise => { if (!window.ethereum) throw new Error('No wallet found') const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) return await window.ethereum.request({ method: 'personal_sign', params: [message, accounts[0]] }) } return (
{/* Header */}
P

Passport Embed Tutorial

{/* Main Content */}

Build Your Unique Humanity Score to Unlock Exclusive Access

Connect your wallet and verify your humanity through our decentralized identity verification system to access protected content.

{/* Passport Embed Component */}

Verify Your Humanity

{isConnected && address ? ( ) : (

Connect your wallet to start building your Unique Humanity Score

)}
{/* Access Status Panel */}
{verifiedScore?.isPassing ? ( ) : ( )}

{verifiedScore?.isPassing ? 'Access Unlocked!' : 'Access Locked'}

{verifiedScore ? (

Your Unique Humanity Score: {verifiedScore.score.toFixed(2)}

{verifiedScore.isPassing ? (

Congratulations! You've met the minimum score requirement of 20.

🎉 Exclusive Access Granted

You now have access to our exclusive Telegram community!

Join Exclusive Telegram →
) : (

You need a score of 20 or higher to unlock exclusive access. Keep verifying more Stamps to increase your score!

)}
) : (

Connect your wallet and complete verification to see your access status.

)}
) } ``` ### Step 7: Create Server-Side Verification API While the Passport Embed component provides immediate client-side feedback, you should never trust client-side data for protecting sensitive resources. This API route provides secure server-side verification using the [Stamps API](https://docs.passport.xyz/building-with-passport/stamps/passport-api/api-reference) to ensure scores can't be tampered with. Create `pages/api/verify-score.ts` for secure score validation: ```typescript import type { NextApiRequest, NextApiResponse } from 'next' const API_KEY = process.env.PASSPORT_API_KEY! const SCORER_ID = process.env.NEXT_PUBLIC_PASSPORT_SCORER_ID! interface VerifyScoreRequest { address: string } interface VerifyScoreResponse { verified: boolean score?: string isPassing?: boolean error?: string } interface StampsApiResponse { score: number passing_score: boolean threshold: number last_score_timestamp: string expiration_timestamp: string error?: string } export default async function handler( req: NextApiRequest, res: NextApiResponse ) { if (req.method !== 'POST') { return res.status(405).json({ verified: false, error: 'Method not allowed' }) } const { address }: VerifyScoreRequest = req.body if (!address) { return res.status(400).json({ verified: false, error: 'Address is required' }) } if (!API_KEY || !SCORER_ID) { return res.status(500).json({ verified: false, error: 'Server configuration error' }) } try { const url = `https://api.passport.xyz/v2/stamps/${SCORER_ID}/score/${address}` const response = await fetch(url, { method: 'GET', headers: { 'X-API-KEY': API_KEY, 'Content-Type': 'application/json' } }) if (!response.ok) { throw new Error(`API responded with status: ${response.status}`) } const data: StampsApiResponse = await response.json() if (data.error) { throw new Error(data.error) } const meetsThreshold = data.score >= 20 if (meetsThreshold && data.passing_score) { return res.status(200).json({ verified: true, score: data.score.toString(), isPassing: true }) } else { return res.status(200).json({ verified: false, score: data.score.toString(), isPassing: false }) } } catch (error) { console.error('Error verifying score:', error) return res.status(500).json({ verified: false, error: 'Failed to verify score' }) } } ``` ### Step 8: Add Styling This step creates a cohesive design system that works well with the Passport Embed component and provides a professional dark theme that matches modern web3 applications. The styling includes specific optimizations for the Passport component and Reown AppKit components. Create `styles/globals.css`: ```css @tailwind base; @tailwind components; @tailwind utilities; @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); :root { --foreground-rgb: 255, 255, 255; --background-start-rgb: 17, 24, 39; --background-end-rgb: 17, 24, 39; } * { box-sizing: border-box; padding: 0; margin: 0; } html, body { max-width: 100vw; overflow-x: hidden; font-family: 'Inter', sans-serif; } body { color: rgb(var(--foreground-rgb)); background: rgb(var(--background-start-rgb)); } a { color: inherit; text-decoration: none; } /* Passport Embed Component Styling */ .passport-widget-container { border-radius: 0.75rem !important; border: 1px solid rgb(55 65 81) !important; } /* Reown AppKit Button Styling */ appkit-button { --w3m-font-family: 'Inter', sans-serif !important; --w3m-border-radius-master: 0.5rem !important; } ``` **Key styling features:** - **Dark theme**: Professional gray-900 background matching web3 conventions - **Inter font**: Clean, readable font that works well for wallet addresses and technical content - **Component integration**: Specific overrides ensure the Passport Embed component fits seamlessly - **Component consistency**: Unified styling between Reown AppKit and custom components For advanced customization, see the [Passport Embed Customization Guide](../customization). ## Testing Your Application Now you can test your application: ```bash npm run dev ``` Visit `http://localhost:3000` and you should see: 1. **Header** with wallet connection button 2. **Main title** explaining the verification process 3. **Passport Embed component** (after wallet connection) 4. **Access panel** showing lock/unlock status based on score **Security Note** This tutorial uses both client-side (`usePassportScore`) and server-side (`/api/verify-score`) verification. The client-side hook provides immediate feedback, while the server-side API ensures security against score tampering. Always use server-side verification for protecting sensitive resources. ## Key Concepts Explained ### Hybrid Verification Approach This tutorial demonstrates a security-first approach with smart monitoring: - **Client-side hook** (`usePassportScore`) provides immediate UI feedback and monitors score changes - **Smart triggering** - Server-side verification only occurs when client-side shows a passing score - **Server-side API** (`/api/verify-score`) validates scores securely via the Stamps API v2 - **Conditional rendering** shows different states based on verified scores - **Guard conditions** prevent redundant API calls with `!verifiedScore` check ### Score Monitoring Pattern The implementation uses an intelligent monitoring approach: ```typescript // Only trigger server verification when: // 1. Wallet is connected // 2. Client-side shows passing score // 3. No verified score exists yet (prevents redundant calls) useEffect(() => { if (address && isConnected && passportData?.passingScore && !verifiedScore) { // Trigger server-side verification } }, [address, isConnected, passportData?.passingScore, verifiedScore]) ``` This pattern ensures: - **Efficient API usage** - No unnecessary server calls - **Real-time updates** - Responds immediately when users reach threshold - **Security validation** - Server confirms client-side results ### Wallet Integration The Reown AppKit integration provides: - **Multiple wallet support** (MetaMask, WalletConnect, etc.) - **ENS name resolution** for better UX - **Ethereum address management** with automatic updates ### Score Threshold Logic The application checks for a minimum score of 20: - Scores below 20 show locked state with encouragement to verify more Stamps - Scores 20+ unlock exclusive content (Telegram access in this example) - Real-time updates as users complete additional verifications ## Next Steps Congratulations! You've built a complete Passport Embed integration. To extend this further, consider: - Adding more sophisticated protected content - Creating custom themes to match your brand using the [Customization Guide](../customization) - Integrating with your existing authentication system - Implementing SIWE (Sign-In with Ethereum) for additional security **Explore More** - [Component Reference](../component-reference) - Detailed component documentation - [Customization Guide](../customization) - Theming and styling options - [Stamps API Reference](https://docs.passport.xyz/building-with-passport/stamps/passport-api/api-reference) - Server-side verification endpoints - [Live Demo](https://passport-sample-embed-demo.vercel.app) - Production-ready reference implementation - [Source Code](https://github.com/passportxyz/passport-sample-embed-demo) - Complete example repository --- ## Building with Passport > Individual Verifications ### Individual Verifications URL: https://docs.passport.xyz/building-with-passport/individual-verifications/introduction # Individual Verifications Individual Verifications let users complete identity checks once and reuse them across any integrated application. Powered by zero-knowledge proofs, verifications are privacy-preserving — apps learn that a user passed KYC, not their name or ID number. Unlike [Stamps-based verification](/building-with-passport/stamps), which aggregates multiple signals into a composite score, Individual Verifications provide specific, targeted proofs such as government ID verification, phone number uniqueness, or biometric liveness checks. **Choosing the right verification approach** Human Passport offers multiple verification methods: - **[Stamps](/building-with-passport/stamps)** - Aggregate multiple signals into a composite score. Best for general Sybil resistance. - **[Models](/building-with-passport/models)** - ML-powered scoring with zero user friction. Best for frictionless verification. - **[Individual Verifications](/building-with-passport/individual-verifications/introduction)** - Privacy-preserving KYC, phone, biometrics, and AML checks. Best for regulatory compliance or stronger identity guarantees. ## Why Individual Verifications? | | Traditional KYC | Individual Verifications | |--|-----------------|--------------------------| | **Data shared** | Full PII (name, ID number, address) | Only pass/fail — zero personal data | | **Reusability** | Verify separately per app | Verify once, reuse everywhere | | **Compliance** | Varies by provider | Built-in KYC and AML (Clean Hands) | | **User experience** | Minutes of forms per app | One-time verification + instant reuse | | **Sybil resistance** | Depends on implementation | Built-in — attestations are tied to verified individuals | ## How Zero-Knowledge Proofs Work 1. **Verification**: The user completes an identity check (e.g., government ID scan) with an identity verification provider. 2. **Credential creation**: A cryptographic credential is created and stored client-side. Personal data never leaves the user's device. 3. **Proof generation**: When an app needs proof, the user generates a ZK proof — a compact cryptographic certificate that proves "I passed KYC" without revealing any underlying data. 4. **On-chain attestation**: The proof is verified and recorded on-chain as an attestation via [Sign Protocol](https://sign.global/) (on Optimism/Base) or as an SBT on Stellar. Think of it like a bouncer checking your ID at a bar. The bouncer confirms you're over 21, but the bar never sees your name, address, or birthdate. ZKPs work the same way — cryptographic proof of a fact, with zero personal data disclosed. Each verification type (Gov ID, Phone, Biometrics, Clean Hands) uses a different ZK circuit — a specific proof program. See [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) for circuit and schema IDs. ## Available Verification Types | Verification | Description | Link | |--------------|-------------|------| | **Government ID (KYC)** | Verify identity via government-issued ID (passport, driver's license, national ID) | [id.human.tech/gov-id](https://id.human.tech/gov-id) | | **Phone** | Verify a unique phone number | [id.human.tech/phone](https://id.human.tech/phone) | | **Biometrics** | Non-identifying face uniqueness and liveness check | [id.human.tech/biometrics](https://id.human.tech/biometrics) | | **Proof of Clean Hands** | Sanctions and PEP list verification (AML compliance) | [id.human.tech/clean-hands](https://id.human.tech/clean-hands) | ### Sandbox Environment For testing and development, sandbox versions are available: | Verification | Sandbox Link | |--------------|--------------| | Government ID (KYC) | [id.human.tech/sandbox/gov-id](https://id.human.tech/sandbox/gov-id) | | Phone | [id.human.tech/sandbox/phone](https://id.human.tech/sandbox/phone) | | Proof of Clean Hands | [id.human.tech/sandbox/clean-hands](https://id.human.tech/sandbox/clean-hands) | | Biometrics | Coming soon | ## Supported Chains Individual Verifications issue attestations via [Sign Protocol](https://sign.global/) on multiple chains: - **Optimism** - Primary chain with full verification support - **Base** - Clean Hands and Biometrics attestations - **Stellar** - Soroban smart contract integration (Gov ID, Phone) — [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) See the [Supported Chains](/building-with-passport/individual-verifications/supported-chains) page for chain-specific details. ## Basic Integration Flow ### Quickstart: Check if a user is KYC-verified A single API call checks whether an address has a valid verification: ```bash curl 'https://api.holonym.io/sybil-resistance/gov-id/optimism?user=USER_ADDRESS&action-id=123456789' ``` ```json // Verified user { "result": true, "expirationDate": 1770922106 } // Not verified { "result": false } ``` That's it — one API call. For on-chain verification, query Sign Protocol attestations directly. See [API Reference](/building-with-passport/individual-verifications/api-reference) for all endpoints or [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) for on-chain queries. ## Integration Options Choose the integration method that best fits your use case: | Use Case | Method | Description | |----------|--------|-------------| | **Simple verification checks** | [API Reference](/building-with-passport/individual-verifications/api-reference) | Query verification status with simple true/false responses | | **On-chain contracts** | [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) | Query Sign Protocol attestations directly | | **Client-side dApps** | [SDK Integration](/building-with-passport/individual-verifications/major-concepts/sdk) | Embed verification flows in your application | | **Stellar integration** | [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) | Query SBTs on Stellar via Soroban | ## Next Steps - [API Reference](/building-with-passport/individual-verifications/api-reference) - Query verification status via REST API - [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) - Query attestations directly from Sign Protocol - [Testing](/building-with-passport/individual-verifications/major-concepts/testing) - Test your integration on Base Sepolia - [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) - Integrate on Stellar via Soroban SBTs - [API Playground](https://passport-api-playground.vercel.app) - Try out API endpoints interactively --- ### Individual Verifications -- API Reference URL: https://docs.passport.xyz/building-with-passport/individual-verifications/api-reference # Individual Verifications -- API Reference The Individual Verifications API enables developers to check whether users have completed specific identity verifications (government ID, phone, biometrics) and query their verification status. Looking to query attestations directly? See [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) for Sign Protocol schema documentation and direct query methods. Try out these endpoints interactively in the [API Reference Playground](https://passport-api-playground.vercel.app). In the examples below, replace the following placeholder values with your actual data: - `{network}` - The blockchain network (`optimism` or `base-sepolia`) - `{address}` - The user's blockchain address - `{action-id}` - Your action ID for sybil resistance (default: `123456789`) ## Base URL ``` https://api.holonym.io ``` ## Action IDs Action IDs enable sybil resistance. Use the default action ID `123456789` for most use cases - it provides universal uniqueness across all applications. Custom action IDs are available for specific use cases. [Contact us](https://tally.so/r/3X81KL) to discuss your requirements. ## Available Endpoints | Endpoint Action | Endpoint | |-----------------|----------| | [Check government ID verification](#check-government-id-verification) | `GET /sybil-resistance/gov-id/{network}` | | [Check phone verification](#check-phone-verification) | `GET /sybil-resistance/phone/{network}` | | [Check biometrics verification](#check-biometrics-verification) | `GET /sybil-resistance/biometrics/{network}` | | [Query Proof of Clean Hands attestations](#query-proof-of-clean-hands-attestations-via-sign-protocol) | Sign Protocol API | | [Proof of Clean Hands SBTs (Sui)](#proof-of-clean-hands-sbts-sui) | `GET /attestation/sbts/clean-hands` | --- ### Check Government ID Verification Returns whether a user has completed government ID (KYC) verification and has a unique proof for the specified action. > GET /sybil-resistance/gov-id/\{network\} #### Query Parameters | Name | Required | Description | |------|----------|-------------| | `user` | Yes | The user's blockchain address | | `action-id` | Yes | Your action ID for sybil resistance. Use `123456789` for the default action ID, or a custom value for app-specific uniqueness. | ```bash filename="Sample request" copy curl --request GET \ 'https://api.holonym.io/sybil-resistance/gov-id/optimism?user={address}&action-id=123456789' ``` ```json filename="Sample response (verified)" { "result": true, "expirationDate": 1770922106 } ``` ```json filename="Sample response (not verified)" { "result": false } ``` #### Response | Field | Type | Description | |-------|------|-------------| | `result` | boolean | `true` if the user has a valid verification, `false` otherwise | | `expirationDate` | number | Unix timestamp when the verification expires (only present when `result` is `true`) | --- ### Check Phone Verification Returns whether a user has completed phone verification and has a unique proof for the specified action. > GET /sybil-resistance/phone/\{network\} #### Query Parameters | Name | Required | Description | |------|----------|-------------| | `user` | Yes | The user's blockchain address | | `action-id` | Yes | Your action ID for sybil resistance | ```bash filename="Sample request" copy curl --request GET \ 'https://api.holonym.io/sybil-resistance/phone/optimism?user={address}&action-id=123456789' ``` ```json filename="Sample response (verified)" { "result": true, "expirationDate": 1770922106 } ``` --- ### Check Biometrics Verification Returns whether a user has completed biometric verification (face uniqueness and liveness check). > GET /sybil-resistance/biometrics/\{network\} #### Query Parameters | Name | Required | Description | |------|----------|-------------| | `user` | Yes | The user's blockchain address | | `action-id` | Yes | Your action ID for sybil resistance | ```bash filename="Sample request" copy curl --request GET \ 'https://api.holonym.io/sybil-resistance/biometrics/optimism?user={address}&action-id=123456789' ``` ```json filename="Sample response (verified)" { "result": true, "expirationDate": 1780661994 } ``` --- ## Snapshot Strategy Endpoints These endpoints are designed for integration with Snapshot governance voting. ### Configuring Snapshot To use Individual Verifications with Snapshot, configure the ["api" strategy](https://github.com/snapshot-labs/snapshot-strategies/tree/master/src/strategies/api) with the following parameters: ```json filename="Government ID Sybil Resistance" { "api": "https://api.holonym.io", "symbol": "", "decimals": 0, "strategy": "snapshot-strategies/sybil-resistance/gov-id", "additionalParameters": "action-id=123456789" } ``` ```json filename="Phone Sybil Resistance" { "api": "https://api.holonym.io", "symbol": "", "decimals": 0, "strategy": "snapshot-strategies/sybil-resistance/phone", "additionalParameters": "action-id=123456789" } ``` We recommend using the default action ID `123456789`. [Contact us](https://tally.so/r/3X81KL) if you need a custom action ID. --- ### Snapshot: Government ID Sybil Resistance > GET /snapshot-strategies/sybil-resistance/gov-id #### Query Parameters | Name | Required | Description | |------|----------|-------------| | `network` | Yes | Chain ID | | `snapshot` | Yes | Block height | | `addresses` | Yes | Comma-separated list of blockchain addresses | | `action-id` | Yes | Your action ID for sybil resistance | ```bash filename="Sample request" copy curl --request GET \ 'https://api.holonym.io/snapshot-strategies/sybil-resistance/gov-id?network=10&snapshot=12345678&addresses={address1},{address2}&action-id=123456789' ``` ```json filename="Sample response" { "score": [ { "address": "0x123...", "score": 1 }, { "address": "0x456...", "score": 0 } ] } ``` ### Snapshot: Phone Sybil Resistance > GET /snapshot-strategies/sybil-resistance/phone Uses the same parameters and response format as the Government ID Snapshot endpoint. ### Snapshot: Biometrics Sybil Resistance > GET /snapshot-strategies/sybil-resistance/biometrics Uses the same parameters and response format as the Government ID Snapshot endpoint. --- ## Proof of Clean Hands (PoCH) Proof of Clean Hands verification proves that a user is not on sanctions or PEP (Politically Exposed Persons) lists. This enables regulatory compliance while preserving user privacy. ### Query Proof of Clean Hands Attestations via Sign Protocol Proof of Clean Hands attestations are issued through Sign Protocol. Query a user's attestation status using the Sign Protocol API. > GET https://mainnet-rpc.sign.global/api/scan/addresses/\{address\}/attestations ```bash filename="Sample request" copy curl --request GET \ 'https://mainnet-rpc.sign.global/api/scan/addresses/{address}/attestations' ``` ```json filename="Sample response" { "data": { "rows": [ { "fullSchemaId": "onchain_evm_10_0x8", "attester": "0xB1f50c6C34C72346b1229e5C80587D0D659556Fd", "isReceiver": true, "revoked": false, "validUntil": 1735689600 } ] } } ``` #### Validating a Proof of Clean Hands Attestation To confirm a user has a valid Proof of Clean Hands attestation, verify all of the following conditions: | Field | Required Value | Description | |-------|----------------|-------------| | `fullSchemaId` | `onchain_evm_10_0x8` | The schema ID for Proof of Clean Hands attestations on Optimism | | `attester` | `0xB1f50c6C34C72346b1229e5C80587D0D659556Fd` | The authorized attester address | | `isReceiver` | `true` | Confirms the queried address is the attestation recipient | | `revoked` | `false` | Attestation has not been revoked | | `validUntil` | Greater than current timestamp | Attestation has not expired | ```typescript filename="Validation example" function hasValidCleanHandsAttestation(attestations: any[]): boolean { const now = Math.floor(Date.now() / 1000); return attestations.some(att => att.fullSchemaId === 'onchain_evm_10_0x8' && att.attester === '0xB1f50c6C34C72346b1229e5C80587D0D659556Fd' && att.isReceiver === true && att.revoked === false && att.validUntil > now ); } ``` ### Proof of Clean Hands SBTs (Sui) For Sui blockchain integration, query Proof of Clean Hands SBT status directly. > GET /attestation/sbts/clean-hands #### Query Parameters | Name | Required | Description | |------|----------|-------------| | `address` | Yes | The user's Sui address | | `action-id` | Yes | Your action ID | ```bash filename="Sample request" copy curl --request GET \ 'https://api.holonym.io/attestation/sbts/clean-hands?address={sui_address}&action-id=123456789' ``` ```json filename="Sample response (verified user)" { "isUnique": true, "signature": "0x...", "circuitId": 12345 } ``` ```json filename="Sample response (non-verified user)" { "isUnique": false } ``` #### Response | Field | Type | Description | |-------|------|-------------| | `isUnique` | boolean | `true` if the user has a valid Proof of Clean Hands attestation, `false` otherwise | | `signature` | string | Cryptographic signature for on-chain verification (only present when `isUnique` is `true`) | | `circuitId` | number | The circuit identifier used for the attestation (only present when `isUnique` is `true`) | Proof of Clean Hands verification combines KYC data with AML (Anti-Money Laundering) checks. The user's identity information is encrypted and can only be decrypted by authorized parties in case of regulatory requirements. --- ## Supported Networks | Network | Path Value | Supported Endpoints | |---------|------------|---------------------| | Optimism (Mainnet) | `optimism` | All endpoints | | Base Sepolia (Testnet) | `base-sepolia` | All endpoints | **Stellar** uses SBTs via Soroban smart contracts instead of the REST API. See the [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) page for Stellar-specific querying methods. --- For more details on integration patterns, see the [Introduction](/building-with-passport/individual-verifications/introduction). --- ## Building with Passport > Individual Verifications > Supported Chains ### Supported Chains URL: https://docs.passport.xyz/building-with-passport/individual-verifications/supported-chains # Supported Chains Individual Verifications issue attestations on multiple blockchain networks, allowing users to verify once and prove their identity across different ecosystems. ## Overview Each chain has one of two roles. A payment chain is where the user pays the verification fee. A delivery chain is where the user receives the proof: a Sign Protocol attestation on Optimism, or a soulbound token (SBT) on Stellar and Sui. The two can differ. A user can pay on Base and receive the proof on Optimism, Stellar or Sui. | Chain | Payment | Delivery | Gov ID | Phone | Biometrics | Clean Hands | |-------|---------|----------|--------|-------|------------|-------------| | **Optimism** | ✅ | Sign Protocol attestation | ✅ | ✅ | ✅ | ✅ | | **Ethereum** | ✅ | - | - | - | - | - | | **Base** | ✅ | - | - | - | - | - | | **Avalanche** | ✅ | - | - | - | - | - | | **Stellar** | - | SBT | ✅ | ✅ | - | - | | **Sui** | - | SBT | - | - | - | ✅ | Payment is in the native coin of the payment chain: ETH on Ethereum, Optimism and Base, and AVAX on Avalanche. Stellar and Sui take no payment. ## How Multi-Chain Verification Works 1. **Single Verification**: User completes identity verification once (KYC, phone, biometrics, etc.) 2. **Chain Selection**: User chooses which blockchain to receive their proof 3. **Proof Issuance**: A Sign Protocol attestation is issued on Optimism, or an SBT is minted on Stellar or Sui 4. **Cross-dApp Usage**: The proof can be verified by any application on that chain For enhanced privacy, users can pay verification fees from a different wallet than the one receiving the attestation. This prevents timing correlation attacks. --- ## Optimism Optimism is the primary chain for Individual Verifications, with full support for all verification types. Optimism is also a payment chain. **Supported Verifications:** - Government ID (KYC) - Phone - Biometrics - Proof of Clean Hands ### Sign Protocol Configuration (Optimism) | Component | Value | |-----------|-------| | Schema ID (Gov ID, Phone) | `onchain_evm_10_0x1` | | Schema ID (Biometrics, Clean Hands) | `onchain_evm_10_0x8` | | Attester | `0xB1f50c6C34C72346b1229e5C80587D0D659556Fd` | | Chain ID | 10 | ### Querying Attestations on Optimism ```bash curl 'https://mainnet-rpc.sign.global/api/index/attestations?schemaId=onchain_evm_10_0x1&attester=0xB1f50c6C34C72346b1229e5C80587D0D659556Fd' ``` Use `schemaId=onchain_evm_10_0x8` for Biometrics and Proof of Clean Hands. For complete query examples and validation code, see [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols). --- ## Base Base is a payment chain only. Users pay the verification fee on Base and receive the proof on Optimism, Stellar or Sui. --- ## Stellar Individual Verifications support Stellar via Soroban smart contracts for Government ID and Phone verifications. Stellar takes no payment. The user pays on an EVM chain and enters a Stellar address to receive the SBT. **Supported Verifications:** - Government ID (KYC) - Phone ### SBT Contract | Component | Value | |-----------|-------| | SBT Contract | `CCNTHEVSWNDOQAMXXHFOLQIXWUINUPTJIM6AXFSKODNVXWA4N7XV3AI5` | On Optimism, attestations via Sign Protocol are the recommended integration. On Stellar and Sui, SBTs are the current method. See the [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) page for complete code examples and integration details. ### User Flow 1. Visit the verification page for the desired verification type 2. Complete the verification process 3. Enter a Stellar address to receive the verification 4. The verification is recorded on Stellar as an SBT --- ## Sui Sui supports Proof of Clean Hands. The proof is delivered as an SBT. Sui takes no payment. The user pays on an EVM chain and enters a Sui address to receive the SBT. **Supported Verifications:** - Proof of Clean Hands ### SBT Package | Component | Value | |-----------|-------| | Package ID | `0x53ddebd997f0e57dc899d598f12001930e228dddadf268a41d4c9a7c1df47a97` | | SBT type | `0x53ddebd997f0e57dc899d598f12001930e228dddadf268a41d4c9a7c1df47a97::sbt::SoulBoundToken` | | Network | Sui Mainnet | Source code: [GitHub](https://github.com/holonym-foundation/id-hub-contracts/blob/main/contracts/sui/human-id/sources/sbt.move) To check whether an address holds an SBT, list the objects the address owns and filter by the SBT type. ### User Flow 1. Complete Proof of Clean Hands verification 2. Select Sui as the chain and enter a Sui address 3. The SBT is minted to that address on Sui --- ## Sandbox / Testnet For testing and development, use Optimism Sepolia testnet. ### Sign Protocol Configuration (Sandbox) | Component | Value | |-----------|-------| | Schema ID | `onchain_evm_11155420_0xc41` | | API Endpoint | `https://testnet-rpc.sign.global/api/index/attestations` | | Chain ID | 11155420 (Optimism Sepolia) | ### Sandbox Verification URLs | Verification | Sandbox URL | |--------------|-------------| | Government ID | `https://id.human.tech/gov-id?sandbox=true` | | Phone | `https://id.human.tech/phone?sandbox=true` | | Biometrics | `https://id.human.tech/biometrics?sandbox=true` | For complete testing instructions, see [Testing](/building-with-passport/individual-verifications/major-concepts/testing). --- ## Integration Options Choose the integration method that best fits your use case: | Use Case | Method | |----------|--------| | Simple verification checks | [API Reference](/building-with-passport/individual-verifications/api-reference) | | On-chain contracts / Custom integrations | [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) | | Client-side dApps | [SDK Integration](/building-with-passport/individual-verifications/major-concepts/sdk) | | Stellar integration | [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) | --- ## Additional Resources - [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) - [API Reference](/building-with-passport/individual-verifications/api-reference) - [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) - [Testing](/building-with-passport/individual-verifications/major-concepts/testing) --- ### Stellar Integration URL: https://docs.passport.xyz/building-with-passport/individual-verifications/supported-chains/stellar # Stellar Integration Individual Verifications on Stellar are recorded as SoulBound Tokens (SBTs) via Soroban smart contracts. This page covers everything you need to integrate Stellar-based verifications into your application. ## Supported Verification Types | Verification | Circuit ID | Verification URL | |--------------|-----------|------------------| | **Government ID (KYC)** | `0x729d660e1c02e4e419745e617d643f897a538673ccf1051e093bbfa58b0a120b` | [id.human.tech/gov-id](https://id.human.tech/gov-id) | | **Phone** | `0xbce052cf723dca06a21bd3cf838bc518931730fb3db7859fc9cc86f0d5483495` | [id.human.tech/phone](https://id.human.tech/phone) | On Optimism, attestations via Sign Protocol are the recommended integration. On Stellar, SBTs via Soroban are the current method. ## SBT Contract | Component | Value | |-----------|-------| | Contract Address | `CCNTHEVSWNDOQAMXXHFOLQIXWUINUPTJIM6AXFSKODNVXWA4N7XV3AI5` | | Network | Stellar Mainnet (Public) | | RPC URL | `https://mainnet.sorobanrpc.com` | Source code: [GitHub](https://github.com/holonym-foundation/id-hub-contracts/blob/main/contracts/stellar/human-id/contracts/sbt/src/lib.rs) ## Querying SBTs Use the Stellar SDK to query a user's SBT status off-chain: ```typescript import { rpc, TransactionBuilder, Networks, Contract, scValToNative, nativeToScVal, } from '@stellar/stellar-sdk' type StellarSbt = { action_nullifier: bigint circuit_id: bigint expiry: bigint id: bigint minter: string public_values: Array recipient: string revoked: boolean } type StellarSbtStatus = 'valid' | 'expired' | 'revoked' | 'none' const sorobanRpcUrl = 'https://mainnet.sorobanrpc.com' const sbtContractAddress = 'CCNTHEVSWNDOQAMXXHFOLQIXWUINUPTJIM6AXFSKODNVXWA4N7XV3AI5' async function getStellarSBT( address: string, circuitId: string ): Promise<{ sbt?: StellarSbt; status: StellarSbtStatus }> { const sorobanServer = new rpc.Server(sorobanRpcUrl) const userAccount = await sorobanServer.getAccount(address) const contract = new Contract(sbtContractAddress) const operation = contract.call( 'get_sbt', nativeToScVal(address, { type: 'address' }), nativeToScVal(circuitId, { type: 'u256' }) ) const transaction = new TransactionBuilder(userAccount, { networkPassphrase: Networks.PUBLIC, fee: '100', }) .addOperation(operation) .setTimeout(60) .build() const response = await sorobanServer.simulateTransaction(transaction) if (rpc.Api.isSimulationSuccess(response)) { const parsed = rpc.parseRawSimulation(response) const sbt = scValToNative(parsed.result?.retval) return { sbt, status: 'valid' } } const error = response.error if (error?.includes('Error(Contract, #1)')) return { status: 'none' } if (error?.includes('Error(Contract, #5)')) return { status: 'revoked' } if (error?.includes('Error(Contract, #6)')) return { status: 'expired' } throw new Error(`SBT query failed: ${error}`) } ``` For on-chain verification from another Soroban contract: **1. Fetch the SBT contract WASM:** ```bash soroban contract fetch \ --id CCNTHEVSWNDOQAMXXHFOLQIXWUINUPTJIM6AXFSKODNVXWA4N7XV3AI5 \ -o ./passport_sbt_contract.wasm \ --network mainnet \ --network-passphrase "Public Global Stellar Network ; September 2015" \ --rpc-url https://mainnet.sorobanrpc.com ``` **2. Import and use in your contract:** ```rust #![no_std] use soroban_sdk::{contract, contractimpl, Env, Address, U256}; mod passport_sbt_contract { soroban_sdk::contractimport!( file = "../../passport_sbt_contract.wasm" ); } #[contract] pub struct MyContract; #[contractimpl] impl MyContract { pub fn get_sbt( env: Env, recipient: Address, circuit_id: U256 ) -> passport_sbt_contract::SBT { let contract_addr = Address::from_str( &env, "CCNTHEVSWNDOQAMXXHFOLQIXWUINUPTJIM6AXFSKODNVXWA4N7XV3AI5" ); let client = passport_sbt_contract::Client::new(&env, &contract_addr); client.get_sbt(&recipient, &circuit_id) } } ``` ## SBT Status Codes | Status | Description | |--------|-------------| | `valid` | SBT exists and is active | | `expired` | SBT has passed its expiration date (1 year from issuance) | | `revoked` | SBT has been revoked | | `none` | No SBT found for this address | ## Circuit IDs Use the appropriate circuit ID when querying SBTs for a specific verification type: | Verification Type | Circuit ID | |-------------------|-----------| | **Government ID (KYC)** | `0x729d660e1c02e4e419745e617d643f897a538673ccf1051e093bbfa58b0a120b` | | **Phone** | `0xbce052cf723dca06a21bd3cf838bc518931730fb3db7859fc9cc86f0d5483495` | ## Additional Resources - [API Reference](/building-with-passport/individual-verifications/api-reference) - [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) - [SBTs (Legacy)](/building-with-passport/individual-verifications/major-concepts/sbts) --- ## Building with Passport > Individual Verifications > Major Concepts ### Attestation Protocols URL: https://docs.passport.xyz/building-with-passport/individual-verifications/major-concepts/attestation-protocols # Attestation Protocols For a simpler integration, use the [Individual Verifications API](/building-with-passport/individual-verifications/api-reference) which provides convenient endpoints that handle attestation queries for you. Individual Verifications issue attestations through [Sign Protocol](https://sign.global/), allowing you to query and validate verification status directly on-chain. This page covers the attestation schemas, how to query them, and how to validate the data. ## Sign Protocol Overview Every Individual Verification (Government ID, Phone, Biometrics, Clean Hands) issues a Sign Protocol attestation when a user completes verification. These attestations are stored on-chain and can be queried by any application. ### Key Addresses | Component | Address | |-----------|---------| | **Attester (Relayer)** | `0xB1f50c6C34C72346b1229e5C80587D0D659556Fd` | ### Schema IDs by Network | Environment | Schema ID | Network | Chain ID | |-------------|-----------|---------|----------| | Production | `onchain_evm_10_0x1` | Optimism | 10 | | Production | `onchain_evm_10_0x8` | Base | 8453 | | Sandbox | `onchain_evm_11155420_0xc41` | Optimism Sepolia | 11155420 | ### API Endpoints | Environment | Endpoint | |-------------|----------| | Production | `https://mainnet-rpc.sign.global/api/index/attestations` | | Sandbox | `https://testnet-rpc.sign.global/api/index/attestations` | --- ## Attestation Schema Individual Verification attestations contain a ZK proof that encodes the verification type, action ID, and issuer information. ### Raw Schema ``` string circuitId, uint256[] publicValues ``` ### Fields | Field | Type | Description | |-------|------|-------------| | `circuitId` | string | Identifies the verification type (see Circuit IDs below) | | `publicValues` | uint256[] | Array of public values from the ZK proof | ### Public Values Array The `publicValues` array contains the following elements: | Index | Field | Description | |-------|-------|-------------| | 0 | `nullifierHash` | Unique identifier preventing duplicate verifications | | 1 | `signedCredentialHash` | Hash of the signed credential | | 2 | `actionId` | The action ID used for sybil resistance | | 3 | `expiresAt` | Unix timestamp when the verification expires | | 4 | `issuer` | Address of the credential issuer | | 5 | `recipient` | Address that received the attestation | --- ## Circuit IDs Each verification type has a unique circuit ID that identifies what kind of verification the attestation represents. | Verification Type | Circuit ID | |-------------------|-----------| | **Government ID (KYC)** | `0x729d660e1c02e4e419745e617d643f897a538673ccf1051e093bbfa58b0a120b` | | **Phone** | `0xbce052cf723dca06a21bd3cf838bc518931730fb3db7859fc9cc86f0d5483495` | | **Biometrics** | `0x0b5121226395e3b6c76eb8ddfb0bf2f2075e7f2c6956567e84b38a223c3a3d15` | --- ## Issuer Addresses Each verification type has an associated issuer address that must be validated. ### Production Issuers | Verification Type | Issuer Address | |-------------------|----------------| | **Government ID (KYC)** | `0x03fae82f38bf01d9799d57fdda64fad4ac44e4c2c2f16c5bf8e1873d0a3e1993` | | **Phone** | `0x40b8810cbaed9647b54d18cc98b720e1e8876be5d8e7089d3c079fc61c30a4` | | **Biometrics** | `0x0d4f849df782fb9e68d525fbda10b73e59180e59cb2a21ce5d70ccc45dbfd922` | ### Sandbox Issuers | Verification Type | Issuer Address | |-------------------|----------------| | **Government ID (KYC)** | `0x2332221496ffef62c0075ce833b54c5c0b78419be2571e8d1715f7990fc5279a` | | **Phone** | `0x1c0288e0fbbab4e1dda4732a72b391e9616d88c5d1fcfb97124584f2506645c3` | --- ## Querying Attestations ### Query by Schema and Attester Use the Sign Protocol API to query all attestations for a specific schema. ```bash curl 'https://mainnet-rpc.sign.global/api/index/attestations?schemaId=onchain_evm_10_0x1&attester=0xB1f50c6C34C72346b1229e5C80587D0D659556Fd' ``` ### Query by Recipient Address To find attestations for a specific user: ```bash curl 'https://mainnet-rpc.sign.global/api/scan/addresses/{address}/attestations' ``` ### Response Format ```json { "data": { "page": 1, "rows": [ { "attestTimestamp": "1714819085000", "attestationId": "0x65", "attester": "0xB1f50c6C34C72346b1229e5C80587D0D659556Fd", "chainId": "10", "data": "0x000000...", "recipients": ["0xEdedf460A77928f59c27f37F73D4853FD8a07984"], "revoked": false, "schema": { "name": "HolonymV3", "description": "Holonym V3" }, "validUntil": 1770922106 } ], "size": 100, "total": 195 } } ``` --- ## Validating Attestations When validating an attestation, verify the circuit ID, action ID, issuer, and expiration. ### TypeScript Example ```typescript import { ethers } from "ethers"; // Expected values for Government ID verification const EXPECTED_CIRCUIT_ID = "0x729d660e1c02e4e419745e617d643f897a538673ccf1051e093bbfa58b0a120b"; const EXPECTED_ISSUER = "0x03fae82f38bf01d9799d57fdda64fad4ac44e4c2c2f16c5bf8e1873d0a3e1993"; const EXPECTED_ACTION_ID = "123456789"; const ATTESTER = "0xB1f50c6C34C72346b1229e5C80587D0D659556Fd"; interface AttestationValidation { isValid: boolean; error?: string; } function validateGovIdAttestation(attestation: any): AttestationValidation { // Check attester if (attestation.attester.toLowerCase() !== ATTESTER.toLowerCase()) { return { isValid: false, error: "Invalid attester" }; } // Check not revoked if (attestation.revoked) { return { isValid: false, error: "Attestation revoked" }; } // Check expiration const now = Math.floor(Date.now() / 1000); if (attestation.validUntil && attestation.validUntil < now) { return { isValid: false, error: "Attestation expired" }; } // Decode and validate attestation data const decoded = ethers.utils.defaultAbiCoder.decode( ["string", "uint256[]"], attestation.data ); const circuitId = decoded[0]; const publicValues = decoded[1]; const actionId = publicValues[2]; const issuer = publicValues[4]; // Validate circuit ID if (circuitId !== EXPECTED_CIRCUIT_ID) { return { isValid: false, error: "Invalid circuit ID" }; } // Validate action ID if (actionId.toString() !== EXPECTED_ACTION_ID) { return { isValid: false, error: "Invalid action ID" }; } // Validate issuer if (issuer.toHexString() !== EXPECTED_ISSUER) { return { isValid: false, error: "Invalid issuer" }; } return { isValid: true }; } ``` --- ## Proof of Clean Hands Attestations Proof of Clean Hands uses a different schema on Base (chain ID 8453). ### Query Clean Hands Attestations ```bash curl 'https://mainnet-rpc.sign.global/api/scan/addresses/{address}/attestations' ``` ### Validation ```typescript function hasValidCleanHandsAttestation(attestations: any[]): boolean { const now = Math.floor(Date.now() / 1000); const CLEAN_HANDS_SCHEMA = 'onchain_evm_10_0x8'; const ATTESTER = '0xB1f50c6C34C72346b1229e5C80587D0D659556Fd'; return attestations.some(att => att.fullSchemaId === CLEAN_HANDS_SCHEMA && att.attester.toLowerCase() === ATTESTER.toLowerCase() && att.isReceiver === true && att.revoked === false && att.validUntil > now ); } ``` --- ## Sign Protocol Explorer You can view attestations on the Sign Protocol explorer: - **Production**: [https://scan.sign.global](https://scan.sign.global) - **View specific attestation**: `https://scan.sign.global/attestation/{attestationId}` --- ## Action IDs Action IDs enable sybil resistance by enforcing "1 person = 1 action". The default action ID is `123456789`. For more information on action IDs and custom action IDs, see [Action IDs](/building-with-passport/individual-verifications/major-concepts/action-ids). --- ## Additional Resources - [Sign Protocol Documentation](https://docs.sign.global/) - [Individual Verifications API](/building-with-passport/individual-verifications/api-reference) - Simpler API for verification checks - [Testing](/building-with-passport/individual-verifications/major-concepts/testing) - Test your integration on Base Sepolia --- ### Action IDs URL: https://docs.passport.xyz/building-with-passport/individual-verifications/major-concepts/action-ids # Action IDs Action IDs enable sybil resistance by enforcing the principle of "1 person = 1 action" - whether that's one vote, one airdrop claim, or one account per verified individual. ## Default Action ID By default, Individual Verifications use a global action ID (`123456789`) that provides universal uniqueness across all applications. This means: - A user can only verify one address as unique across **all** applications using the default ID - This provides the strongest sybil resistance - **Recommended for most use cases** When querying the API, use the default action ID: ```bash curl 'https://api.holonym.io/sybil-resistance/gov-id/optimism?user={address}&action-id=123456789' ``` ## Custom Action IDs For specific use cases requiring app-specific uniqueness (e.g., multiple elections where users need different addresses for privacy), custom action IDs are available. Custom action IDs are available on request. [Contact us](https://tally.so/r/3X81KL) to discuss your use case and we'll help you set up a custom action ID for your application. --- ## Next Steps Now that you understand action IDs, choose your integration method: | Use Case | Method | |----------|--------| | Simple verification checks | [API Reference](/building-with-passport/individual-verifications/api-reference) | | On-chain contracts | [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) | | Client-side dApps | [SDK Integration](/building-with-passport/individual-verifications/major-concepts/sdk) | --- ### SDK Integration URL: https://docs.passport.xyz/building-with-passport/individual-verifications/major-concepts/sdk # SDK Integration The Human ID SDK allows you to embed Individual Verifications directly into your website or dApp, providing a seamless verification experience without redirecting users. ## Installation ```bash npm install @holonym-foundation/human-id-sdk ``` ## Quick Start ```typescript import { initHumanID } from '@holonym-foundation/human-id-sdk' // Initialize the SDK (client-side only, requires window) const humanID = initHumanID() // Request verification const result = await humanID.requestSBT('kyc') // Government ID // or: humanID.requestSBT('phone') // Phone // or: humanID.requestSBT('biometrics') // Biometrics // or: humanID.requestSBT('clean-hands') // Proof of Clean Hands if (result?.recipient) { console.log('Verified! Attestation issued to:', result.recipient) } ``` ## Integration Options | Use Case | Recommendation | |----------|----------------| | Client-side dApps | SDK - embeds verification flow directly | | Server-side checks | [API](/building-with-passport/individual-verifications/api-reference) - simple true/false queries | | On-chain contracts | [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) - query Sign Protocol directly | ## Documentation For complete documentation including querying verification status, prepaid verification credits, and React examples, see the SDK repository: **[View full SDK documentation on npm](https://www.npmjs.com/package/@holonym-foundation/human-id-sdk)** The README is actively maintained with the latest API reference and examples. --- ### Testing URL: https://docs.passport.xyz/building-with-passport/individual-verifications/major-concepts/testing # Testing Individual Verifications provides testnet support for developers to test their integration before going to production. Use the Base Sepolia testnet to complete verification flows and receive test attestations. ## Testnet Environment | Environment | Network | Use Case | |-------------|---------|----------| | Production | Optimism | Live user verifications | | Testnet | Base Sepolia | Development and testing | ## Testing Workflow ### Step 1: Get a Test Verification Direct users to the sandbox verification flow to receive a test attestation on Base Sepolia: **Government ID (KYC):** ``` https://id.human.tech/gov-id?sandbox=true ``` **Phone:** ``` https://id.human.tech/phone?sandbox=true ``` **Biometrics:** ``` https://id.human.tech/biometrics?sandbox=true ``` Sandbox verifications issue test attestations on Base Sepolia testnet. These are for testing purposes only and do not represent real identity verification. ### Step 2: Query the Testnet API Use the same API endpoints, but specify `base-sepolia` as the network: ```bash curl --request GET \ 'https://api.holonym.io/sybil-resistance/gov-id/base-sepolia?user={address}&action-id=123456789' ``` ```json { "result": true, "expirationDate": 1770922106 } ``` ### Step 3: Verify Integration Test your integration logic with the test attestation before deploying to production. ## API Endpoints for Testing All standard API endpoints support the `base-sepolia` network parameter: | Endpoint | Testnet URL | |----------|-------------| | Government ID | `https://api.holonym.io/sybil-resistance/gov-id/base-sepolia?user={address}&action-id={action-id}` | | Phone | `https://api.holonym.io/sybil-resistance/phone/base-sepolia?user={address}&action-id={action-id}` | | Biometrics | `https://api.holonym.io/sybil-resistance/biometrics/base-sepolia?user={address}&action-id={action-id}` | ## Best Practices 1. **Always test on Base Sepolia first** - Verify your integration works correctly before handling real user verifications 2. **Test error handling** - Ensure your application gracefully handles cases where users haven't verified 3. **Test with multiple addresses** - Verify your uniqueness logic works correctly across different addresses 4. **Validate response handling** - Make sure your application correctly interprets `result: true` vs `result: false` responses ## Moving to Production When you're ready to go live: 1. Update your API calls to use `optimism` instead of `base-sepolia` 2. Update verification links to remove the `?sandbox=true` parameter 3. Ensure your production environment is configured correctly ```javascript // Development const network = 'base-sepolia'; const verifyUrl = 'https://id.human.tech/gov-id?sandbox=true'; // Production const network = 'optimism'; const verifyUrl = 'https://id.human.tech/gov-id'; ``` --- ## Production Integration Once you've tested your integration, choose your production integration method: | Use Case | Method | |----------|--------| | Simple verification checks | [API Reference](/building-with-passport/individual-verifications/api-reference) | | On-chain contracts | [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) | | Client-side dApps | [SDK Integration](/building-with-passport/individual-verifications/major-concepts/sdk) | --- ### SoulBound Tokens (Legacy) URL: https://docs.passport.xyz/building-with-passport/individual-verifications/major-concepts/sbts # SoulBound Tokens (Legacy) **EVM SBTs are legacy.** On EVM chains, SBTs have been replaced by attestations via Sign Protocol. For new EVM integrations, use the [API Reference](/building-with-passport/individual-verifications/api-reference) or [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols). **Stellar SBTs are current.** On Stellar, SBTs via Soroban are the active integration method. See the [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) page for complete details. SoulBound Tokens (SBTs) are non-transferable tokens that were the original method for recording Individual Verifications on-chain. While SBTs are still issued for backward compatibility, attestations are now the primary verification record. ## Overview SBTs are: - **Non-transferable**: Cannot be sent to another address - **Tied to identity**: Represent a verified individual - **Time-limited**: Expire after 1 year and must be renewed ## When to Use SBTs Consider querying SBTs only if: - You have an existing integration that depends on SBT contracts - You need to verify historical verifications issued before the attestation migration For all new integrations, use [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) instead. --- ## Contract Addresses ### Optimism (EVM) | Contract | Address | |----------|---------| | Hub V3 | `0x2AA822e264F8cc31A2b9C22f39e5551241e94DfB` | ### Optimism Sepolia (Testnet) | Contract | Address | |----------|---------| | Hub V3 | `0x71712Ac158C5b25519Aad43eB9f496ae16892211` | ### Stellar (Soroban) | Contract | Address | |----------|---------| | SBT Contract | `CCNTHEVSWNDOQAMXXHFOLQIXWUINUPTJIM6AXFSKODNVXWA4N7XV3AI5` | --- ## SBT Status Codes All chains use consistent status codes when querying SBTs: | Status | Description | |--------|-------------| | `valid` | SBT exists and is active | | `expired` | SBT has passed its expiration date (1 year from issuance) | | `revoked` | SBT has been revoked | | `none` | No SBT found for this address | --- ## Querying SBTs on Stellar For complete Stellar SBT querying examples (TypeScript and Soroban/Rust), see the [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar#querying-sbts) page. --- ## Circuit IDs Different verification types use different circuit IDs when querying SBTs: | Verification Type | Circuit ID | |-------------------|-----------| | **Government ID (KYC)** | `0x729d660e1c02e4e419745e617d643f897a538673ccf1051e093bbfa58b0a120b` | | **Phone** | `0xbce052cf723dca06a21bd3cf838bc518931730fb3db7859fc9cc86f0d5483495` | | **Biometrics** | `0x0b5121226395e3b6c76eb8ddfb0bf2f2075e7f2c6956567e84b38a223c3a3d15` | --- ## Migration to Attestations If you have an existing SBT integration, we recommend migrating to attestations: 1. **API users**: No changes needed - the API will automatically use attestations 2. **Direct contract queries**: Switch to [Sign Protocol queries](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) For migration assistance, [contact us](https://tally.so/r/3X81KL). --- ## Additional Resources - [Attestation Protocols](/building-with-passport/individual-verifications/major-concepts/attestation-protocols) - Recommended integration method - [API Reference](/building-with-passport/individual-verifications/api-reference) - Simple verification status checks - [Stellar Integration](/building-with-passport/individual-verifications/supported-chains/stellar) - Stellar-specific integration guide --- ## Building with Passport > Models ### Models API -- Introduction URL: https://docs.passport.xyz/building-with-passport/models/introduction # Models API The Models API enables partners to protect programs against Sybils in real-time, regardless of whether they have a Passport account or not. This API is designed to return the results of model-based detection methods. It can score any EVM addresses against several different models that analyze transaction history against dozens of different data features to identify if that address is likely Human or Sybil. Ready to get started? - [Generate API Key and Scorer ID](/building-with-passport/models/getting-access) Need more in-depth analysis? We also offer batch Sybil classification and clustering analyses via our [data services](/building-with-passport/data-services). To learn more, please fill out our [contact form](https://tally.so/r/3X81KL). The current [available models](/building-with-passport/models/available-models) include the following: * Aggregate unique humanity model * Ethereum (L1) unique humanity model * NFT (L1) unique humanity model * Arbitrum unique humanity model * Base unique humanity model * Optimism unique humanity model * Polygon unique humanity model * zkSync unique humanity model This essentially opens up Sybil detection and defense to all EVM wallet addresses, regardless of whether the user has a Passport with verified Stamps or not. This new API is the perfect compliment to the existing [Stamps API](/building-with-passport/stamps/passport-api) as it offers the following benefits: * **Score any address:** Any EVM wallet address can be scored, regardless of whether they have a Passport or not. * **Reduced user friction:** Users don't need to do anything to be scored by this endpoint. * **More difficult for Sybils:** When we make adjustments to our Stamp offering and weights, we are essentially providing a roadmap for Sybils, requiring us to make changes periodically which can add friction for users. The model features are hidden from the public, making it more difficult for Sybils to cheat. * **Modular verification:** Using the Models API along with the [Stamp-based verification](/building-with-passport/stamps/passport-api) approach made available via the Stamps API can enable you to provide multiple verification options that reduce user friction for the majority of users while offering an additional verification tool for users who don't pass the initial check. * **Faster and less impactful iteration cycles:** Sybil behavior changes, and so should Passport. While we know updates to our [Stamp-based verification](/building-with-passport/stamps/passport-api) are both required and help improve ease and effectiveness, those changes can cause user friction. The model-based verification enables us to tune our the models more frequently without this friction, allowing us to respond to changes in Sybil behavior more quickly. ## Getting Access This API is generally available to all developers today, but you will need to utilize an API key that is required to access the Stamp-based Stamps API. Please visit our [getting access page](/building-with-passport/models/getting-access) to learn how to generate an API key. During the initial beta phase, rate limits will be limited. You can read more in our [API Reference](/building-with-passport/models/api-reference). ## Use cases This new API is designed to complement the existing suite of endpoints to offer a comprehensive approach to protecting and understanding your community's constituents. Starting with the Models API, you can quickly determine if a wallet is a suspected human or Sybil actor. If they are a suspected Sybil (or if we don't have enough data to score them), you can have them utilize our [Stamp-based verification](/building-with-passport/stamps/passport-api) to prove their humanness. When thinking about applying this new API, there are two primary use cases that it enables: 1. **[Protecting access](/overview/use-cases#protect-access-rewards):** Preventing Sybils and other malicious bots from being able to participate in a variety of different web3 programs. 2. **Data analysis:** Analyzing a set of wallet addresses against the Passport Model Based Detection score to identify which wallets are likely Humans or Sybils. You can also get in contact with us to have our team perform more in-depth data analysis around a list of wallet addresses by filling out [this form](https://tally.so/r/3X81KL). ## Recommended developer flow: Protect access Protecting access is Passport's primary [use case](/overview/use-cases). There are many different types of programs that can be protected with Passport, including rewards, governance, community access, marketplace, and communication programs. In this section, we will describe a few different developer flows that can be used to protect access to programs: * Single verification using a Model Based Detection score * Double verification using a Model Based Detection score and the Unique Humanity Score * Double verification using a Model Based Detection score and other verification methods ### Single verification using Models API This is the lightest-weight verification tool available with the current Passport developer tooling. If you'd like to quickly verify if potential participants are likely human or sybil based on the model-based evaluation, this is for you. However, this verification method does not provide a secondary verification option for users, such as crypto beginners. If this is a concern, we recommend that you explore using one of the double verification methods. **Technical integration details:** * Collect the wallet address from the user * Pass the wallet address to the [`GET /v2/models/score/{address}`](/building-with-passport/models/api-reference) endpoint, which will deliver the specified model score (0-100). * Compare this score against a predetermined [score threshold](/building-with-passport/models/available-models), and either grant or deny access depending on that evaluation. ### Double verification using Models API and Unique Humanity score We've developed a tutorial around this offering: [Double Verification with the Model Based Detection and Stamp-based APIs](/building-with-passport/models/tutorials/double-verification) This verification method will cause the least amount of user friction for the majority of users, while also providing a secondary verification check to users (especially crypto beginners) in case they want to contest an initial check's rejection. Many users will be able pass the initial Models API check with no user friction, while a portion of them will need to go through the Stamp-based process (in other words, creating a Passport, verifying Stamps, and building up a unique humanity score). **Technical integration details:** * Collect the wallet address from the user * Pass the wallet address to the [`GET /v2/models/score/{address}`](/building-with-passport/models/api-reference) endpoint, which will deliver the specified model score (-1 for addresses without enough transaction data, 0-100 for those that do). * Compare this model score against a predetermined [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds), and will either grant or deny access based on that evaluation. * Assuming the user didn't pass primary verification, retrieve the user's Stamp-based Unique Humanity Score from the Stamps API v2 using the [`GET /v2/stamps/{scorer_id}/score/{address}`](/building-with-passport/stamps/passport-api/api-reference#retrieve-latest-score-for-a-single-address) endpoint. * Evaluate the Unique Humanity Score against a predetermined [score threshold](/building-with-passport/stamps/major-concepts/scoring-thresholds), and will either grant or deny access based on that evaluation. ### Double verification using Models API and other verification methods This option will look very similar to the previous double verification method, but can utilize a custom Passport scorer and set of Stamps, or a separate 1st or 3rd-party verification system to verify users who weren't able to pass the initial Models API verification flow. ## Next steps You can retrieve a model-based score with a simple API request. Try it out using our [API playground](https://passport-api-playground.vercel.app). * [Try the API playground](https://passport-api-playground.vercel.app) * [Review the API Reference](/building-with-passport/models/api-reference) * [View available models and recommended score thresholds](/building-with-passport/models/available-models) * [Learn about double verification with Models API and Stamps API](/building-with-passport/models/tutorials/double-verification) --- ### Getting access to the Models API URL: https://docs.passport.xyz/building-with-passport/models/getting-access # Getting Access: API Key The Models API provides programmatic access to variety of different model-based Sybil detection scores. Once you have your API key, you need to include it with each request you make to the API. This allows Human Passport to identify your app and verify that you are authorized to access the API. Please note:

You do not need a Scorer or Scorer ID to use the Models API. ### Getting Your API Key 1. **Log in to the developer portal:** Go to [developer.passport.xyz](https://developer.passport.xyz) and log in to your account by connecting your wallet. 2. **Navigate to the API Keys section:** After logging in, go to the "API Keys" section. 3. **Generate an API key:** Click on the "+ Create a Key" button to generate a unique API key for your account. 4. **Store your API key securely:** Store your API key in a secure place, as it will be used to access the Models API as well as the Stamps API. ### Next step Review one of the following pages to learn how you can use your API key with the Models API. - [Try the API playground](https://passport-api-playground.vercel.app) - [Review the API Reference](api-reference) - [Review the tutorial explaining how to use this score](tutorials/double-verification) --- ### Available models and recommended scores URL: https://docs.passport.xyz/building-with-passport/models/available-models # Available models and recommended scores At this time, we have deployed a few different models to help verify unique humans. We plan to expand this list of models greatly, first by exploring additional Sybil detection models for several L2 partners, and then looking into other web3 verticals and reputation signals. We currently offer the following models via the Models API: * Aggregate unique humanity score - `aggregate` * Ethereum (L1) unique humanity model - `ethereum_activity` * NFT (L1) unique humanity model - `nft` * Arbitrum unique humanity model - `arbitrum` * Base unique humanity model - `base` * Optimism unique humanity model - `optimism` * Polygon unique humanity model - `polygon` * zkSync unique humanity model - `zksync` Each model will assign a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. A score of 0 represents likely Sybil, while a score of 100 represents likely human. For each model, we will provide a table that describes the different score thresholds you can use to gate access or classify addresses. We define the columns of those tables here: * **% of qualifying verified humans** - This metric represents the number of Passport users who qualified for the score threshold and scored a 20 or higher with the Stamp-based verification system. * **% of verified Sybil penetration** - This metric represents the number of verified Sybils from our list that were able to qualify for the score threshold. Please note that the percentages included in these tables do not necessarily translate to the percentage of participation for each individual partner. We calculate the percentage of qualifying humans and Sybils at various thresholds, derived from a curated list of collected addresses labeled as either Sybils or humans. ## Aggregate unique humanity model The aggregate unique humanity model score is the current default for the Models API, as it is broadly relevant to a variety of different ecosystems operating within the EVM ecosystem. This model integrates individual chain model scores (Ethereum, Arbitrum, Optimism, Polygon, and zkSync) to generate the final aggregate score. Model version: 2.0 Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 98% | 6% | | 25+ | 98% | 4% | | 50+ | 96% | 3% | | 75+ | 94% | 2% | ## ETH (L1) unique humanity model This model looks at the specified wallet addresses' ETH mainnet transaction history, compares it against 50+ different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 97% | 14% | | 25+ | 96% | 12% | | 50+ | 94% | 9% | | 75+ | 89% | 5% | ## NFT (Ethereum L1) unique humanity model Similarly to the ETH (L1) unique humanity model, this model looks at the specified wallet addresses' NFT transaction history on Ethereum mainnet, compares it against different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 98% | 11% | | 25+ | 97% | 9% | | 50+ | 95% | 6% | | 75+ | 92% | 4% | ## Arbitrum unique humanity model This model looks at the specified wallet addresses' Arbitrum transaction history, compares it against different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 99% | 21% | | 25+ | 98% | 14% | | 50+ | 94% | 7% | | 75+ | 92% | 6% | ## Base unique humanity model This model looks at the specified wallet addresses' Base transaction history, compares it against different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 99% | 21% | | 25+ | 98% | 14% | | 50+ | 94% | 7% | | 75+ | 92% | 6% | ## Optimism unique humanity model This model looks at the specified wallet addresses' Optimism transaction history, compares it against different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 98% | 14% | | 25+ | 97% | 10% | | 50+ | 96% | 5% | | 75+ | 94% | 4% | ## Polygon unique humanity model This model looks at the specified wallet addresses' Polygon transaction history, compares it against different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 98% | 15% | | 25+ | 97% | 11% | | 50+ | 94% | 7% | | 75+ | 92% | 6% | ## zkSync unique humanity model This model looks at the specified wallet addresses' zkSync Era transaction history, compares it against different features, and assigns it a score of -1 for addresses without enough transaction data, and 0 - 100 for those that do. Recommended score threshold: 50+ | Score threshold | % of qualifying verified humans | % of verified Sybil penetration | | --------------- | ------------------------------- | ------------------------------- | | 15+ | 95% | 22% | | 25+ | 94% | 16% | | 50+ | 92% | 8% | | 75+ | 88% | 7% | ## Models coming soon The Passport team currently doesn't have any new models in development. If you would like to see a new model added, please fill out this form: [Model Based Detection feedback form](https://docs.google.com/forms/d/e/1FAIpQLSeKUu1flQfdNSYKLBhUk6gNwdypUk5STMNsufkOZ58vWI_g9w/viewform) ## Next Steps Learn how to use these models and score thresholds by working through our [tutorial](tutorials/double-verification), or reviewing our [API reference](api-reference). --- ### Models API reference URL: https://docs.passport.xyz/building-with-passport/models/api-reference # Models API Reference The Models API enables developers to retrieve different [model-based unique humanity scores](available-models) in real-time, enabling you to score any EVM wallet address without requiring the users to create and build up a Passport score. Need a batch or more in-depth Sybil classification and clustering analysis? Learn more about our [Data Services](/building-with-passport/data-services). You can also experiment with the Models API using our [API playground](https://passport-api-playground.vercel.app). ## Rate Limits |Tier |Rate limit | |--|--| |Tier 1 | *[DEFAULT]* 15 requests per 15 minutes | |Tier 2 | 350 requests per 15 minutes | |Tier 3 | 2000 requests per 15 minutes | These rate limits are completely separate from the existing Stamps API rate limits. If you'd like to request elevated rate limits, please fill out our [rate limit elevation form](https://docs.google.com/forms/d/e/1FAIpQLSe5B7zXTUQUt_aWdqTiUhjAhz56pS49Q8meuzLSgGxYTZRwAw/viewform). ## Retrieve Model scores Use this endpoint to request a model-based score for a specified user. You can find all of the available models and recommended score thresholds via our [available models](available-models) page. * **Endpoint:** `GET /v2/models/score/{address}` * **Base URL:** `https://api.passport.xyz` * **Authentication:** API Key – Can be the same [API Key](/building-with-passport/stamps/passport-api/getting-access) that is used with the Stamps API ### Parameters |Parameter |Type |Description | |--|--|--| |`address` |Path parameter| *[Required]* Pass a single EVM wallet address. | |`model` |Query parameter | Include one of the following [available models](available-models) to request that model's score for the specified wallet address:
`aggregate`, `ethereum_activity`, `nft`, `arbitrum`, `base`, `optimism`, `polygon`, and `zksync`

If you don't include this parameter, the API will return the `aggregate` model by default. | ### Score Range and Methodology The Models API returns scores in the range of -1 to 100: - **-1**: Indicates insufficient data available to generate a score - **0-100**: Represents the score range where: - Lower scores indicate higher likelihood of being a Sybil account - Higher scores indicate higher likelihood of being a legitimate human account - The exact interpretation of scores depends on the [specific model](available-models) being used Scores are calculated based on various on-chain and off-chain data points specific to each model. The aggregate model combines multiple model scores to provide a comprehensive assessment. ### Default example #### Request ```bash curl --request GET \ --url 'https://api.passport.xyz/v2/models/score/{address}?model=aggregate' \ --header 'Content-Type: application/json' \ --header 'X-API-KEY: {API KEY}' ``` #### Response ```json { "address": "string", "details": { "models": { "aggregate": { "score": 50 } } } } ``` ### Arbitrum model example #### Request ```bash curl --request GET \ --url 'https://api.passport.xyz/v2/models/score/{address}?model=arbitrum' \ --header 'Content-Type: application/json' \ --header 'X-API-KEY: {API KEY}' ``` #### Response ```json { "address": "string", "details": { "models": { "arbitrum": { "score": 50 } } } } ``` --- ## Building with Passport > Models > Tutorials ### Double Verification with the Model Based Detection and Stamp-based APIs URL: https://docs.passport.xyz/building-with-passport/models/tutorials/double-verification # Double Verification with the Model Based Detection and Stamp-based APIs **Please note:**
This tutorial uses the Stamps API v1. We recommend using [Stamps API v2](/building-with-passport/stamps/passport-api) for new projects.

We plan to update this tutorial to use Stamps API v2 shortly. This tutorial will walk you through verifying an EVM account with both the ETH Activity model (model-based detection) and the [Stamp-based method](/building-with-passport/stamps/passport-api) in your application. The ETH activity model is one of the [available machine learning models](/building-with-passport/models/available-models) trained on known Sybil and human EVM account data that examines the transaction history for a given Ethereum address and assigns it a trust score. While this tutorial explains how to use the ETH activity model score, you can easily use any of the other available models instead. Passport exposes an API endpoint that accepts an Ethereum account as a query parameter and returns scores in the range of -1 to 100: - **-1**: Indicates insufficient data available to generate a score (e.g., new wallet with no transaction history) - **0-100**: Represents the score range where: - Lower scores indicate higher likelihood of being a Sybil account - Higher scores indicate higher likelihood of being a legitimate human account The model itself is a black box whose outcome is based on 50+ features. Some applications may be happy to rely on these models alone; however, it is advisable to offer the Stamp-based verification method as a fallback to support those users who might not have had the chance to build up a strong account history, such as crypto beginners or experts who utilize multiple wallets for different activities, or in cases where the model returns a -1 score due to insufficient data. ## Prerequisites Before we delve into this, it's important to note that there are a few preliminary steps you need to complete in order to use the Model Based Detection and Stamps API. Please ensure that these prerequisites are met before proceeding with the guide. 1. You have created a Passport Scorer and received a Scorer ID (for the Stamps API) 2. You have an API key (for both) If you haven't completed the preliminary steps above please refer to our [getting access guide](/building-with-passport/stamps/passport-api/getting-access) first. Once you're done with that, return here and continue with this walkthrough. ## The app This tutorial will guide you through creating a very simple app using nextjs. The app will present you with three buttons: - `Connect`: use this to connect your Ethereum wallet to the app. - `Check Ethereum Activity`: clicking this button will check your Ethereum activity score. If it is above a threshold then you will see a notice of success - you may proceed to access the protected content! If you do not meet the threshold you will be denied access and directed to check your Passport unique humanity score (Stamp-based) instead. - `Check Passport score`: clicking this button checks your Passport score on the Stamps API. If your score is above a threshold then you will be allowed to proceed to the protected content! ## Getting started We'll create an app using `Nextjs`. We can bootstrap using `create-next-app`. This automatically creates all the necessary subdirectories, configuration and boilerplate code required to get us building as quickly as possible. Start by entering the following command into your terminal: ```sh npx create-next-app ethereum-activity-app ``` This will create a new directory called `ethereum-activity-app` and populate it with several sub-directories and files that form the skeleton of our app. `create-next-app` will ask for yes/no responses to a series of configuration questions - answer as follows: ```sh npx create-next-app ethereum-activity-app ✔ Would you like to use TypeScript with this project? … Yes ✔ Would you like to use ESLint with this project? … Yes ✔ Would you like to use Tailwind CSS with this project? … No ✔ Would you like to use `src/` directory with this project? … No ✔ Would you like to use experimental `app/` directory with this project? …Yes ✔ What import alias would you like configured? … @/* ``` Next, change to the new `ethereum-activity-app` directory and install `ethers`: ```sh npm install ethers ``` This tutorial will also use [Chakra-UI](https://chakra-ui.com/) for styling, so install it using `npm`: ```bash npm i @chakra-ui/react @emotion/react @emotion/styled framer-motion ``` Replace the contents of `app/page.tsx` with the following boilerplate code (this includes all the very basic logic to render a page and connect a wallet to the app and the logic required to check a Passport - if you need a refresher on the Stamps API logic you can visit our [quick start guide](/building-with-passport/stamps/passport-api/quick-start-guide)): ```tsx 'use client' import { useState, useEffect } from 'react' import { ethers } from 'ethers' import { ChakraProvider, Button, Flex, Heading } from '@chakra-ui/react' const APIKEY = process.env.NEXT_PUBLIC_GC_API_KEY const SCORERID = process.env.NEXT_PUBLIC_GC_SCORER_ID const SUBMIT_PASSPORT_URI = 'https://api.passport.xyz/registry/submit-passport' const SIGNING_MESSAGE_URI = 'https://api.passport.xyz/registry/signing-message' const PASSPORT_THRESHOLD = 20 const headers = APIKEY ? ({ 'Content-Type': 'application/json', 'X-API-Key': APIKEY }) : undefined export default function Passport() { // here we deal with any local state we need to manage const [address, setAddress] = useState('') const [passportScore, setPassportScore] = useState('') const [isPassportScoreAboveThreshold, setIsPassportScoreAboveThreshold] = useState(false) const [isPassportChecked, setIsPassportChecked] = useState(false) useEffect(() => { checkConnection() async function checkConnection() { try { const provider = new ethers.BrowserProvider(window.ethereum) const accounts = await provider.listAccounts() // if the user is connected, set their account if (accounts && accounts[0]) { setAddress(accounts[0].address) } } catch (err) { console.log('not connected...') } } }, []) async function connect() { try { const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) setAddress(accounts[0]) } catch (err) { console.log('error connecting...') } } async function getSigningMessage() { try { const response = await fetch(SIGNING_MESSAGE_URI, { headers }) const json = await response.json() return json } catch (err) { console.log('error: ', err) } } async function getPassportScore() { setPassportScore('') const GET_PASSPORT_SCORE_URI = `https://api.passport.xyz/registry/score/${SCORERID}/${address}` try { const response = await fetch(GET_PASSPORT_SCORE_URI, { headers }) const passportData = await response.json() if (passportData.score) { // if the user has a score, round it and set it in the local state const roundedScore = Math.round(passportData.score * 100) / 100 setPassportScore(roundedScore.toString()) if (roundedScore > PASSPORT_THRESHOLD) { setIsPassportScoreAboveThreshold(true) } else { setIsPassportScoreAboveThreshold(false) } console.log("PASSPORT SCORE = ", roundedScore) } else { // if the user has no score, display a message letting them know to submit thier passporta console.log('No score available, please add Stamps to your Passport and then resubmit.') } } catch (err) { console.log('error: ', err) } } const styles = { main: { width: '900px', margin: '0 auto', paddingTop: 90 } } return ( /* this is the UI for the app */


Welcome to Passport!

) } ``` ## Adding the Etheruem Activity scorer The ETH activity scorer is accessed via a public API endpoint passing the user's Ethereum address as a query parameter. To start integrating this into your app, you can add the base URL for the API endpoint as a constant at the top of the script, just below the Passport URI definition. ```typescript const ETHEREUM_ACTIVITY_SCORE_URI = 'https://api.passport.xyz/v2/models/score/' const ETHEREUM_SCORE_THRESHOLD = 50; ``` Next, we will want to track the score, and the status of your API requests in the application state. You can add one state variable to store the score retrieved from the API (a `string`), one to track whether a request has been made to the Models API (a `boolean`) and one to track whether the retrieved ETH activity score exceeds the threshoild (a `boolean`). Add the following state variable definitions beneath the existing state variable definitions in the boilerplate code: ```typescript const [ethereumScore, setEthereumScore] = useState('') const [isEthereumScoreAboveThreshold, setIsEthereumScoreAboveThreshold] = useState(false) const [isEthereumActivityChecked, setIsEthereumActivityChecked] = useState(false) ``` Next, we can write some async functions that handle the request itself. We will write one function for the API request and another that wraps the API request and updates the appropriate state variables. Start with the API request. You can call this function `getEthereumScore()`. Inside the function, first clear the existing `ethereumScore` variable, then make the API request. There is some parsing out of the `score` from the response object to handle. The score can be passed to `setEthereumScore()` to update the application state. Add some basic error handling, and the function looks as follows: ```typescript async function getEthereumScore() { setEthereumScore('') const GET_ETHEREUM_ACTIVITY_SCORE_URI = ETHEREUM_ACTIVITY_SCORE_URI + address try { const response = await fetch(GET_ETHEREUM_ACTIVITY_SCORE_URI, { headers }) const ethereumData = await response.json() if (ethereumData.details.models.ethereum_activity.score) { const score = ethereumData.details.models.ethereum_activity.score console.log("ETHEREUM SCORE = ", score) // if the user has a score, round it and set it in the local state setEthereumScore(score.toString()) } else { // if the user has no score, display a message letting them know to submit thier passporta console.log('No score available, please add Stamps to your Passport and then resubmit.') } } catch (err) { console.log('error: ', err) } } ``` Next we can write a light wrapper around `getEthereumScore()` called `checkEthereumActivity`. This wrapper will call `getEthereumScore()` and once it receives a response it will check whether the returned value exceeds the threshold and update the `isEthereumActivityChecked` variable to `true`. ```typescript async function checkEthereumActivity() { try { await getEthereumScore() if (parseInt(ethereumScore) > ETHEREUM_SCORE_THRESHOLD) { setIsEthereumScoreAboveThreshold(true) } else { setIsEthereumScoreAboveThreshold(false) } setIsEthereumActivityChecked(true) } catch { throw new Error('error fetching Ethereum activity score') } } ``` That's it! All the logic required to check the user's ETH activity score has been defined in your app. All that is left to do is to call these functions from the app UI. The following code adds some conditional logic to the UI. The Ethereum activity has to be checked first. If the Ethereum activity score exceeds the threshold the app displays a success message. If the score is below the threshold it prompts the user to check their Passport score using the Stamps API. If neither are successful, it displays a failure message. Add the following code as the final content inside the `
` provided in return statement in the boilerplate code. ```tsx {!isEthereumActivityChecked &&

Welcome to our application!


Please check your Ethereum activity score.

If your score is above the threshold - you may proceed!

} {isEthereumActivityChecked && isEthereumScoreAboveThreshold &&

Congratulations! Your Ethereum score is {ethereumScore}.

This is above the threshold - you may proceed!

} {isEthereumActivityChecked && !isEthereumScoreAboveThreshold &&

Your Ethereum score is {ethereumScore}.

Unfortunately your score is too low to proceed!


Please submit your Passport instead.

} {isEthereumActivityChecked && isPassportChecked && !isEthereumScoreAboveThreshold && !isPassportScoreAboveThreshold &&

Your Passport unique humanity score is {passportScore}.

Unfortunately your score is still too low to proceed.


Please go to the Passport app and add Stamps to improve your score.

} {isEthereumActivityChecked && isPassportChecked && !isEthereumScoreAboveThreshold && isPassportScoreAboveThreshold &&

Your Passport score is {passportScore}.

Unfortunately your score is still too low to proceed!


Please add Stamps to your Passport to improve your score.

} {isEthereumActivityChecked && isPassportChecked && !isEthereumScoreAboveThreshold && isPassportScoreAboveThreshold &&

Your Passport score is {passportScore}.

This is above the threshold. You may proceed!

} ``` ## Run and test the app You can start this app now by navigating your terminal to the project directory (`passport-app`) and running `npm run dev`. Then, navigate your browser to `localhost:3000`. You will see a basic app load in the browser, with buttons that enable you to connect your wallet and submit your Passport to the registry. You can go ahead and test that the `Connect` and `Submit Passport` buttons are working as expected. Your app should look like this: ![Passport app ethereum activity](/passport-app-ethereum-activity.png) --- ## Community ### Getting involved URL: https://docs.passport.xyz/community/getting-involved # How to contribute ## Identity Providers If you're an identity provider and want to integrate with the Human Passport check out the documentation for Integrating a new stamp into the Passport. [Creating a new Stamp](/building-with-passport/stamps/create-a-stamp) ## App Builders If you have an app that has integrated the Passport let us know! We're happy to offer support and would love to hear about your experience building with the Stamps API. Come find us in our [Human Passport Developers Telegram](https://t.me/+Mcp9RsRV7tVmYjZh). ## DevRel and Tech Writers If you spot some areas to improve our docs visit our [Github](https://github.com/passportxyz/passport-docs). We'd love to get your PRs incorporated and help make this documentation as comprehensive and accessible as possible! You can also chat on our [developer support channel on Telegram](https://t.me/+Mcp9RsRV7tVmYjZh). --- ### Passport Github projects URL: https://docs.passport.xyz/community/passport-github-projects # Human Passport Github Projects ## Production Passport Codebase - [Production Passport Codebase](https://github.com/passportxyz/passport) --- ### Style guide URL: https://docs.passport.xyz/community/style-guide # Style Guide This style guide lays out the basic standards for the documentation on this site. This is to encourage standardized syntax, tone, grammar and styling across the site. The aim of the style guide is **not** to stifle individualism, but to empower a diverse set of contributors from across the community by: * being clear about the best practises we want to adhere to * being clear about the criteria by which pull requests will be evaluated * being transparent about the guiding philosophy while also serving our audience of users and developers by: * maintaining a consistent "voice" across the site * lowering barriers to entry by consistentlyusing welcoming and accessible language * making it easy to find the right information ### Audience personas Our documentation serves two primary personas: **users** and **developers.** Users are people interested Human Passport because of the activities it unlocks for them. They are most likely interested in how to use their Passport, but less interested in how it works under the hood. They want to know, for example, how to cretae a Passport for the first time, or how to maximize their score to access apps. They probably are not interested in seeing code. Developers are people building apps that integrate Human Passport. They might not be users themselves, and they are msot interested in udnerstanding how to build Human Passport into their own applications. They are more interested in the mechanics of how Human Passport workls and will want to see code snippets, example and reference documentation. These personas are best served separately, so that users are not burdened with uneccessary details and dveeloeprs can easily find the right information to unlock their building. The documentation on this site is therefore divided into two distinct pathways. One serves users and the other serves developers. It is important to think about which group of users you are serving when you add a new page. ### Information architecture This site generally aims to conform to the modular documentation specs defined by [RedHat](https://redhat-documentation.github.io/modular-docs/). This is because the documentation is user-centric and intended to guide readers to complete specific tasks. Modular documentation generally follows a heirarchy that first separates information into distinct _user stories_. Each user story is then subdivided into individual self-contained chunks called _modules_. Each module can be one of three types: _concept_, _procedure_ or _reference_. A concept module gives the reader descriptions, explanations and examples that help them understand some aspect of a product. A procedure module explains how to achieve some specific task. A reference module provides useful data or syntax reminders for users so that they don't have to remember them. On this site, we first divide the content according to user persona: users and developers. Then, each subdivision is a specific user story - that is some specific objective the reader might have. For example, `Creating a Passport` is a user story. It is clear what the intended outcome of this section is: the user should learn how to create a Passport. The individual modules are the sections on the page that explain some particular step the user needs to take to achieve the overall aim of creating a Passport. An example of a procedure module on the `Creating a Passport` page might be `Getting an Ethereum address` and it would aim to guide the user throuhg thr process of getting an Ethereum address. An example of a concept module on the page could be `What is a wallet?` - the aim of the module would eb to explain the concept of wallets. A reference module on the page could be `Useful Links` and it would simply list useful links for this user story on the page as a convenience tool. This is the overall information architecture that the site aims to conform to, because it is oriented around helping a reader to achieve specific objectives using Human Passport. If you add pages to the documentation, please take the time to think about how it can fit into this high level philosophy. ### Global styles There are some core principles that serve both users and developers equally well. These should be applied across the entire site. #### Language and tone **Active voice** Using _active voice_, rather than _passiver voice_ puts the subject of the sentence first, making the writing more impactful and relatable. It makes the relationship between actor and action very clear. An example of using the active voice over the passive voice is: `the developers wrote some code` rather than `some code was written by developers` There are occasions when the passive voice is appropriate, such as when there is no clear subject for the sentence or the subject is irrelevant. For example, `100 ETH was added to the account`. However, as a general rule, we will try to prioritize using the active voice. **Action oriented** Action-oriented prose emphasises specific tasks that have some tangible outcome. For example, it is preferable for us to write about `how to read a Passport score` compared to `using the scorer API`. The former emphasises the benefit the page will have on the user (they will learn how to achieve a specific objective, in this case reading a Passport score) instead of being open-ended and "feature-oriented". **Second-person narratives** Your writing can feel more accessible and engaging if you refer to the reader directly. This means using the personal pronoun "you" and making direct instructions to the reader. It implies that the reader is the main character and that the documentation is made to help them on their journey. For example, use: `connect your Passport` instead of `the passport can be connected` or `the user can connect their passport` **Conscious language** You should use [conscious language](https://github.com/conscious-lang/conscious-lang-docs) as much as possible. This is because the documentation is supposed to be accessible to as many people as possible. We want to create a welcoming, inclusive environment and avoiding trigger words and unneccessarily offensive terminology goes a long way to making people feel valued. **Jargon** You should try to avoid jargon wherever possible. This helps to create a friendly tone and prevents readers from being intimidated by unfamiliar terminology. **Acronyms** Acronyms should be spelled out in full on the first use on a page, with the acronym itself in parentheses. Subsequent uses can refer to the acronym only. For example: `Ethereum uses a proof-of-stake (PoS) based consensus mechanism` **Capitalization** You should start proper nouns with capital letters. This includes capitalizing the word "Passport" when it refers to Human Passport. Other examples that occur frequently across these docs include: Ethereum, Gitcoin, Ceramic, DID, Scorer, Mainnet etc. #### Styling **Headings** Headings are styled using the hash character (#). The number of hashes preceding the title corresponds to the level of the heading. For example, a single hash creates a top level heading. Two hashes is a second-level heading. In these docs the page title should be a top level (single hash) heading. All other headings should be minimum of second-level (two hashes). Nesting up to 5 hashes is allowed. e.g. ``` # Main page title ## Section One ... ### Getting started ... #### Some more details ... ##### Really fine detail 1 ... ##### Really fine detail 2 ... ### Moving on ... #### Some fine details ... ## Section 2 ... ### Getting started ... #### Details ... ``` **Links** Inline links are fine, but it is best if they are not too frequent. A good rule of thumb is to have fewer than 5 inline links per paragraph. More than that can become distracting for the reader. Link texts should be descriptive. This means linking from, e.g. "more information in the React documentation" rather than "more information here". In this example the reader expects to be directed to the React documentation before they even click the link, reducing some friction. It is also reassuring from a security perspective (because it is clear to readers where a link is intended to take them) and makes it easier to maintain the site when links are updated later. When linking to internal pages, use relative paths, e.g. `/devs/getting-started` over `https://docs.passport.xyz/devs/getting-started`. **Images** Images can be embedded in pages using standard markdown notation: `![alt text](path-to-image)` You should save the image into the `/public` folder and use the relative path to it in the link, rather than linking to an external resource. Any images that require aknowledgements must have them included clearly in the image caption or in text immediately beneath the image. Do not add any images that would break copyright. ### Styles for Users Users are people that are interesting in using Human Passport to demonstrate their identity/credentials. They are not interested in writing code. Users are a very diverse group of people from a range of backgrounds with a variety of experiences and expertise. This means we should use language that is accessible as possible and avoid using words that are specific to the software industry. Jargon from web3, software development or any other technical industry are likely to be points of friction for at least some of our Users. To be as inclusive as possible, we should **use language that as many people as possible can understand without having to look things up**. Images and screenshots are helpful because some Users will learn better from visual assets than from text. ### Styles for Developers Developers want to write code that incorporates Human Passport into their applications. This means developers like to see examples in the form of code snippets. In our markdown files, code snippets are wrapped in three " \` " characters. The language can be defined in the same line. So, for example: \`\`\`js\ console.log("some javascript code")\ \`\`\` renders as: ```js console.log("some javascript code") ``` Developers probably also appreciate frequent links to external documentation and API references, and links to Github repositories with full application code. ### Internationalization Right now we are an English-language only site. We would prefer to be available in many languages! If you can help us to internationalize our documentation, get in touch through Github or [Telegram](https://t.me/+Mcp9RsRV7tVmYjZh)! ---