Contract 0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd69

Contract Overview

Balance:
0.4234737 Ether
TxHash Block Age From To Value [TxFee]
0x0aaa7da0e995551773ded9f7b2721da273e34bb72cbbec1734f34b8913956f983375825290 days 13 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00077808
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x59c4372aab97578c498f684557de2a1b9a8702edd6ee36a57141fd35b353ddd83198676317 days 8 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x9a0543b71f32e39b398e31e99a462c120b17539a1a5f7159cc8d8a87c4de2f773198130317 days 10 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246088
0xaa6ee432eab7791b3dc01965e8117fc60a5489e6dcd5c58c31e995cc0fe1469f3197580317 days 12 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x0b61624b7cf81223b0be0c5f7d4f40b89b2dfe372721584b185a72fc8df6655a3197024317 days 14 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0xd0e4c91986764c919d6d08fa2a69ab50f7faedd5b0b9e2e6f953eb5208b02b583196451317 days 16 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246088
0x482f97deb87165a9dab3a439d6f4154e3cfcbc2ba0e5ef60926f4f642178b3743195898317 days 18 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0xd6a202b04b2a2851523593514f5d3b167c9731cc2020a21776ad9d1b060895053195288317 days 20 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0xa6d65cdebfc6bad47a5b61c7d11fce2b6ab0e33e78f5d1de25075f28b31b9e703194748317 days 22 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0xa6ff8290c0341ed28872490181251be799d86cce512a70a2b16f535e9827f7843194194318 days 23 mins ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0xafbe8c45e6c4ac3c43f146ab188fd0580d79d6d314728869055585c1b1a16fef3193651318 days 2 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x506e5248a290729df5ea284440032bac9414b2cb677bb3dd9bd7b970206d91743193090318 days 4 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0xefa174e2539b921b7b400d00ee55dd4c48ea496d1653467d914ffef4ffb51cc33192548318 days 6 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x498a6b4a1b5ca8af519ee546150c9d5c7f5508300561e538e7ec2c16102cfdf43191976318 days 8 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x43d5181bd185bdfa20aec64c904f2a0b071866b0e998831c4d933639c592feb43191440318 days 10 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x60d34ca2e27a7c1a89f1c511470eada0cf4223fb51980b1c54c43b6e687d82563190905318 days 12 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.00246216
0x951ff0e2f06caacbeaee3f393379645e95be590681d10388ea985f3e062a2e953190367318 days 14 hrs ago0x7115253ec0a6d61e294e6b035942bf32ebe7e8a5 IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690.5 Ether0.000125772
0x599e5e10d3914cea4a42e8544f1946d835533b9f05621b792c846d85866d105d3190364318 days 14 hrs ago0x7115253ec0a6d61e294e6b035942bf32ebe7e8a5 IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.000043416
0xaa03f0edd6a2be913526a588a924451330c3203ca8c71594c1840c4d0b2985383190245318 days 14 hrs ago0xdc8f20170c0946accf9627b3eb1513cfd1c0499f IN  0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690 Ether0.004
0xcfc388428751b2b669ab67dfbf3700e432f3d744f8d9c4a8f9b24a2abd1ce6573190239318 days 14 hrs ago0x7115253ec0a6d61e294e6b035942bf32ebe7e8a5 IN  Contract Creation0 Ether0.0002896133
[ Download CSV Export 

Latest 25 internal transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0x0aaa7da0e995551773ded9f7b2721da273e34bb72cbbec1734f34b8913956f983375825290 days 13 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x0aaa7da0e995551773ded9f7b2721da273e34bb72cbbec1734f34b8913956f983375825290 days 13 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400.0040277 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690x280f5d232e31b2df45bd953b2f834aad9f00d3530 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x3da68e25af651269bf71dbfb9fe01ebaacedbe6c3a2f82a67b9043244d5713293200355317 days 8 mins ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400.0040277 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690x280f5d232e31b2df45bd953b2f834aad9f00d3530 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x90cc4c1daa5f5190e77c863e79bd6b0e364ec7cd5e3d3ddd3b48c10fe3c3eb3f3199731317 days 4 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400.0040277 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xc03a2615d5efaf5f49f60b7bb6583eaec212fdf10 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690x280f5d232e31b2df45bd953b2f834aad9f00d3530 Ether
0x611e0c5e2fa97941eb9fa6a212127df13f2e27f10c38e76205c295fd6275f8203199208317 days 6 hrs ago0x1f2fd337f4dc1de9c9f0338cc9ec6546e908fd690xcbf1735aad8c4b337903cd44b419efe6538aab400 Ether
[ Download CSV Export 
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)

Contract Name:
BtcPriceProvider

Compiler Version
v0.4.23+commit.124ca40d

Optimization Enabled:
No

Runs (Optimizer):
200

Contract Source Code

pragma solidity ^0.4.0;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() {
    owner = msg.sender;
  }


  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }


  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) onlyOwner {
    if (newOwner != address(0)) {
      owner = newOwner;
    }
  }

}

// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD



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.
*/

//please import oraclizeAPI_pre0.4.sol when solidity < 0.4.0

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id);
    function queryN(uint _timestamp, string _datasource, bytes _argN) payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) payable returns (bytes32 _id);
    function getPrice(string _datasource) returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);
    function useCoupon(string _coupon);
    function setProofType(byte _proofType);
    function setConfig(bytes32 _config);
    function setCustomGasPrice(uint _gasPrice);
    function randomDS_getSessionPubKeyHash() returns(bytes32);
}
contract OraclizeAddrResolverI {
    function getAddress() returns (address _addr);
}
contract usingOraclize {
    uint constant day = 60*60*24;
    uint constant week = 60*60*24*7;
    uint constant month = 60*60*24*30;
    byte constant proofType_NONE = 0x00;
    byte constant proofType_TLSNotary = 0x10;
    byte constant proofType_Android = 0x20;
    byte constant proofType_Ledger = 0x30;
    byte constant proofType_Native = 0xF0;
    byte constant proofStorage_IPFS = 0x01;
    uint8 constant networkID_auto = 0;
    uint8 constant networkID_mainnet = 1;
    uint8 constant networkID_testnet = 2;
    uint8 constant networkID_morden = 2;
    uint8 constant networkID_consensys = 161;

    OraclizeAddrResolverI OAR;

    OraclizeI oraclize;
    modifier oraclizeAPI {
        if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) oraclize_setNetwork(networkID_auto);
        oraclize = OraclizeI(OAR.getAddress());
        _;
    }
    modifier coupon(string code){
        oraclize = OraclizeI(OAR.getAddress());
        oraclize.useCoupon(code);
        _;
    }

    function oraclize_setNetwork(uint8 networkID) internal returns(bool){
        if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet
            OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
            oraclize_setNetworkName("eth_mainnet");
            return true;
        }
        if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet
            OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
            oraclize_setNetworkName("eth_ropsten3");
            return true;
        }
        if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet
            OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e);
            oraclize_setNetworkName("eth_kovan");
            return true;
        }
        if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet
            OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48);
            oraclize_setNetworkName("eth_rinkeby");
            return true;
        }
        if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge
            OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
            return true;
        }
        if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide
            OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF);
            return true;
        }
        if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity
            OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA);
            return true;
        }
        return false;
    }

    function __callback(bytes32 myid, string result) {
        __callback(myid, result, new bytes(0));
    }
    function __callback(bytes32 myid, string result, bytes proof) {
    }
    
    function oraclize_useCoupon(string code) oraclizeAPI internal {
        oraclize.useCoupon(code);
    }

    function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){
        return oraclize.getPrice(datasource);
    }

    function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){
        return oraclize.getPrice(datasource, gaslimit);
    }
    
    function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(0, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(timestamp, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(0, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN.value(price)(0, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN.value(price)(timestamp, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];       
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN.value(price)(0, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN.value(price)(timestamp, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];       
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    
    function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_cbAddress() oraclizeAPI internal returns (address){
        return oraclize.cbAddress();
    }
    function oraclize_setProof(byte proofP) oraclizeAPI internal {
        return oraclize.setProofType(proofP);
    }
    function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal {
        return oraclize.setCustomGasPrice(gasPrice);
    }
    function oraclize_setConfig(bytes32 config) oraclizeAPI internal {
        return oraclize.setConfig(config);
    }
    
    function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){
        return oraclize.randomDS_getSessionPubKeyHash();
    }

    function getCodeSize(address _addr) constant internal returns(uint _size) {
        assembly {
            _size := extcodesize(_addr)
        }
    }

    function parseAddr(string _a) internal returns (address){
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i=2; i<2+2*20; i+=2){
            iaddr *= 256;
            b1 = uint160(tmp[i]);
            b2 = uint160(tmp[i+1]);
            if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87;
            else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55;
            else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48;
            if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
            else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55;
            else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48;
            iaddr += (b1*16+b2);
        }
        return address(iaddr);
    }

    function strCompare(string _a, string _b) internal returns (int) {
        bytes memory a = bytes(_a);
        bytes memory b = bytes(_b);
        uint minLength = a.length;
        if (b.length < minLength) minLength = b.length;
        for (uint i = 0; i < minLength; i ++)
            if (a[i] < b[i])
                return -1;
            else if (a[i] > b[i])
                return 1;
        if (a.length < b.length)
            return -1;
        else if (a.length > b.length)
            return 1;
        else
            return 0;
    }

    function indexOf(string _haystack, string _needle) internal returns (int) {
        bytes memory h = bytes(_haystack);
        bytes memory n = bytes(_needle);
        if(h.length < 1 || n.length < 1 || (n.length > h.length))
            return -1;
        else if(h.length > (2**128 -1))
            return -1;
        else
        {
            uint subindex = 0;
            for (uint i = 0; i < h.length; i ++)
            {
                if (h[i] == n[0])
                {
                    subindex = 1;
                    while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex])
                    {
                        subindex++;
                    }
                    if(subindex == n.length)
                        return int(i);
                }
            }
            return -1;
        }
    }

    function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
        for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
        for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
        for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
        return string(babcde);
    }

    function strConcat(string _a, string _b, string _c, string _d) internal returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(string _a, string _b, string _c) internal returns (string) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(string _a, string _b) internal returns (string) {
        return strConcat(_a, _b, "", "", "");
    }

    // parseInt
    function parseInt(string _a) internal returns (uint) {
        return parseInt(_a, 0);
    }

    // parseInt(parseFloat*10^_b)
    function parseInt(string _a, uint _b) internal returns (uint) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i=0; i<bresult.length; i++){
            if ((bresult[i] >= 48)&&(bresult[i] <= 57)){
                if (decimals){
                   if (_b == 0) break;
                    else _b--;
                }
                mint *= 10;
                mint += uint(bresult[i]) - 48;
            } else if (bresult[i] == 46) decimals = true;
        }
        if (_b > 0) mint *= 10**_b;
        return mint;
    }

    function uint2str(uint i) internal returns (string){
        if (i == 0) return "0";
        uint j = i;
        uint len;
        while (j != 0){
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len - 1;
        while (i != 0){
            bstr[k--] = byte(48 + i % 10);
            i /= 10;
        }
        return string(bstr);
    }
    
    function stra2cbor(string[] arr) internal returns (bytes) {
            uint arrlen = arr.length;

            // get correct cbor output length
            uint outputlen = 0;
            bytes[] memory elemArray = new bytes[](arrlen);
            for (uint i = 0; i < arrlen; i++) {
                elemArray[i] = (bytes(arr[i]));
                outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
            }
            uint ctr = 0;
            uint cborlen = arrlen + 0x80;
            outputlen += byte(cborlen).length;
            bytes memory res = new bytes(outputlen);

            while (byte(cborlen).length > ctr) {
                res[ctr] = byte(cborlen)[ctr];
                ctr++;
            }
            for (i = 0; i < arrlen; i++) {
                res[ctr] = 0x5F;
                ctr++;
                for (uint x = 0; x < elemArray[i].length; x++) {
                    // if there's a bug with larger strings, this may be the culprit
                    if (x % 23 == 0) {
                        uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
                        elemcborlen += 0x40;
                        uint lctr = ctr;
                        while (byte(elemcborlen).length > ctr - lctr) {
                            res[ctr] = byte(elemcborlen)[ctr - lctr];
                            ctr++;
                        }
                    }
                    res[ctr] = elemArray[i][x];
                    ctr++;
                }
                res[ctr] = 0xFF;
                ctr++;
            }
            return res;
        }

    function ba2cbor(bytes[] arr) internal returns (bytes) {
            uint arrlen = arr.length;

            // get correct cbor output length
            uint outputlen = 0;
            bytes[] memory elemArray = new bytes[](arrlen);
            for (uint i = 0; i < arrlen; i++) {
                elemArray[i] = (bytes(arr[i]));
                outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
            }
            uint ctr = 0;
            uint cborlen = arrlen + 0x80;
            outputlen += byte(cborlen).length;
            bytes memory res = new bytes(outputlen);

            while (byte(cborlen).length > ctr) {
                res[ctr] = byte(cborlen)[ctr];
                ctr++;
            }
            for (i = 0; i < arrlen; i++) {
                res[ctr] = 0x5F;
                ctr++;
                for (uint x = 0; x < elemArray[i].length; x++) {
                    // if there's a bug with larger strings, this may be the culprit
                    if (x % 23 == 0) {
                        uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
                        elemcborlen += 0x40;
                        uint lctr = ctr;
                        while (byte(elemcborlen).length > ctr - lctr) {
                            res[ctr] = byte(elemcborlen)[ctr - lctr];
                            ctr++;
                        }
                    }
                    res[ctr] = elemArray[i][x];
                    ctr++;
                }
                res[ctr] = 0xFF;
                ctr++;
            }
            return res;
        }
        
        
    string oraclize_network_name;
    function oraclize_setNetworkName(string _network_name) internal {
        oraclize_network_name = _network_name;
    }
    
    function oraclize_getNetworkName() internal returns (string) {
        return oraclize_network_name;
    }
    
    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
        if ((_nbytes == 0)||(_nbytes > 32)) throw;
        bytes memory nbytes = new bytes(1);
        nbytes[0] = byte(_nbytes);
        bytes memory unonce = new bytes(32);
        bytes memory sessionKeyHash = new bytes(32);
        bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
        assembly {
            mstore(unonce, 0x20)
            mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
            mstore(sessionKeyHash, 0x20)
            mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
        }
        bytes[3] memory args = [unonce, nbytes, sessionKeyHash]; 
        bytes32 queryId = oraclize_query(_delay, "random", args, _customGasLimit);
        oraclize_randomDS_setCommitment(queryId, sha3(bytes8(_delay), args[1], sha256(args[0]), args[2]));
        return queryId;
    }
    
    function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal {
        oraclize_randomDS_args[queryId] = commitment;
    }
    
    mapping(bytes32=>bytes32) oraclize_randomDS_args;
    mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified;

    function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){
        bool sigok;
        address signer;
        
        bytes32 sigr;
        bytes32 sigs;
        
        bytes memory sigr_ = new bytes(32);
        uint offset = 4+(uint(dersig[3]) - 0x20);
        sigr_ = copyBytes(dersig, offset, 32, sigr_, 0);
        bytes memory sigs_ = new bytes(32);
        offset += 32 + 2;
        sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0);

        assembly {
            sigr := mload(add(sigr_, 32))
            sigs := mload(add(sigs_, 32))
        }
        
        
        (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs);
        if (address(sha3(pubkey)) == signer) return true;
        else {
            (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs);
            return (address(sha3(pubkey)) == signer);
        }
    }

    function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) {
        bool sigok;
        
        // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH)
        bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2);
        copyBytes(proof, sig2offset, sig2.length, sig2, 0);
        
        bytes memory appkey1_pubkey = new bytes(64);
        copyBytes(proof, 3+1, 64, appkey1_pubkey, 0);
        
        bytes memory tosign2 = new bytes(1+65+32);
        tosign2[0] = 1; //role
        copyBytes(proof, sig2offset-65, 65, tosign2, 1);
        bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c";
        copyBytes(CODEHASH, 0, 32, tosign2, 1+65);
        sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey);
        
        if (sigok == false) return false;
        
        
        // Step 7: verify the APPKEY1 provenance (must be signed by Ledger)
        bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4";
        
        bytes memory tosign3 = new bytes(1+65);
        tosign3[0] = 0xFE;
        copyBytes(proof, 3, 65, tosign3, 1);
        
        bytes memory sig3 = new bytes(uint(proof[3+65+1])+2);
        copyBytes(proof, 3+65, sig3.length, sig3, 0);
        
        sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY);
        
        return sigok;
    }
    
    modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) {
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw;
        
        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (proofVerified == false) throw;
        
        _;
    }
    
    function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1;
        
        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (proofVerified == false) return 2;
        
        return 0;
    }
    
    function matchBytes32Prefix(bytes32 content, bytes prefix) internal returns (bool){
        bool match_ = true;
        
        for (var i=0; i<prefix.length; i++){
            if (content[i] != prefix[i]) match_ = false;
        }
        
        return match_;
    }

    function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){
        bool checkok;
        
        
        // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId)
        uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32;
        bytes memory keyhash = new bytes(32);
        copyBytes(proof, ledgerProofLength, 32, keyhash, 0);
        checkok = (sha3(keyhash) == sha3(sha256(context_name, queryId)));
        if (checkok == false) return false;
        
        bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2);
        copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0);
        
        
        // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1)
        checkok = matchBytes32Prefix(sha256(sig1), result);
        if (checkok == false) return false;
        
        
        // Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage.
        // This is to verify that the computed args match with the ones specified in the query.
        bytes memory commitmentSlice1 = new bytes(8+1+32);
        copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0);
        
        bytes memory sessionPubkey = new bytes(64);
        uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65;
        copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0);
        
        bytes32 sessionPubkeyHash = sha256(sessionPubkey);
        if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match
            delete oraclize_randomDS_args[queryId];
        } else return false;
        
        
        // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey)
        bytes memory tosign1 = new bytes(32+8+1+32);
        copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0);
        checkok = verifySig(sha256(tosign1), sig1, sessionPubkey);
        if (checkok == false) return false;
        
        // verify if sessionPubkeyHash was verified already, if not.. let's do it!
        if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){
            oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset);
        }
        
        return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash];
    }

    
    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal returns (bytes) {
        uint minLength = length + toOffset;

        if (to.length < minLength) {
            // Buffer too small
            throw; // Should be a better way?
        }

        // NOTE: the offset 32 is added to skip the `size` field of both bytes variables
        uint i = 32 + fromOffset;
        uint j = 32 + toOffset;

        while (i < (32 + fromOffset + length)) {
            assembly {
                let tmp := mload(add(from, i))
                mstore(add(to, j), tmp)
            }
            i += 32;
            j += 32;
        }

        return to;
    }
    
    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    // Duplicate Solidity's ecrecover, but catching the CALL return value
    function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {
        // We do our own memory management here. Solidity uses memory offset
        // 0x40 to store the current end of memory. We write past it (as
        // writes are memory extensions), but don't update the offset so
        // Solidity will reuse it. The memory used here is only needed for
        // this context.

        // FIXME: inline assembly can't access return values
        bool ret;
        address addr;

        assembly {
            let size := mload(0x40)
            mstore(size, hash)
            mstore(add(size, 32), v)
            mstore(add(size, 64), r)
            mstore(add(size, 96), s)

            // NOTE: we can reuse the request memory because we deal with
            //       the return code
            ret := call(3000, 1, 0, size, 128, size, 32)
            addr := mload(size)
        }
  
        return (ret, addr);
    }

    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) {
        bytes32 r;
        bytes32 s;
        uint8 v;

        if (sig.length != 65)
          return (false, 0);

        // The signature format is a compact form of:
        //   {bytes32 r}{bytes32 s}{uint8 v}
        // Compact means, uint8 is not padded to 32 bytes.
        assembly {
            r := mload(add(sig, 32))
            s := mload(add(sig, 64))

            // Here we are loading the last 32 bytes. We exploit the fact that
            // 'mload' will pad with zeroes if we overread.
            // There is no 'mload8' to do this, but that would be nicer.
            v := byte(0, mload(add(sig, 96)))

            // Alternative solution:
            // 'byte' is not working due to the Solidity parser, so lets
            // use the second best option, 'and'
            // v := and(mload(add(sig, 65)), 255)
        }

        // albeit non-transactional signatures are not specified by the YP, one would expect it
        // to match the YP range of [27, 28]
        //
        // geth uses [0, 1] and some clients have followed. This might change, see:
        //  https://github.com/ethereum/go-ethereum/issues/2053
        if (v < 27)
          v += 27;

        if (v != 27 && v != 28)
            return (false, 0);

        return safer_ecrecover(hash, v, r, s);
    }
        
}
// </ORACLIZE_API>

contract PriceReceiver {
  address public ethPriceProvider;

  address public btcPriceProvider;

  modifier onlyEthPriceProvider() {
    require(msg.sender == ethPriceProvider);
    _;
  }

  modifier onlyBtcPriceProvider() {
    require(msg.sender == btcPriceProvider);
    _;
  }

  function receiveEthPrice(uint ethUsdPrice) external;

  function receiveBtcPrice(uint btcUsdPrice) external;

  function setEthPriceProvider(address provider) external;

  function setBtcPriceProvider(address provider) external;
}

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
  function mul(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal constant returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

contract PriceProvider is Ownable, usingOraclize {
  using SafeMath for uint;

  enum State { Stopped, Active }

  uint public updateInterval = 7200; //2 hours by default

  uint public currentPrice;

  string public url;

  mapping (bytes32 => bool) validIds;

  PriceReceiver public watcher;

  State public state = State.Stopped;

  uint constant MIN_ALLOWED_PRICE_DIFF = 85;

  uint constant MAX_ALLOWED_PRICE_DIFF = 115;

  event TooBigPriceDiff(uint oldValue, uint newValue);

  event InsufficientFunds();

  function notifyWatcher() internal;

  modifier inActiveState() {
    require(state == State.Active);
    _;
  }

  modifier inStoppedState() {
    require(state == State.Stopped);
    _;
  }

  function PriceProvider(string _url) {
    url = _url;

    //update immediately first time to be sure everything is working - first oraclize request is free.
    update(0);
  }

  //send some funds along with the call to cover oraclize fees
  function startUpdate(uint startingPrice) payable onlyOwner inStoppedState {
    state = State.Active;

    //we can set starting price manually, contract will notify watcher only in case of allowed diff
    //so owner can't set too small or to big price anyway
    currentPrice = startingPrice;
    update(updateInterval);
  }

  function stopUpdate() external onlyOwner inActiveState {
    state = State.Stopped;
  }

  function setWatcher(address newWatcher) external onlyOwner {
    require(newWatcher != 0x0);
    watcher = PriceReceiver(newWatcher);
  }

  function setUpdateInterval(uint newInterval) external onlyOwner {
    require(newInterval > 0);
    updateInterval = newInterval;
  }

  function setUrl(string newUrl) external onlyOwner {
    require(bytes(newUrl).length > 0);
    url = newUrl;
  }

  function __callback(bytes32 myid, string result, bytes proof) {
    require(msg.sender == oraclize_cbAddress() && validIds[myid]);
    delete validIds[myid];

    uint newPrice = parseInt(result, 2);
    require(newPrice > 0);
    uint changeInPercents = newPrice.mul(100).div(currentPrice);

    if (changeInPercents >= MIN_ALLOWED_PRICE_DIFF && changeInPercents <= MAX_ALLOWED_PRICE_DIFF) {
      currentPrice = newPrice;

      if (state == State.Active) {
        notifyWatcher();
        update(updateInterval);
      }
    } else {
      state = State.Stopped;
      TooBigPriceDiff(currentPrice, newPrice);
    }
  }

  function update(uint delay) private {
    if (oraclize_getPrice("URL") > this.balance) {
      //stop if we don't have enough funds anymore
      state = State.Stopped;
      InsufficientFunds();
    } else {
      bytes32 queryId = oraclize_query(delay, "URL", url);
      validIds[queryId] = true;
    }
  }

  //we need to get back our funds if we don't need this oracle anymore
  function withdraw(address receiver) external onlyOwner inStoppedState {
    require(receiver != 0x0);
    receiver.transfer(this.balance);
  }
}

contract BtcPriceProvider is PriceProvider {
  function BtcPriceProvider() PriceProvider("json(https://api.kraken.com/0/public/Ticker?pair=XBTUSD).result.XXBTZUSD.c.0") {

  }

  function notifyWatcher() internal {
    watcher.receiveBtcPrice(currentPrice);
  }
}

Contract ABI

[{"constant":false,"inputs":[{"name":"startingPrice","type":"uint256"}],"name":"startUpdate","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"newWatcher","type":"address"}],"name":"setWatcher","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newUrl","type":"string"}],"name":"setUrl","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"url","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newInterval","type":"uint256"}],"name":"setUpdateInterval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"stopUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"state","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"watcher","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"updateInterval","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldValue","type":"uint256"},{"indexed":false,"name":"newValue","type":"uint256"}],"name":"TooBigPriceDiff","type":"event"},{"anonymous":false,"inputs":[],"name":"InsufficientFunds","type":"event"}]

Contract Creation Code

6080604052611c206006556000600a60146101000a81548160ff021916908360018111156200002a57fe5b02179055503480156200003c57600080fd5b50608060405190810160405280604c81526020017f6a736f6e2868747470733a2f2f6170692e6b72616b656e2e636f6d2f302f707581526020017f626c69632f5469636b65723f706169723d584254555344292e726573756c742e81526020017f585842545a5553442e632e300000000000000000000000000000000000000000815250336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600890805190602001906200011892919062001063565b506200013460006200013b640100000000026401000000009004565b5062001112565b60003073ffffffffffffffffffffffffffffffffffffffff1631620001a46040805190810160405280600381526020017f55524c00000000000000000000000000000000000000000000000000000000008152506200032c640100000000026401000000009004565b111562000202576000600a60146101000a81548160ff02191690836001811115620001cb57fe5b02179055507f356680b7a9f05bb37583d674b7e01e0ae48f613276c56b1a670839f3c9f392c960405160405180910390a162000328565b620002f1826040805190810160405280600381526020017f55524c000000000000000000000000000000000000000000000000000000000081525060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015620002d75780601f10620002ab57610100808354040283529160200191620002d7565b820191906000526020600020905b815481529060010190602001808311620002b957829003601f168201915b505050505062000615640100000000026401000000009004565b9050600160096000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480620003b057506000620003ae600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1662000adb640100000000026401000000009004565b145b15620003d357620003d1600062000ae6640100000000026401000000009004565b505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156200045a57600080fd5b505af11580156200046f573d6000803e3d6000fd5b505050506040513d60208110156200048657600080fd5b8101908080519060200190929190505050600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663524f3889836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200058357808201518184015260208101905062000566565b50505050905090810190601f168015620005b15780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015620005d157600080fd5b505af1158015620005e6573d6000803e3d6000fd5b505050506040513d6020811015620005fd57600080fd5b81019080805190602001909291905050509050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806200069b5750600062000699600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1662000adb640100000000026401000000009004565b145b15620006be57620006bc600062000ae6640100000000026401000000009004565b505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156200074557600080fd5b505af11580156200075a573d6000803e3d6000fd5b505050506040513d60208110156200077157600080fd5b8101908080519060200190929190505050600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663524f3889856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200086e57808201518184015260208101905062000851565b50505050905090810190601f1680156200089c5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015620008bc57600080fd5b505af1158015620008d1573d6000803e3d6000fd5b505050506040513d6020811015620008e857600080fd5b8101908080519060200190929190505050905062030d403a02670de0b6b3a76400000181111562000920576000600102915062000ad3565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adf59f99828787876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015620009d9578082015181840152602081019050620009bc565b50505050905090810190601f16801562000a075780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101562000a4257808201518184015260208101905062000a25565b50505050905090810190601f16801562000a705780820380516001836020036101000a031916815260200191505b50955050505050506020604051808303818588803b15801562000a9257600080fd5b505af115801562000aa7573d6000803e3d6000fd5b50505050506040513d602081101562000abf57600080fd5b810190808051906020019092919050505091505b509392505050565b6000813b9050919050565b60008062000b17731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed62000adb640100000000026401000000009004565b111562000bcc57731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000bc26040805190810160405280600b81526020017f6574685f6d61696e6e657400000000000000000000000000000000000000000081525062001047640100000000026401000000009004565b6001905062001042565b600062000bfc73c03a2615d5efaf5f49f60b7bb6583eaec212fdf162000adb640100000000026401000000009004565b111562000cb15773c03a2615d5efaf5f49f60b7bb6583eaec212fdf1600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000ca76040805190810160405280600c81526020017f6574685f726f707374656e33000000000000000000000000000000000000000081525062001047640100000000026401000000009004565b6001905062001042565b600062000ce173b7a07bcf2ba2f2703b24c0691b5278999c59ac7e62000adb640100000000026401000000009004565b111562000d965773b7a07bcf2ba2f2703b24c0691b5278999c59ac7e600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000d8c6040805190810160405280600981526020017f6574685f6b6f76616e000000000000000000000000000000000000000000000081525062001047640100000000026401000000009004565b6001905062001042565b600062000dc673146500cfd35b22e4a392fe0adc06de1a1368ed4862000adb640100000000026401000000009004565b111562000e7b5773146500cfd35b22e4a392fe0adc06de1a1368ed48600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000e716040805190810160405280600b81526020017f6574685f72696e6b65627900000000000000000000000000000000000000000081525062001047640100000000026401000000009004565b6001905062001042565b600062000eab736f485c8bf6fc43ea212e93bbf8ce046c7f1cb47562000adb640100000000026401000000009004565b111562000f1157736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905062001042565b600062000f417320e12a1f859b3feae5fb2a0a32c18f5a65555bbf62000adb640100000000026401000000009004565b111562000fa7577320e12a1f859b3feae5fb2a0a32c18f5a65555bbf600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905062001042565b600062000fd77351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa62000adb640100000000026401000000009004565b11156200103d577351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905062001042565b600090505b919050565b80600390805190602001906200105f92919062001063565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620010a657805160ff1916838001178555620010d7565b82800160010185558215620010d7579182015b82811115620010d6578251825591602001919060010190620010b9565b5b509050620010e69190620010ea565b5090565b6200110f91905b808211156200110b576000816000905550600101620010f1565b5090565b90565b6122c780620011226000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063211b4f54146100e057806324f48bc514610100578063252498a21461014357806327dc297e1461017e57806338bbfa50146101f557806351cff8d9146102b25780635600f04f146102f55780637124c6831461038557806377bf9776146103b25780638da5cb5b146103c95780639d1b464a14610420578063c19d93fb1461044b578063d6b7486514610484578063f2fde38b146104db578063fd2c80ae1461051e575b600080fd5b6100fe60048036038101908080359060200190929190505050610549565b005b34801561010c57600080fd5b50610141600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610611565b005b34801561014f57600080fd5b5061017c6004803603810190808035906020019082018035906020019190919293919293905050506106d6565b005b34801561018a57600080fd5b506101f36004803603810190808035600019169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610759565b005b34801561020157600080fd5b506102b06004803603810190808035600019169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061079c565b005b3480156102be57600080fd5b506102f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610953565b005b34801561030157600080fd5b5061030a610a69565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561034a57808201518184015260208101905061032f565b50505050905090810190601f1680156103775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039157600080fd5b506103b060048036038101908080359060200190929190505050610b07565b005b3480156103be57600080fd5b506103c7610b7b565b005b3480156103d557600080fd5b506103de610c2f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042c57600080fd5b50610435610c54565b6040518082815260200191505060405180910390f35b34801561045757600080fd5b50610460610c5a565b6040518082600181111561047057fe5b60ff16815260200191505060405180910390f35b34801561049057600080fd5b50610499610c6d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e757600080fd5b5061051c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c93565b005b34801561052a57600080fd5b50610533610d68565b6040518082815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105a457600080fd5b600060018111156105b157fe5b600a60149054906101000a900460ff1660018111156105cc57fe5b1415156105d857600080fd5b6001600a60146101000a81548160ff021916908360018111156105f757fe5b02179055508060078190555061060e600654610d6e565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066c57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561069257600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561073157600080fd5b60008282905011151561074357600080fd5b818160089190610754929190612176565b505050565b610798828260006040519080825280601f01601f1916602001820160405280156107925781602001602082028038833980820191505090505b5061079c565b5050565b6000806107a7610f36565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148015610806575060096000866000191660001916815260200190815260200160002060009054906101000a900460ff165b151561081157600080fd5b60096000866000191660001916815260200190815260200160002060006101000a81549060ff0219169055610847846002611180565b915060008211151561085857600080fd5b61088060075461087260648561147490919063ffffffff16565b6114a790919063ffffffff16565b905060558110158015610894575060738111155b156108e657816007819055506001808111156108ac57fe5b600a60149054906101000a900460ff1660018111156108c757fe5b14156108e1576108d56114c2565b6108e0600654610d6e565b5b61094c565b6000600a60146101000a81548160ff0219169083600181111561090557fe5b02179055507fc9762f8f5ed72058cdca40f46df666f2d40da3e2c07684e1f996bfd1d5b5850e60075483604051808381526020018281526020019250505060405180910390a15b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109ae57600080fd5b600060018111156109bb57fe5b600a60149054906101000a900460ff1660018111156109d657fe5b1415156109e257600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515610a0857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610a65573d6000803e3d6000fd5b5050565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b6257600080fd5b600081111515610b7157600080fd5b8060068190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bd657600080fd5b600180811115610be257fe5b600a60149054906101000a900460ff166001811115610bfd57fe5b141515610c0957600080fd5b6000600a60146101000a81548160ff02191690836001811115610c2857fe5b0217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b600a60149054906101000a900460ff1681565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cee57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610d6557806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60065481565b60003073ffffffffffffffffffffffffffffffffffffffff1631610dc66040805190810160405280600381526020017f55524c000000000000000000000000000000000000000000000000000000000081525061156f565b1115610e21576000600a60146101000a81548160ff02191690836001811115610deb57fe5b02179055507f356680b7a9f05bb37583d674b7e01e0ae48f613276c56b1a670839f3c9f392c960405160405180910390a1610f32565b610efb826040805190810160405280600381526020017f55524c000000000000000000000000000000000000000000000000000000000081525060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ef15780601f10610ec657610100808354040283529160200191610ef1565b820191906000526020600020905b815481529060010190602001808311610ed457829003601f168201915b505050505061182b565b9050600160096000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610fa857506000610fa6600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611cb9565b145b15610fb957610fb76000611cc4565b505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561103f57600080fd5b505af1158015611053573d6000803e3d6000fd5b505050506040513d602081101561106957600080fd5b8101908080519060200190929190505050600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c281d19e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561114057600080fd5b505af1158015611154573d6000803e3d6000fd5b505050506040513d602081101561116a57600080fd5b8101908080519060200190929190505050905090565b6000606060008060008693506000925060009150600090505b83518110156114555760307f01000000000000000000000000000000000000000000000000000000000000000284828151811015156111d457fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156112ec575060397f010000000000000000000000000000000000000000000000000000000000000002848281518110151561127c57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b1561139d57811561130f57600086141561130557611455565b8580600190039650505b600a830292506030848281518110151561132557fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090040383019250611448565b602e7f01000000000000000000000000000000000000000000000000000000000000000284828151811015156113cf57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561144757600191505b5b8080600101915050611199565b60008611156114675785600a0a830292505b8294505050505092915050565b60008082840290506000841480611495575082848281151561149257fe5b04145b151561149d57fe5b8091505092915050565b60008082848115156114b557fe5b0490508091505092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633c8d284b6007546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561155557600080fd5b505af1158015611569573d6000803e3d6000fd5b50505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806115e1575060006115df600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611cb9565b145b156115f2576115f06000611cc4565b505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561167857600080fd5b505af115801561168c573d6000803e3d6000fd5b505050506040513d60208110156116a257600080fd5b8101908080519060200190929190505050600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663524f3889836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561179d578082015181840152602081019050611782565b50505050905090810190601f1680156117ca5780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156117e957600080fd5b505af11580156117fd573d6000803e3d6000fd5b505050506040513d602081101561181357600080fd5b81019080805190602001909291905050509050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061189f5750600061189d600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611cb9565b145b156118b0576118ae6000611cc4565b505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b505050506040513d602081101561196057600080fd5b8101908080519060200190929190505050600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663524f3889856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a5b578082015181840152602081019050611a40565b50505050905090810190601f168015611a885780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015611aa757600080fd5b505af1158015611abb573d6000803e3d6000fd5b505050506040513d6020811015611ad157600080fd5b8101908080519060200190929190505050905062030d403a02670de0b6b3a764000001811115611b075760006001029150611cb1565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adf59f99828787876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015611bbe578082015181840152602081019050611ba3565b50505050905090810190601f168015611beb5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611c24578082015181840152602081019050611c09565b50505050905090810190601f168015611c515780820380516001836020036101000a031916815260200191505b50955050505050506020604051808303818588803b158015611c7257600080fd5b505af1158015611c86573d6000803e3d6000fd5b50505050506040513d6020811015611c9d57600080fd5b810190808051906020019092919050505091505b509392505050565b6000813b9050919050565b600080611ce4731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed611cb9565b1115611d8657731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d7d6040805190810160405280600b81526020017f6574685f6d61696e6e657400000000000000000000000000000000000000000081525061215c565b60019050612157565b6000611da573c03a2615d5efaf5f49f60b7bb6583eaec212fdf1611cb9565b1115611e475773c03a2615d5efaf5f49f60b7bb6583eaec212fdf1600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611e3e6040805190810160405280600c81526020017f6574685f726f707374656e33000000000000000000000000000000000000000081525061215c565b60019050612157565b6000611e6673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e611cb9565b1115611f085773b7a07bcf2ba2f2703b24c0691b5278999c59ac7e600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611eff6040805190810160405280600981526020017f6574685f6b6f76616e000000000000000000000000000000000000000000000081525061215c565b60019050612157565b6000611f2773146500cfd35b22e4a392fe0adc06de1a1368ed48611cb9565b1115611fc95773146500cfd35b22e4a392fe0adc06de1a1368ed48600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611fc06040805190810160405280600b81526020017f6574685f72696e6b65627900000000000000000000000000000000000000000081525061215c565b60019050612157565b6000611fe8736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475611cb9565b111561204c57736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050612157565b600061206b7320e12a1f859b3feae5fb2a0a32c18f5a65555bbf611cb9565b11156120cf577320e12a1f859b3feae5fb2a0a32c18f5a65555bbf600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050612157565b60006120ee7351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa611cb9565b1115612152577351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050612157565b600090505b919050565b80600390805190602001906121729291906121f6565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106121b757803560ff19168380011785556121e5565b828001600101855582156121e5579182015b828111156121e45782358255916020019190600101906121c9565b5b5090506121f29190612276565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061223757805160ff1916838001178555612265565b82800160010185558215612265579182015b82811115612264578251825591602001919060010190612249565b5b5090506122729190612276565b5090565b61229891905b8082111561229457600081600090555060010161227c565b5090565b905600a165627a7a7230582060cbbf54da5389df803d66a82979608ccd17bb5c2142ddcec69427a4a9292cec0029

Swarm Source

bzzr://60cbbf54da5389df803d66a82979608ccd17bb5c2142ddcec69427a4a9292cec
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward