Sponsored Link:   ARNA Genomics - FIRST BLOCKCHAIN BIOTECH ECOSYSTEM. Join ICO Now!
Contract Overview
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 1 txn
  Latest 1 txn

TxHash Age From To Value [TxFee]
0x269b89eff286a14aa3a536366a3932e107573b5ac58cc7e36ed3099229776b66425 days 1 hr ago0x79f09717c5b352078234832e5737651ddb333548  IN    Contract Creation0 Ether0.0087323
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Contract Name: EC
Compiler Version: v0.4.2+commit.af6afb04
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.2;

contract EC {

    uint256 constant gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798;
    uint256 constant gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8;
    uint256 constant n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F;
    uint256 constant a = 0;
    uint256 constant b = 7;

    function EC()
    {
    }

    function _jAdd( uint256 x1,uint256 z1,
                    uint256 x2,uint256 z2) constant
        returns(uint256 x3,uint256 z3)
    {
        (x3, z3) = (  addmod( mulmod(z2, x1 , n) ,
                              mulmod(x2, z1 , n),
                              n),
                      mulmod(z1, z2 , n)
                    );
    }

    function _jSub( uint256 x1,uint256 z1,
                    uint256 x2,uint256 z2) constant
        returns(uint256 x3,uint256 z3)
    {
        (x3, z3) = (  addmod( mulmod(z2, x1, n),
                              mulmod(n - x2, z1, n),
                              n),
                      mulmod(z1, z2 , n)
                    );
    }

    function _jMul( uint256 x1,uint256 z1,
                    uint256 x2,uint256 z2) constant
        returns(uint256 x3,uint256 z3)
    {
        (x3, z3) = (  mulmod(x1, x2 , n), mulmod(z1, z2 , n));
    }

    function _jDiv( uint256 x1,uint256 z1,
                    uint256 x2,uint256 z2) constant
        returns(uint256 x3,uint256 z3)
    {
        (x3, z3) = (  mulmod(x1, z2 , n), mulmod(z1 , x2 , n));
    }

    function _inverse( uint256 a) constant
        returns(uint256 invA)
    {
        uint256 t=0;
        uint256 newT=1;
        uint256 r=n;
        uint256 newR=a;
        uint256 q;
        while (newR != 0) {
            q = r / newR;

            (t, newT) = (newT, addmod(t , (n - mulmod(q, newT,n)) , n));
            (r, newR) = (newR, r - q * newR );
        }

        return t;
    }


    function _ecAdd( uint256 x1,uint256 y1,uint256 z1,
                    uint256 x2,uint256 y2,uint256 z2) constant
        returns(uint256 x3,uint256 y3,uint256 z3)
    {
        uint256 l;
        uint256 lz;
        uint256 da;
        uint256 db;

        if ((x1==0)&&(y1==0)) {
            return (x2,y2,z2);
        }

        if ((x2==0)&&(y2==0)) {
            return (x1,y1,z1);
        }

        if ((x1==x2)&&(y1==y2)) {
            (l,lz) = _jMul(x1, z1, x1, z1);
            (l,lz) = _jMul(l, lz, 3, 1);
            (l,lz) = _jAdd(l, lz, a, 1);

            (da,db) = _jMul(y1, z1, 2, 1);
        } else {
            (l,lz) = _jSub(y2, z2, y1, z1);
            (da,db)  = _jSub(x2, z2, x1, z1);
        }

        (l, lz) = _jDiv(l, lz, da, db);


        (x3, da) = _jMul(l, lz, l, lz);
        (x3, da) = _jSub(x3, da, x1, z1);
        (x3, da) = _jSub(x3, da, x2, z2);

        (y3, db) = _jSub(x1, z1, x3, da);
        (y3, db) = _jMul(y3, db, l, lz );
        (y3, db) = _jSub(y3, db, y1, z1 );


        if (da != db) {
            x3 = mulmod(x3, db, n);
            y3 = mulmod(y3, da, n);
            z3 = mulmod(da, db, n);
        } else {
            z3 = da;
        }

    }

    function _ecDouble(uint256 x1,uint256 y1,uint256 z1) constant
        returns(uint256 x3,uint256 y3,uint256 z3)
    {
        (x3,y3,z3) = _ecAdd(x1,y1,z1,x1,y1,z1);
    }



    function _ecMul(uint256 d, uint256 x1,uint256 y1,uint256 z1) constant
        returns(uint256 x3,uint256 y3,uint256 z3)
    {
        uint256 remaining = d;
        uint256 px = x1;
        uint256 py = y1;
        uint256 pz = z1;
        uint256 acx = 0;
        uint256 acy = 0;
        uint256 acz = 1;

        if (d==0) {
            return (0,0,1);
        }

        while (remaining != 0) {
            if ((remaining & 1) != 0) {
                (acx,acy,acz) = _ecAdd(acx,acy,acz, px,py,pz);
            }
            remaining = remaining / 2;
            (px,py,pz) = _ecDouble(px,py,pz);
        }

        (x3,y3,z3) = (acx,acy,acz);
    }

    function publicKey(uint256 privKey) constant
        returns(uint256 qx, uint256 qy)
    {
        uint256 x;
        uint256 y;
        uint256 z;
        (x,y,z) = _ecMul(privKey, gx, gy, 1);
        z = _inverse(z);
        qx = mulmod(x , z ,n);
        qy = mulmod(y , z ,n);
    }

    function deriveKey(uint256 privKey, uint256 pubX, uint256 pubY) constant
        returns(uint256 qx, uint256 qy)
    {
        uint256 x;
        uint256 y;
        uint256 z;
        (x,y,z) = _ecMul(privKey, pubX, pubY, 1);
        z = _inverse(z);
        qx = mulmod(x , z ,n);
        qy = mulmod(y , z ,n);
    }

}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jAdd","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jSub","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jMul","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jDiv","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"privKey","type":"uint256"}],"name":"publicKey","outputs":[{"name":"qx","type":"uint256"},{"name":"qy","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"}],"name":"_inverse","outputs":[{"name":"invA","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"d","type":"uint256"},{"name":"x1","type":"uint256"},{"name":"y1","type":"uint256"},{"name":"z1","type":"uint256"}],"name":"_ecMul","outputs":[{"name":"x3","type":"uint256"},{"name":"y3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"y1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"y2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_ecAdd","outputs":[{"name":"x3","type":"uint256"},{"name":"y3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"privKey","type":"uint256"},{"name":"pubX","type":"uint256"},{"name":"pubY","type":"uint256"}],"name":"deriveKey","outputs":[{"name":"qx","type":"uint256"},{"name":"qy","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"y1","type":"uint256"},{"name":"z1","type":"uint256"}],"name":"_ecDouble","outputs":[{"name":"x3","type":"uint256"},{"name":"y3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"type":"constructor"}]

  Contract Creation Code Switch To Opcodes View
60606040526105ab806100126000396000f3606060405236156100825760e060020a60003504630138e31b81146100875780631ecfe64d146100a05780635b764811146100b95780635f972df8146100d25780638940aebe146100eb5780638cecf66e14610165578063913f424c14610175578063db3188331461018e578063e241c1d9146101ad578063f47289e1146101d5575b610002565b3461000257610228600435602435604435606435610250565b346100025761022860043560243560443560643561028f565b34610002576102286004356024356044356064356102dd565b3461000257610228600435602435604435606435610310565b346100025761022860043560006000600060006000610347867f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b860015b6000808086868686848060018682141561040c579650866103f3565b3461000257610335600435610353565b346100025761039d600435602435604435606435610149565b346100025761039d60043560243560443560643560843560a4356101f7565b3461000257610228600435602435604435600060006000600060006105678888886001610149565b346100025761039d6004356024356044355b60006000600061059c8686868989895b60006000600060006000600060008c600014801561021557508b6000145b1561044657898989965096509650610557565b6040805192835260208301919091528051918290030190f35b90945092506104888484600060015b600060006401000003d0196401000003d0198686096401000003d019888609086401000003d0198487099097909650945050505050565b6104a589898e8e5b600060006401000003d0196401000003d01986866401000003d01903096401000003d019888609086401000003d0198487099097909650945050505050565b90945092506102418484600360015b600060006401000003d0198487096401000003d0198487099097909650945050505050565b90925090505b6104b6848484845b600060006401000003d0198387096401000003d0198587099097909650945050505050565b60408051918252519081900360200190f35b919450925090506103bb815b60008060016401000003d01984835b600082146103dd578183811561000257049050836401000003d019808284096401000003d01903870890955093509091818302900390610362565b60408051938452602084019290925282820152519081900360600190f35b90506401000003d01981840994506401000003d0198183099350505050915091565b509295945050505050565b919850965094508686865b505050505050509450945094915050565b919750955093505b600087146103e857600187166000146104355761042d8383838989896101f7565b919450925090505b6002870496506104048686866101e7565b8960001480156104565750886000145b15610469578c8c8c965096509650610557565b898d1480156104775750888c145b15610287576102ce8d8c8f8e6102dd565b909450925061049b8c8c600260016102dd565b9092509050610308565b90945092506103028a898f8e61028f565b90945092506104c7848481816102dd565b90975091506104d887838f8e61028f565b90975091506104e987838c8b61028f565b90975091506104fa8d8c898561028f565b909650905061050b868286866102dd565b909650905061051c86828e8e61028f565b9096509050818114610551576401000003d01981880996506401000003d01982870995506401000003d0198183099450610557565b81945084505b5050505096509650969350505050565b9194509250905061057781610353565b90506401000003d01981840994506401000003d0198183099350505050935093915050565b9198909750909550935050505056
View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.