Verona 백서

Verona

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 54쪽 중 34쪽

a real-time session that walks through the proof flow. <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FpWF2ISWpLdr8JoTGJxkO%2Ftelegram-cloud-photo-size-1-5152633146905308748-y.jpg?alt=media&amp;token=6a10e2f6-eb3e-4fc4-b00a-4b3d93983d89" alt="" width="303"><figcaption></figcaption></figure> * Log in to Kaggle again via the verifier app. Once the email address is successfully verified, you’ll be redirected to a success page. <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FtUIPzOv0J7qClthjSIQ2%2Fimage.png?alt=media&amp;token=d95b422f-52ad-4fe4-bc48-3eacf7db5833" alt=""><figcaption></figcaption></figure> <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FSIHBLgB9BtsZ4NcLk153%2Fimage.png?alt=media&amp;token=587a417b-7eff-4f7a-a4f0-ff0080039bd2" alt=""><figcaption></figcaption></figure> ## Awaiting Approval Even after publishing, your provider will initially be marked as **inactive**. This is a safeguard to ensure all new providers are manually reviewed. You’ll need to reach out to the **Reclaim team** and request activation of your provider. Once approved, your zkTLS provider will be live and available for you to use for secure, privacy-preserving verification. *** You’ve now created a custom Reclaim provider that verifies email ownership on Kaggle using zkTLS. This powerful approach can be adapted to any platform where users can log in and view identifiable data. It’s ideal for building trustless, onboarding flows or creating verified credentials across apps. # Verifying API Data with Zero Knowledge (zkFetch) [**zkFetch**](https://github.com/reclaimprotocol/zk-fetch) is an open source developer tool from [Reclaim Protocol](https://zkfetch.com/) that allows you to fetch data from any web API or website and generate a **zero-knowledge proof (ZKP)** of specific fields from that data, without revealing the entire response or private credentials. One big benefit of this is that you can now build any application without the need of a trusted **Oracle**. Traditional oracles fetch and expose data from off-chain sources directly. **zkFetch flips the model**: > It lets a user prove *they saw some specific data from an API response* — but keeps the rest of the response (and credentials) private. This makes it perfect for: * Privacy-preserving identity & credential verification * Proving access to gated APIs or services * Enabling Web2-to-Web3 use cases without exposing secrets This guide will help you to build a web app that allows users to generate **zero-knowledge proofs** (ZKPs) about data fetched from a web API using **zkFetch**. ## Create a Reclaim Account <a href="#create-a-reclaim-account" id="create-a-reclaim-account"></a> **Reclaim** is a decentralized identity protocol that allows users to prove facts about themselves, such as social media stats, financial data, or platform activity, using **zero-knowledge proofs (ZKPs)**. Rather than sharing raw data, Reclaim enables users to generate cryptographic proofs that can be verified on-chain without revealing the underlying information. To get started, you’ll need to: 1. Visit [Reclaim](https://dev.reclaimprotocol.org/explore) and sign in. 2. Create a new application. 3. Save your **Application ID** and **Application Secret**. 4. On the application details screen enable "**zkFetch**" <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FjYgY2VJ9onBfSyHUPbQR%2Fimage.png?alt=media&amp;token=8759a48a-81bd-4c22-a3f1-d515451cc726" alt=""><figcaption></figcaption></figure> ## Quick Start Let's run the starter application as it was designed using the Coingecko API. #### 1. Prerequisites 1. Make sure you have Node.js installed (v24 or higher) 2. Ensure your **.env** file has valid Reclaim credentials which includes the `REACT_APP_RECLAIM_APP_ID` and `REACT_APP_RECLAIM_APP_SECRET`. To get these values you’ll need to: 1. Visit [Reclaim](https://dev.reclaimprotocol.org/explore) and sign in. 2. Create a new application. 3. Save your **Application ID** and **Application Secret**. #### 2. Clone the Starter Pack ```bash git clone https://github.com/burnt-labs/zkfetch-client.git cd zkfetch-client npm install ``` #### 3. Run the post-install script (important for zkFetch setup) ```bash npm run postinstall ``` #### 4. Start the Dev Server ```bash npm start ``` The app runs locally at `http://localhost:3000` <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FlLW7hFQo1t2ayxMGI4IA%2Fimage.png?alt=media&amp;token=b41e3b16-939a-4e5e-85ac-9742cfec9a25" alt=""><figcaption></figcaption></figure> ## Understanding the Starter Application The starter application includes three pre-configured examples: 1. **CoinGecko API** - Fetches cryptocurrency market data 2. **GitHub API** - Retrieves user repository counts 3. **JSONPlaceholder** - Demonstrates POST requests When you click "**Generate Proof**", the app: 1. Makes an API request through **zkFetch** 2. Extracts specific data using regex patterns 3. Generates a zero-knowledge proof 4. Transforms the proof for CosmWasm smart contracts ## How zkFetch Works ### Core Components ```javascript const data = await reclaim.zkFetch( url, // API endpoint fetchOptions, // Method, headers, body { responseMatches: [...], // What to extract responseRedactions: [...] // What to prove } ); ``` ### Response Matching zkFetch uses regex patterns to extract specific values from API responses: ```javascript responseMatches: [ { type: 'regex', value: '"field_name":\\s*(?<extracted_value>\\d+)' } ] ``` The `\\s*` handles optional whitespace in JSON responses. ## Building Your Own API Integration ### Step 1: Choose Your API Let's add an ESPN API example to fetch sports scores: ```javascript const examples = { // ... existing examples ... espn: { name: 'ESPN NBA Scores', url: 'https://site.api.espn.com/apis/site/v2/sports/basketball/nba/scoreboard', method: 'GET', responseMatches: [ { type: 'regex', value: '"name":\\s*"(?<team_name>[^"]+)".*?"score":\\s*"(?<score>\\d+)"' } ], responseRedactions: [{ regex: '"score":\\s*"(?<score>\\d+)"' }], description: 'Prove NBA team scores without revealing full game data' } }; ``` ### Step 2: Handle Authentication (if needed) For APIs requiring authentication, you can: 1. **Use API Keys in Headers**: ```javascript headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } ``` 2. **Handle OAuth Tokens**: ```javascript // User provides their own token const userToken = prompt('Enter your API token:'); headers: { 'Authorization': `Bearer ${userToken}` } ``` ### Step 3: Define What to Prove Use regex patterns to extract specific fields: ```javascript // Extract a nested value value: '"user":\\s*\\{[^}]*"email":\\s*"(?<email>[^"]+)"' // Extract array elements value: '"scores":\\s*\\[(?<first_score>\\d+)' // Extract boolean values value: '"verified":\\s*(?<is_verified>true|false)' ``` ## Error Handling Common issues and solutions: #### 1. Regex Pattern Errors If you see "regexp does not match found element": * Check if the API response format changed * Add `\\s*` to handle whitespace variations * Test your regex on the actual API response #### 2. CORS Issues Some APIs block cross-origin requests: * Use APIs that support CORS * Consider using a proxy service * Run a local proxy during development #### 3. Authentication Failures * Verify API credentials are correct * Check if tokens have expired * Ensure proper header formatting ## Generating Proofs When a user clicks "**Generate Proof**": 1. **API Request**: zkFetch contacts the API endpoint 2. **Data Extraction**: Regex patterns extract specified values 3. **Proof Generation**: Reclaim creates a ZKP of the data 4. **Transformation**: Proof is formatted for blockchain use The resulting proof contains: * Extracted data values * Cryptographic signatures * Witness information * Timestamps ## Using Proofs On-Chain (CosmWasm) The app transforms proofs for CosmWasm contracts: #### Contract Message Format ```rust #[derive(Serialize, Deserialize, JsonSchema)] pub struct VerifyProofMsg { pub claim_info: ClaimInfo, pub signed_claim: SignedClaim, pub extracted_data: HashMap<String, String>, pub witnesses: Vec<Witness>, } ``` #### Integration Example ```rust pub fn verify_and_mint_nft( deps: DepsMut, info: MessageInfo, proof: VerifyProofMsg, ) -> Result<Response, ContractError> { // Verify the proof is valid verify_reclaim_proof(&proof)?; // Check the extracted data let score = proof.extracted_data .get("score") .ok_or(ContractError::MissingScore)?; // Business logic based on proven data if score.parse::<u32>()? > 100 { // Mint achievement NFT mint_nft(deps, info.sender, "High Scorer")?; } Ok(Response::new() .add_attribute("action", "verify_proof") .add_attribute("score", score)) } ``` ## Advanced Features #### Custom Proof Validation Add validation before transformation: ```javascript const validateProof = (proof) => { // Check timestamp is recent const proofAge = Date.now() - (proof.claimData.timestampS * 1000); if (proofAge > 3600000) { // 1 hour throw new Error('Proof is too old'); } // Verify expected fields exist if (!proof.extractedParameterValues.score) { throw new Error('Score not found in proof'); } return true; }; ``` #### Batch Proofs Generate multiple proofs in sequence: ```javascript const generateMultipleProofs = async () => { const proofs = []; for (const [key, example] of Object.entries(examples)) { try { const proof = await generateProof(key); proofs.push({ api: key, proof }); } catch (error) { console.error(`Failed for ${key}:`, error); } } return proofs; }; ``` #### Proof Aggregation Combine multiple proofs for complex verifications: ```javascript const aggregateProofs = (proofs) => { return { aggregate_proof: { proofs: proofs.map(p => p.verify_proof), metadata: { created_at: new Date().toISOString(), proof_count: proofs.length } } }; }; ``` ## Security Considerations 1. **Never expose API keys** in client-side code 2. **Validate proof timestamps** to prevent replay attacks 3. **Verify proof signatures** in your smart contract 4. **Rate limit** proof generation to prevent abuse 5. **Sanitize regex patterns** to avoid ReDoS attacks ## Troubleshooting ### Debug Mode Enable detailed logging: ```javascript console.log('API Response:', await response.text()); console.log('Regex Pattern:', example.responseMatches[0].value); console.log('Extracted Values:', proof.extractedParameterValues); ``` ### Common Error Messages * **"Application not found"**: Check Reclaim credentials in .env * **"Failed to send logs"**: Normal in development, ignore * **"Regex does not match"**: Update pattern for API changes * **"CORS blocked"**: Use a CORS-enabled API or proxy # Email Verification (zkEmail) ## ZK Email Verification Overview ZK Email verification allows users to prove facts about their email accounts using zero-knowledge proofs, without revealing the full email content. ### Key Features * **Privacy-Preserving**: Only reveal necessary information * **On-Chain Verification**: Proofs can be verified by smart contracts * **Receipt Verification**: Verify email receipts and confirmations *** ***Coming Soon.*** # Mobile Verification (App Attestations) Verify mobile app authenticity and integrity ## Overview This section will cover how to verify mobile app authenticity and integrity using app attestations on the Verona network. App attestations allow you to prove that your app is running in a genuine environment and has not been tampered with. *** ***Coming Soon.*** Check back later for documentation on: * App attestation overview and use cases * Integration guides for iOS and Android * On-chain verification of app attestations # Payments The Payments layer provides tools and integrations for handling payments, stablecoins, and on/off ramps on the **Verona** network. ### Overview Verona's Payments Layer enables: * **On-Ramps**: Credit card payments, Crossmint integration * **Stablecoins**: Native stablecoin support * **Cross-Chain Payments**: Interoperability with other chains ### On-Ramps #### Crossmint Integration Integrate credit card payments for digital assets: * Web Integration: [Crossmint Digital Collectibles Checkout via Credit Card](/en/build-on-verona/payments/credit-debit-cards/crossmint-digital-collectibles-checkout-via-credit-card) * Mobile Integration: [Integrate Credit Card Payments for Digital Assets in your Mobile App using Crossmint](/en/build-on-verona/payments/credit-debit-cards/integrate-credit-card-payments-for-digital-assets-in-your-mobile-app-using-crossmint) # Credit / Debit Cards Verona has partnered with [Crossmint](https://www.crossmint.com) to bring seamless NFT purchasing experiences to users via credit card and crypto payments. Crossmint's powerful Web3 checkout infrastructure now supports Verona, allowing developers to create apps where users can buy NFTs using familiar, Web2-native payment methods, no wallets or crypto required. This section of the docs will guide you through: * How the Crossmint integration works with Verona * Setting up your project with Crossmint APIs and SDKs * A test frontend example you can use or fork * Additional resources to keep in mind <table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h3><strong>Web Integration</strong></h3></td><td><a href="/en/build-on-verona/payments/credit-debit-cards/crossmint-digital-collectibles-checkout-via-credit-card">Crossmint Digital Collectibles Checkout via Credit Card</a></td></tr><tr><td><h3>Mobile Integration</h3></td><td><a href="/en/build-on-verona/payments/credit-debit-cards/integrate-credit-card-payments-for-digital-assets-in-your-mobile-app-using-crossmint">Integrate Credit Card Payments for Digital Assets in your Mobile App using Crossmint</a></td></tr></tbody></table> # Crossmint Digital Collectibles Checkout via Credit Card The Crossmint integration with XION enables a seamless, credit card based NFT checkout experience. This is ideal for onboarding non-crypto native users into platforms where NFT assets are used, such as games, marketplaces, or digital collectibles. {% hint style="success" %} To import a custom NFT contract into the Crossmint platform, your contract should follow the specific requirements outlined [here](https://docs.crossmint.com/minting/advanced/xion-contracts). These guidelines ensure compatibility with Crossmint’s infrastructure. There is still a good chance your custom NFT contract might still work if it doesn't directly extend the **CW721 Metadata Onchain** variant, as long as the contract supports the `update_minter_ownership` message with the same parameters and accepts the expected `ExecuteMsg` format as documented [here](https://docs.crossmint.com/minting/advanced/xion-contracts). {% endhint %} ## Crossmint Staging Environment To get started, create a Crossmint staging account so you can test the integration in a sandbox environment. 1. Go to [https://staging.crossmint.com](https://staging.crossmint.com/) and click the "**Console**" button in the site header <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FjIEFRxv1gsDTfLZzBCEu%2Fimage.png?alt=media&amp;token=89c185c8-0f71-4013-b108-56d1004aa382" alt=""><figcaption></figcaption></figure> 2. You will be taken to the **Signin** page. Make sure "**Staging**" is selected and then enter your sign in details <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FTuwr2ySVXbUxe5GPhD0z%2Fimage.png?alt=media&amp;token=7f7df56d-f677-437e-a469-0b5de76e8691" alt=""><figcaption></figcaption></figure> 3. If you're new, you'll be guided through the account creation process 4. Once your account is created you will be asked to create your first project 5. Once your project is created you will be taken to your console's overview page ### Create API Key From the sidebar, click "**Integrate**", then click "**API Keys**". ![](https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2FTEqB0n6z4frkXlGWQSQE%2Fimage.png?alt=media\&token=63293ced-debf-4a9c-bd9b-86ededf966c0)<br> #### Server Key A **server key** is intended for backend (server-side) applications and should not be used in frontend code, as doing so will result in CORS (Cross-Origin Resource Sharing) errors. In this guide, we will not be using a server key since we’re building a frontend application that interacts with the Crossmint API. If you want to test Crossmint’s APIs using their [API Reference](https://docs.crossmint.com), you’ll need to generate a server key to authorize your requests. To create one, click **“Create new key”** under the **“Server-side keys”** section in the Crossmint Console. {% hint style="info" %} Server side keys offers a lot more scopes than Client side keys. {% endhint %} #### Client Key Click the "**Create new key**" button under the "**Client-side keys**" section. Select the following scope to enable order execution via Crossmint’s checkout: * `orders.create` Then click "**Save client key**" Your client key will now appear in the client key list. ### Create Collection The Crossmint team has enabled the creation of NFT collections directly within the Console. These collections are based on the [**CW-721 Metadata Onchain**](https://github.com/public-awesome/cw-nfts/tree/main/contracts/cw721-metadata-onchain) contract. You can also import a custom NFT contract, as long as it is built on the [**CW-721 Metadata Onchain**](https://github.com/public-awesome/cw-nfts/tree/main/contracts/cw721-metadata-onchain) standard. To create your collection, follow these steps: 1. Click the "**Token collections**" link in the menu sidebar and then click the "**New collection**" button <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2Ff5NJms3jLuHIYKnvBUym%2Fimage.png?alt=media&amp;token=5ba8dae3-972c-4e38-a8e9-8d6a8fb7da2f" alt=""><figcaption></figcaption></figure> 2. Enter the collection information and click "**Next**" 3. On the "**Create or import your collection contract**" step select "**Create a new contract**" and then click "**Next**". If you have your own custom NFT contract select "**Import an existing contract**" 4. On the "What do you want to do with this collection?" section select "**Sell NFTs**" and click "**Next**" 5. On "**Choose a chain**" select "**Xion**" and click "**Next**" 6. On "**Payment settings**" enter a price for the collection, select who pays the fees and enter an address that will receive the revenue from sales 7. Review details and click the "**Create collection**" button to complete the process ### Create an NFT On the "**Token collections**" page select the collection created above. The NFTs tab is selected by default, click "**manual upload**" and in the window that pops up enter the NFT information. <figure><img src="https://3630978198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB5Z5ijJgMx0GJO3l1Il9%2Fuploads%2F0PmAdm1vIsyhn7SifRbg%2Fimage.png?alt=media&amp;token=ce68d41d-71d8-4d7d-a236-30cd9ca49f31" alt=""><figcaption></figcaption></figure> Click the "**Create NFT**" button when done. ### Update Checkout Settings Click the
프로젝트로 돌아가기