Contract 0xFC0829E792b0D10DF95B895d56FaD4712DA30B25

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x088991c62269482547430017ebc2f64cad9bf3606717651a3c37ea3fc1e388970x6080604027146422021-07-19 17:48:32305 days 10 hrs ago0x027588afac1eedb7d3d329a9b60c530aa3fadbbf IN  Create: Verifier0 AVAX0.203218425
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Verifier

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 99999 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 1 : Verifier.sol
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

// 2019 OKIMS

pragma solidity ^0.6.6;

library Pairing {
    uint256 constant PRIME_Q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;

    struct G1Point {
        uint256 X;
        uint256 Y;
    }

    // Encoding of field elements is: X[0] * z + X[1]
    struct G2Point {
        uint256[2] X;
        uint256[2] Y;
    }

    /*
     * @return The negation of p, i.e. p.plus(p.negate()) should be zero.
     */
    function negate(G1Point memory p) internal pure returns (G1Point memory) {
        // The prime q in the base field F_q for G1
        if (p.X == 0 && p.Y == 0) {
            return G1Point(0, 0);
        } else {
            return G1Point(p.X, PRIME_Q - (p.Y % PRIME_Q));
        }
    }

    /*
     * @return r the sum of two points of G1
     */
    function plus(
        G1Point memory p1,
        G1Point memory p2
    ) internal view returns (G1Point memory r) {
        uint256[4] memory input;
        input[0] = p1.X;
        input[1] = p1.Y;
        input[2] = p2.X;
        input[3] = p2.Y;
        bool success;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60)
            // Use "invalid" to make gas estimation work
            switch success case 0 { invalid() }
        }

        require(success, "pairing-add-failed");
    }

    /*
     * @return r the product of a point on G1 and a scalar, i.e.
     *         p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all
     *         points p.
     */
    function scalar_mul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) {
        uint256[3] memory input;
        input[0] = p.X;
        input[1] = p.Y;
        input[2] = s;
        bool success;
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 7, input, 0x80, r, 0x60)
            // Use "invalid" to make gas estimation work
            switch success case 0 { invalid() }
        }
        require(success, "pairing-mul-failed");
    }

    /* @return The result of computing the pairing check
     *         e(p1[0], p2[0]) *  .... * e(p1[n], p2[n]) == 1
     *         For example,
     *         pairing([P1(), P1().negate()], [P2(), P2()]) should return true.
     */
    function pairing(
        G1Point memory a1,
        G2Point memory a2,
        G1Point memory b1,
        G2Point memory b2,
        G1Point memory c1,
        G2Point memory c2,
        G1Point memory d1,
        G2Point memory d2
    ) internal view returns (bool) {
        G1Point[4] memory p1 = [a1, b1, c1, d1];
        G2Point[4] memory p2 = [a2, b2, c2, d2];

        uint256 inputSize = 24;
        uint256[] memory input = new uint256[](inputSize);

        for (uint256 i = 0; i < 4; i++) {
            uint256 j = i * 6;
            input[j + 0] = p1[i].X;
            input[j + 1] = p1[i].Y;
            input[j + 2] = p2[i].X[0];
            input[j + 3] = p2[i].X[1];
            input[j + 4] = p2[i].Y[0];
            input[j + 5] = p2[i].Y[1];
        }

        uint256[1] memory out;
        bool success;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            success := staticcall(sub(gas(), 2000), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20)
            // Use "invalid" to make gas estimation work
            switch success case 0 { invalid() }
        }

        require(success, "pairing-opcode-failed");

        return out[0] != 0;
    }
}

contract Verifier {
    uint256 constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
    uint256 constant PRIME_Q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
    using Pairing for *;

    struct VerifyingKey {
        Pairing.G1Point alfa1;
        Pairing.G2Point beta2;
        Pairing.G2Point gamma2;
        Pairing.G2Point delta2;
        Pairing.G1Point[7] IC;
    }

    struct Proof {
        Pairing.G1Point A;
        Pairing.G2Point B;
        Pairing.G1Point C;
    }

    function verifyingKey() internal pure returns (VerifyingKey memory vk) {
        vk.alfa1 = Pairing.G1Point(uint256(19781916029543660749055123328279773410186279042024774233183366729653123210381), uint256(9563414580242843331364943698304775401790209447437004523952684964170822447506));
        vk.beta2 = Pairing.G2Point([uint256(2959456841002924159193450373112406337997449206965869128424799588254526246359), uint256(2774643426484731023679850359176201693981100512728695737666695856595114972989)], [uint256(4818190437631572481764474372976535038318143485369752876193746897901186855473), uint256(15658780388898889091987918102759713837683426955167156212462671594145680151173)]);
        vk.gamma2 = Pairing.G2Point([uint256(11559732032986387107991004021392285783925812861821192530917403151452391805634), uint256(10857046999023057135944570762232829481370756359578518086990519993285655852781)], [uint256(4082367875863433681332203403145435568316851327593401208105741076214120093531), uint256(8495653923123431417604973247489272438418190587263600148770280649306958101930)]);
        vk.delta2 = Pairing.G2Point([uint256(14952761465872467134997371033402586676059870420660081379287262793715605545969), uint256(15628635561048098157170638840222546444140684649044414045920963210138947306632)], [uint256(7784624911080348942810383003523602972564015804708381176518102591074415558003), uint256(8804499648243776004456690046560300081301310311847935243353298774292527046896)]);
        vk.IC[0] = Pairing.G1Point(uint256(16489282442166856848662164439086010631300164213470821204082819470667925283059), uint256(16014880490777525775457018869579093755914910263823459593773011563468349670371));
        vk.IC[1] = Pairing.G1Point(uint256(20115561961381472454630755375787275403121070965998651473167260390094112336680), uint256(15850799066062543463525839207680734890352380314867431287327798365554564371895));
        vk.IC[2] = Pairing.G1Point(uint256(17921461483251080456006204632510231560530577267604866490967485441497256773361), uint256(16971357999690107712008589725738149658388917482260086058327377869443817153820));
        vk.IC[3] = Pairing.G1Point(uint256(14935106046857222640677956818181039811912034056613888727966135112069139797075), uint256(3115274636121297612649693168460141193265086122077172518794063472879882181066));
        vk.IC[4] = Pairing.G1Point(uint256(19859569793552264882392420404574263649073731077073326262249965327179658488951), uint256(2753461966307363965444592446883704882637280985574860372897307320228900424383));
        vk.IC[5] = Pairing.G1Point(uint256(9415546189559886261463287051510884230201498841166771301061441145417491400666), uint256(347556600998989639615686454082244318018717086723319044276931225475675870398));
        vk.IC[6] = Pairing.G1Point(uint256(12208848740642711612889130050926363822688659977162374319351815306682769384825), uint256(733087843317214771138317226575697289015914282708513778003031978863951682429));

    }

    /*
     * @returns Whether the proof is valid given the hardcoded verifying key
     *          above and the public inputs
     */
    function verifyProof(
        bytes memory proof,
        uint256[6] memory input
    ) public view returns (bool) {
        uint256[8] memory p = abi.decode(proof, (uint256[8]));

        // Make sure that each element in the proof is less than the prime q
        for (uint8 i = 0; i < p.length; i++) {
            require(p[i] < PRIME_Q, "verifier-proof-element-gte-prime-q");
        }

        Proof memory _proof;
        _proof.A = Pairing.G1Point(p[0], p[1]);
        _proof.B = Pairing.G2Point([p[2], p[3]], [p[4], p[5]]);
        _proof.C = Pairing.G1Point(p[6], p[7]);

        VerifyingKey memory vk = verifyingKey();

        // Compute the linear combination vk_x
        Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
        vk_x = Pairing.plus(vk_x, vk.IC[0]);

        // Make sure that every input is less than the snark scalar field
        for (uint256 i = 0; i < input.length; i++) {
            require(input[i] < SNARK_SCALAR_FIELD, "verifier-gte-snark-scalar-field");
            vk_x = Pairing.plus(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
        }

        return Pairing.pairing(
            Pairing.negate(_proof.A),
            _proof.B,
            vk.alfa1,
            vk.beta2,
            vk_x,
            vk.gamma2,
            _proof.C,
            vk.delta2
        );
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 99999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"bytes","name":"proof","type":"bytes"},{"internalType":"uint256[6]","name":"input","type":"uint256[6]"}],"name":"verifyProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610f67806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063695ef6f914610030575b600080fd5b610102600480360360e081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805160c081810190925293969594818101949350915060069083908390808284376000920191909152509194506101169350505050565b604080519115158252519081900360200190f35b6000610120610d3e565b8380602001905161010081101561013657600080fd5b50905060005b60088160ff1610156101db577f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47828260ff166008811061017857fe5b6020020151106101d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610f106022913960400191505060405180910390fd5b60010161013c565b506101e4610d5d565b6040805180820182528351815260208085015181830152908352815160808082018452858401518285019081526060808801519084015282528351808501855290860151815260a08601518184015281830152838201528151808301835260c0850151815260e08501519181019190915290820152610261610d8f565b6102696103db565b9050610273610dd6565b604051806040016040528060008152602001600081525090506102ab8183608001516000600781106102a157fe5b60200201516108a7565b905060005b600681101561039b577f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018782600681106102e657fe5b60200201511061035757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604482015290519081900360640190fd5b6103918261038c8560800151846001016007811061037157fe5b60200201518a856006811061038257fe5b602002015161096c565b6108a7565b91506001016102b0565b506103d06103ac8460000151610a17565b84602001518460000151856020015185876040015189604001518960600151610abe565b979650505050505050565b6103e3610d8f565b6040805180820182527f2bbc2aee1776a9b64687b8f4eeb2a5238ee3763db5b99dbf8e6571507d1edc8d81527f1524b369d37ba1286a8d05ecbf0c8454030c7b7ac15af5e917065b5b5e7df1926020808301919091529083528151608080820184527f068afe432c6542e0458ec3b5d3863b35461374803dbaa94b73ab48d8103c8dd78285019081527f0622647ca2834adfdc935e3fabc30a19fd276d2b45a26e4614d3e3762a38d73d606080850191909152908352845180860186527f0aa6ffc81080ad995a6d02a20673c488667b762787d23327c5cd344aa99e323181527f229e8e3d4ec3adb0bbd3413c56ead8134a45e7e11c5ffa11b60cbf9fdd775285818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed828501528152845180860186527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa818601528185015285850152835180820185527f210ef68bfd60ec5d70b2069292c55bf16105fc3086cec9b4ec14200a44dba3f18186019081527f228d7e877fb911164dc53803df02c44a3576849dbb1236887a8a0704cf824488828501528152845180860186527f1135f10a027e2852b6b4c8ecd964c293c777082f03082e305e97b638e3023d7381527f13772b927d6ac69d87d38cd983ace01bad957ec410ee1cd6cbd6f19957dbe0f0818601528185015282860152835180850185527f24749a668c901ecc64c2dc550de182ab8f48181ac0235f5d625d87ea9c11e0f381527f236819e4306cc834151499e9e12b79bfcbf03dd351abd9e061ecba6c2bee83e381850152818601805191909152845180860186527f2c79012d84539da5d2ff48f79dd6f3d18a643679207fac579ee745bbd974ab2881527f230b3bfde439187015eb036176c806d3bd9fc006ce42c438be18fb0f9dd395b7818601528151850152845180860186527f279f300fa13c4b1fc2f5f9b56d48c50e4017289822fb53303383835a6e3546f181527f258572bec799949367b3b9cfeaf9fca8372a052406f36688cf8cb55f492e251c818601528151860152845180860186527f2104f8701a0a21b46fb8e868f7072b0d5f7b8a387f9042428ed883bae1aa145381527f06e32ed669efde6610e82126fdea84e48904fd96b91cdbdc991bf2dd922799ca81860152815190930192909252835180850185527f2be81e4048520a6dfbdee91a343a0dca40555bee22baf107449fc440a996ec7781527f0616677c9c71ce9e05f3a99ff9254b0c4cb3a36a6142d4dfabfd250d05cacabf81850152825190910152825180840184527f14d102a2624be2f68cac065bf60528603bfe25d63ce2126c05afcf9bb7d1c7da81527ec4b5c6d2459c25b96d9f305c3ab8a7cd834a7bb2ea3250f9e7da47f5c454be81840152815160a0015282518084019093527f1afdf6a86a81cf66b849adaa410f8efc3fb58c424cf5c734d35ebc6eeaf4a57983527f019ee9bb5fcfc23d4e5437c94d2e51cdb3ded852fb2713bcf43066dcc3951b7d918301919091525160c0015290565b6108af610dd6565b6108b7610df0565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa90508080156108f5576108f7565bfe5b508061096457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f70616972696e672d6164642d6661696c65640000000000000000000000000000604482015290519081900360640190fd5b505092915050565b610974610dd6565b61097c610e0e565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa90508080156108f557508061096457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f70616972696e672d6d756c2d6661696c65640000000000000000000000000000604482015290519081900360640190fd5b610a1f610dd6565b8151158015610a3057506020820151155b15610a4f57506040805180820190915260008082526020820152610ab9565b6040518060400160405280836000015181526020017f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47846020015181610a9157fe5b067f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703905290505b919050565b6000610ac8610e2c565b60405180608001604052808b8152602001898152602001878152602001858152509050610af3610e59565b50604080516080810182528a81526020810189905280820187905260608082018690528251601880825261032082019094529192918281602001602082028036833701905050905060005b6004811015610c955760068102858260048110610b5757fe5b6020020151518351849083908110610b6b57fe5b602002602001018181525050858260048110610b8357fe5b602002015160200151838260010181518110610b9b57fe5b602002602001018181525050848260048110610bb357fe5b602002015151518351849060028401908110610bcb57fe5b602002602001018181525050848260048110610be357fe5b60200201515160016020020151838260030181518110610bff57fe5b602002602001018181525050848260048110610c1757fe5b602002015160200151600060028110610c2c57fe5b6020020151838260040181518110610c4057fe5b602002602001018181525050848260048110610c5857fe5b602002015160200151600160028110610c6d57fe5b6020020151838260050181518110610c8157fe5b602090810291909101015250600101610b3e565b50610c9e610e86565b6000602082602086026020860160086107d05a03fa90508080156108f5575080610d2957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f70616972696e672d6f70636f64652d6661696c65640000000000000000000000604482015290519081900360640190fd5b505115159d9c50505050505050505050505050565b6040518061010001604052806008906020820280368337509192915050565b6040518060600160405280610d70610dd6565b8152602001610d7d610ea4565b8152602001610d8a610dd6565b905290565b6040518060a00160405280610da2610dd6565b8152602001610daf610ea4565b8152602001610dbc610ea4565b8152602001610dc9610ea4565b8152602001610d8a610ec4565b604051806040016040528060008152602001600081525090565b60405180608001604052806004906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004905b610e43610dd6565b815260200190600190039081610e3b5790505090565b60405180608001604052806004905b610e70610ea4565b815260200190600190039081610e685790505090565b60405180602001604052806001906020820280368337509192915050565b6040518060400160405280610eb7610ef1565b8152602001610d8a610ef1565b6040518060e001604052806007905b610edb610dd6565b815260200190600190039081610ed35790505090565b6040518060400160405280600290602082028036833750919291505056fe76657269666965722d70726f6f662d656c656d656e742d6774652d7072696d652d71a264697066735822122078a9d93eb33f45c085dd87b34fb95f2f2b2f6b782123dacce4b1825011b8eabf64736f6c63430006060033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.