Contract Overview
ETH Balance: 0.043282263 Ether ($2.19)
Mined:  0
No Of Transactions: 34 txns + 48 internalTxns
  Latest 25 txns from a total Of 34 transactions View All

TxHash Block Age From To Value [TxFee]
0xb2bbcb11f3406d4fcd74b35dbed859807da3e783cb3cce7b7e4ca0efc06f94131278878354 days 23 hrs ago0xdce0898b0fb2d632d6ef53d88343ce7806b1867d  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x5a7cf80165ea656b1819af54050c36ca6b12a4e1c57027bafc10f4d5775fb6411263256357 days 13 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00113624
0x2d9d01e41f4d74ea4860856246f294deb442de4f17f4d4e36aaf305c561fbb0e1263251357 days 13 hrs ago0x321b1435016a7d3cf199c68f626af70772efc34e  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.0035673
0x7e9b30bbc299ae845eed0f4bc594d577ffa4169b7d3b9e9008492f04ec241b451263245357 days 13 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00125926
0xec0325b5bdee24175191316b4cfdb083f5386da180a1c6dae48a101410dc29dc1263243357 days 13 hrs ago0x321b1435016a7d3cf199c68f626af70772efc34e  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.0035673
0x6801661c18a74763f4034268cf015d9b275edde34a336a5f7deb279efaa1edf11261665357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.0011385
0x0e05e47c794ba98aad1f7143f27a6b5b9fd5415379bd6ced91726dfea72316d81261662357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x2579ab6b3004280fcecbec9502ec1274b062db0a72df20268ecc639869f70a261261655357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00113868
0x89c6383a02a5c66592878ad139b9fdea9fefa47d95186552605103968d6c8cfd1261653357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0xd0a2386f387cc2265fc9d255d1529c0daf39f217236b732ef6fcedec1a397b461261640357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00143648
0x9b1f286fc1eeb4472037619e4b1367100d5f390ddd20a3fc6b4657f7c40bd19c1261638357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x7aac8aff845735f14216424d8241f5907d04939571c1283b54704532eb715cb91261632357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00083554
0xb5230f7fc7333e505f685b831632905c8e120d7c67610e5222ba0adf9fa7c4df1261630357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x14acafe96b858ffb9cd1ebc410c63f6e76e1a7783c9be23a7f8470902f2808ea1261626357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00113538
0x4dd187a998b4a328650063842034992bd4b7278300472be0604e6d32187684441261624357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x00e7abe0f16a883b10507cda2188c84bd96a1c6a065833bc15f948728c7aa1591261614357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00113428
0xa90a9143d1a1294ed25f3059e9c7199069e99200c58d97a046cb57508d2c1cf51261612357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0xf6f10665a46b2bf13b015619d2c197fc8b1b7c6bedf3a1400bf8d9b2f5f2ac0c1261573357 days 19 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00143972
0x90b993e5aba7c3b1a25161ceb4a19ac4cebfc9b32314ad6efe2eefe2a1a25d991261571357 days 19 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x673dcbc926c17c7d5c312a54e8352a13047d3a01a611c1b0c782b08fc6da9a661261533357 days 20 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00087017
0xc296703cfbc646b040ccd0f8473e259e19e7af7ccf8e2ac0d6745e4eef248db21261530357 days 20 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x90f9c2eab6bcd1731fdeba8be6c7cf954acb1c17015f4c0fefb39966913558e21261518357 days 20 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00113312
0xfaea745adf0573a858ad6a3fe21c6a2d87e5c0de9d310af0a97535084cfb63f21261516357 days 20 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692
0x11b54a91f7b8319c1cfa1662760c27e092a3d35d8a63e1d713bd7a1670cd72d41261491357 days 20 hrs agoOraclize  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10 Ether0.00113966
0xa7b0510a9045f2e1cebc60fc46cc8aa02eaacb35d16d69ebc0b4d020a6ce89201261489357 days 20 hrs ago0x5c3e1e43a4fd3ef8e7351072f090b1f4b08ed4c3  IN   0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10.05 Ether0.00142692

[Download: CSV Export ]    
 Internal Transactions as a result of Contract Execution
  Latest 25 Internal Txns from a total of 48 View All
ParentTxHash Block Age From To Value
0xb2bbcb11f3406d4fcd74b35dbed859807da3e783cb3cce7b7e4ca0efc06f94131278878354 days 23 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.00671773650119437 Ether
0x5a7cf80165ea656b1819af54050c36ca6b12a4e1c57027bafc10f4d5775fb6411263256357 days 13 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033662503114617213 Ether
0x5a7cf80165ea656b1819af54050c36ca6b12a4e1c57027bafc10f4d5775fb6411263256357 days 13 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003740278123846357 Ether
0x2d9d01e41f4d74ea4860856246f294deb442de4f17f4d4e36aaf305c561fbb0e1263251357 days 13 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01259721876153643 Ether
0x7e9b30bbc299ae845eed0f4bc594d577ffa4169b7d3b9e9008492f04ec241b451263245357 days 13 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033662503114617213 Ether
0x7e9b30bbc299ae845eed0f4bc594d577ffa4169b7d3b9e9008492f04ec241b451263245357 days 13 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003740278123846357 Ether
0xec0325b5bdee24175191316b4cfdb083f5386da180a1c6dae48a101410dc29dc1263243357 days 13 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01259721876153643 Ether
0x6801661c18a74763f4034268cf015d9b275edde34a336a5f7deb279efaa1edf11261665357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033637795349990715 Ether
0x6801661c18a74763f4034268cf015d9b275edde34a336a5f7deb279efaa1edf11261665357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003737532816665635 Ether
0x0e05e47c794ba98aad1f7143f27a6b5b9fd5415379bd6ced91726dfea72316d81261662357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01262467183334365 Ether
0x2579ab6b3004280fcecbec9502ec1274b062db0a72df20268ecc639869f70a261261655357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033637795349990715 Ether
0x2579ab6b3004280fcecbec9502ec1274b062db0a72df20268ecc639869f70a261261655357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003737532816665635 Ether
0x89c6383a02a5c66592878ad139b9fdea9fefa47d95186552605103968d6c8cfd1261653357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01262467183334365 Ether
0xd0a2386f387cc2265fc9d255d1529c0daf39f217236b732ef6fcedec1a397b461261640357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033637795349990715 Ether
0xd0a2386f387cc2265fc9d255d1529c0daf39f217236b732ef6fcedec1a397b461261640357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003737532816665635 Ether
0x9b1f286fc1eeb4472037619e4b1367100d5f390ddd20a3fc6b4657f7c40bd19c1261638357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01262467183334365 Ether
0x7aac8aff845735f14216424d8241f5907d04939571c1283b54704532eb715cb91261632357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033637795349990715 Ether
0x7aac8aff845735f14216424d8241f5907d04939571c1283b54704532eb715cb91261632357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003737532816665635 Ether
0xb5230f7fc7333e505f685b831632905c8e120d7c67610e5222ba0adf9fa7c4df1261630357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01262467183334365 Ether
0x14acafe96b858ffb9cd1ebc410c63f6e76e1a7783c9be23a7f8470902f2808ea1261626357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033637795349990715 Ether
0x14acafe96b858ffb9cd1ebc410c63f6e76e1a7783c9be23a7f8470902f2808ea1261626357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003737532816665635 Ether
0x4dd187a998b4a328650063842034992bd4b7278300472be0604e6d32187684441261624357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01262467183334365 Ether
0x00e7abe0f16a883b10507cda2188c84bd96a1c6a065833bc15f948728c7aa1591261614357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.033637795349990715 Ether
0x00e7abe0f16a883b10507cda2188c84bd96a1c6a065833bc15f948728c7aa1591261614357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10xdce0898b0fb2d632d6ef53d88343ce7806b1867d0.003737532816665635 Ether
0xa90a9143d1a1294ed25f3059e9c7199069e99200c58d97a046cb57508d2c1cf51261612357 days 19 hrs ago0x3ad14db4e5a658d8d20f8836deabe9d5286f79e10x3375ee30428b2a71c428afa5e89e427905f95f7e0.01262467183334365 Ether
Contract Source Code Verified
Contract Name: BlockKing
Compiler Version: v0.2.1-2016-02-10-7b5d96c
Optimization Enabled: Yes
Online Solidity Editor:  -NA-



  Contract Source Code   Find Similiar Contracts
/*
  Become the Block King when the last digit of your payment block number
  matches the randaom number received from Oraclize.it.
  The Block King receives 50% of the incoming payments of the warriors who
  fail to push the Block King from the throne.
  Block Kings who paid  1 ether when they
  ascended to the throne get 75% of the incoming payments.
  If the Block King holds their position for more than 2000 blocks
  they receive 90% of the incoming payments.
*/


// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize srl, Thomas Bertani



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

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) 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);
}
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 proofStorage_IPFS = 0x01;
    uint8 constant networkID_mainnet = 1;
    uint8 constant networkID_testnet = 2;
    uint8 constant networkID_morden = 2;
    uint8 constant networkID_consensys = 161;
    
    OraclizeAddrResolverI OAR = OraclizeAddrResolverI(0x1d11e5eae3112dbd44f99266872ff1d07c77dce8);
    
    OraclizeI oraclize;
    modifier oraclizeAPI {
        oraclize = OraclizeI(OAR.getAddress());
        _
    }
    modifier coupon(string code){
        oraclize = OraclizeI(OAR.getAddress());
        oraclize.useCoupon(code);
        _
    }
    function oraclize_setNetwork(uint8 networkID) internal returns(bool){
        if (networkID == networkID_mainnet) OAR = OraclizeAddrResolverI(0x1d11e5eae3112dbd44f99266872ff1d07c77dce8);
        else if (networkID == networkID_testnet) OAR = OraclizeAddrResolverI(0x0ae06d5934fd75d214951eb96633fbd7f9262a7c);
        else if (networkID == networkID_consensys) OAR = OraclizeAddrResolverI(0x20e12a1f859b3feae5fb2a0a32c18f5a65555bbf);
        else return false;
        return true;
    }
    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_cbAddress() oraclizeAPI internal returns (address){
        return oraclize.cbAddress();
    }
    function oraclize_setProof(byte proofP) oraclizeAPI internal {
        return oraclize.setProofType(proofP);
    }



    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 >= 48)&&(b1 <= 57)) b1 -= 48;
            if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
            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;
        }
        return mint;
    }
    


}
// </ORACLIZE_API>

contract BlockKing is usingOraclize{

  address public owner;
  address public king;
  address public warrior;
  address public contractAddress;
  uint public rewardPercent;
  uint public kingBlock;
  uint public warriorBlock;
  uint public randomNumber;
  uint public singleDigitBlock;
  uint public warriorGold;

  // this function is executed at initialization
  function BlockKing() {
    owner = msg.sender;
    king = msg.sender;
    warrior = msg.sender;
    contractAddress = this;
    rewardPercent = 50;
    kingBlock = block.number;
    warriorBlock = block.number;
    randomNumber = 0;
    singleDigitBlock = 0;
    warriorGold = 0;
  }

  // fallback function - simple transactions trigger this
  function() {
    enter();
  }
  
  function enter() {
    // 100 finney = .05 ether minimum payment otherwise refund payment and stop contract
    if (msg.value < 50 finney) {
      msg.sender.send(msg.value);
      return;
    }
    warrior = msg.sender;
    warriorGold = msg.value;
    warriorBlock = block.number;
    bytes32 myid = oraclize_query(0, "WolframAlpha", "random number between 1 and 9");
  }

  function __callback(bytes32 myid, string result) {
    if (msg.sender != oraclize_cbAddress()) throw;
    randomNumber = uint(bytes(result)[0]) - 48;
    process_payment();
  }
  
  function process_payment() {
    // Check if there is a new Block King
    // by comparing the last digit of the block number
    // against the Oraclize.it random number.
    uint singleDigit = warriorBlock;
	while (singleDigit > 1000000) {
		singleDigit -= 1000000;
	} 
	while (singleDigit > 100000) {
		singleDigit -= 100000;
	} 
	while (singleDigit > 10000) {
		singleDigit -= 10000;
	} 
	while (singleDigit > 1000) {
		singleDigit -= 1000;
	} 
	while (singleDigit > 100) {
		singleDigit -= 100;
	} 
	while (singleDigit > 10) {
		singleDigit -= 10;
	} 
    // Free round for the king
	if (singleDigit == 10) {
		singleDigit = 0;
	} 
	singleDigitBlock = singleDigit;
	if (singleDigitBlock == randomNumber) {
      rewardPercent = 50;
      // If the payment was more than .999 ether then increase reward percentage
      if (warriorGold > 999 finney) {
	  	rewardPercent = 75;
	  }	
      king = warrior;
      kingBlock = warriorBlock;
    }

	uint calculatedBlockDifference = kingBlock - warriorBlock;
	uint payoutPercentage = rewardPercent;
	// If the Block King has held the position for more
	// than 2000 blocks then increase the payout percentage.
	if (calculatedBlockDifference > 2000) {
	  	payoutPercentage = 90;		
	}

    // pay reward to BlockKing
    uint reward = (contractAddress.balance * payoutPercentage)/100;  
    king.send(reward);
    	
    // collect fee
    owner.send(contractAddress.balance);
  }
  function kill() { if (msg.sender == owner) suicide(owner); }
}

  Contract ABI  
[{"constant":false,"inputs":[],"name":"process_payment","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"singleDigitBlock","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"warriorBlock","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"king","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[],"name":"randomNumber","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"rewardPercent","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"warriorGold","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"warrior","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[],"name":"enter","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"kingBlock","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"contractAddress","outputs":[{"name":"","type":"address"}],"type":"function"},{"inputs":[],"type":"constructor"}]

  Contract Creation Code Switch To Opcodes View
606060405260008054600160a060020a031916731d11e5eae3112dbd44f99266872ff1d07c77dce817905560028054600160a060020a031990811633908117909255600380548216831790556004805482169092179091556005805490911630179055603260065543600781905560085560006009819055600a819055600b556107ad8061008d6000396000f3606060405236156100ae5760e060020a60003504632431f16481146100b957806327dc297e146100de57806341c0e1b5146101ef5780638da5cb5b146102195780639ed1e4c61461022b578063a4be64a414610234578063cc181ca81461023d578063ccbac9f51461024f578063d030205114610258578063dde7af3214610261578063e3f52c991461026a578063e97dcb621461027c578063ee7cf9f2146102b6578063f6b4dfb4146102bf575b6102d16102d3610280565b6102d15b600854600080805b620f424084111561053957620f423f19909301926100c5565b60408051602060248035600481810135601f81018590048502860185019096528585526102d195813595919460449492939092019181908401838280828437509496505050505050506104dc604080516000805460e060020a6338cc483102835292519092600160a060020a0316916338cc4831916004828101926020929190829003018187876161da5a03f11561000257505060408051805160018054600160a060020a031916909117908190557fc281d19e0000000000000000000000000000000000000000000000000000000082529151600160a060020a0392909216925063c281d19e916004828101926020929190829003018187876161da5a03f1156100025750506040515191505090565b6102d1600254600160a060020a03908116339190911614156102d357600254600160a060020a0316ff5b6102d5600254600160a060020a031681565b6102f2600a5481565b6102f260085481565b6102d5600354600160a060020a031681565b6102f260095481565b6102f260065481565b6102f2600b5481565b6102d5600454600160a060020a031681565b6102d15b600066b1a2bc2ec5000034101561030a57604051600160a060020a033316908290349082818181858883f1935050505050610307565b6102f260075481565b6102d5600554600160a060020a031681565b005b565b60408051600160a060020a03929092168252519081900360200190f35b60408051918252519081900360200190f35b90505b50565b60048054600160a060020a0319163317905534600b5543600855604080518082018252600c81527f576f6c6672616d416c70686100000000000000000000000000000000000000006020828101919091528251808401909352601d83527f72616e646f6d206e756d626572206265747765656e203120616e642039000000908301526103049160009190600080546040805160e060020a6338cc483102815290518392600160a060020a0316916338cc4831916004828101926020929190829003018187876161da5a03f115610002575050604051805160018054600160a060020a031916909117908190557f524f388900000000000000000000000000000000000000000000000000000000825260206004838101828152895160248601528951600160a060020a0394909416955063524f3889948a949193849360449092019286820192909182918591839186918e9190601f850104600f02600301f150905090810190601f1680156104935780820380516001836020036101000a031916815260200191505b50925050506020604051808303816000876161da5a03f11561000257505060405151915050670de0b6b3a764000062030d403a020181111561068857600091505b509392505050565b600160a060020a031633600160a060020a03161415156104fb57610002565b603081600081518110156100025790602001015160f860020a900460f860020a0260f860020a9004036009600050819055506105356100bd565b5050565b5b620186a0841115610553576201869f199093019261053a565b5b61271084111561056b5761270f1990930192610554565b5b6103e8841115610583576103e7199093019261056c565b5b606484111561059a576063199390930192610584565b5b600a8411156105b0576009199093019261059b565b83600a14156105be57600093505b600a849055600954841415610612576032600655600b54670ddd2935029d80009011156105eb57604b6006555b60038054600454600160a060020a0316600160a060020a0319919091161790556008546007555b60065460085460075403935091506107d083111561062f57605a91505b506005546003546040516064600160a060020a0393841631850204929190911690600090839082818181858883f150600554600254600160a060020a0390811695501631915082818181858883f1505050505050505050565b600160009054906101000a9004600160a060020a0316600160a060020a031663adf59f99828787876040518560e060020a0281526004018084815260200180602001806020018381038352858181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156107265780820380516001836020036101000a031916815260200191505b508381038252848181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f16801561077f5780820380516001836020036101000a031916815260200191505b509550505050505060206040518083038185886185025a03f1156100025750506040515193506104d491505056
View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward