Sponsored Link:  Presearch [ ICO ]The Decentralized Search Engine.
Contract Overview | Chainy.info
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 1001 txns
  Latest 25 txns from a total Of 1001 transactions View All

TxHash Block Age From To Value [TxFee]
0x1ee7bf80daa8e264af9fbe3528289bf80eb8211d1000d9025293a64712d3c45f40749165 hrs 5 mins ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00301581
0x8ba470e5b13c3290ec1ca66bd23d9f29a44115b7469288335017bfdf6e56b72f407200320 hrs 9 mins ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0xff3580995b26ddec1a0629d45d79742b189d7798faa52e94e68eba777012f7a5407198820 hrs 14 mins ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00326331
0x9b8640a489e0f7d901524c5dad67394c0bafa5e3b9b16e72619681f11c46eac840690241 day 11 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x54d1c7b99670b1563eabe351e5a13ef58f0fbcb1ed2ecbc397fefeab718fec7640690091 day 11 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0xe44bcdb31518c76772a7fe6154fc6a658dcb4a47fdd075889d4c217c35691a8940689261 day 12 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00300194
0x57d8b30b9fd1a7c7093e7fe7f1004f43e5caa8ddb7d2f4262c957782d82bda2540685951 day 13 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x5c38b08ac04bb459182866bc6ffc50597840d4ec6a3b0de4527b67e806d3da5c40685931 day 13 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00353937
0x4e608edee5a202302595896b493c43a8a80acedefe7ca80937ba6a07ad45bf6040685821 day 13 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x673162811718015d78a8641c79872df00c74185ec7939f440296c9d964d27a1d40675341 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00219577
0x6cf35940a64ca8afb71b11f08dbd957e1cc10e79a0dbda2401dfefaede07cdcb40675161 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x7a589abd7002122712964d90707c9393a38d63746ebc817ac904cc892afdd0f240674491 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x407cc45c4ddf8b4b34af1786284396e531deb62be649a56faf869bb95b3a9dfb40674371 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x2a5b698309f6e026da7ffc15189a2b9ee0f76aabb01c63e390ac2e86b7247c6340674251 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0xaf59efca6150c886559d8ab99c5861c8b4c99a22f46e6db9e2c634d5b2aef08340674111 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x0370b7d12b36d7131e607708424ec5be7596c55049d0835277ecbdc501a0a09040673961 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x2b974cd30d317631afedc9b3e0b10e063908b2c00b910edbac91935ecf68a9bd40673901 day 19 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0xd5538c4ea51a3d3558b75d91f7003e0e6050f2d118a44a163b5e6e5dee761dd840673661 day 20 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x8d048d21687d115921d795f3fc0e2bc94194b58b8eb6c17267cf610fd5bb452d40673551 day 20 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x6295f246a8aa9db1bae5fbc41b3cc80c985caf6cc6e56c0ccf1c9a783acdc76640672851 day 20 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x2bdff8f726043f1c2fcddf9e3d77604bfc441b44e45bda9c9e0d33b9db75bb9840672611 day 20 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0xffa7c1a54bcb60181a8c738baaeed3c9d971c21f22095761af70fa976a389c7d40672361 day 20 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
0x8fcb5cdbf4acfa465c9e25133318afcd36a08b42437dc712b9cb1db1fd726c1a40671291 day 21 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00353366
0x835a1ffd163246056c1a92fa53500c5e49336a3250b416678b7f3b536bf73a1640671201 day 21 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00300439
0x6287b8bb6a9c7bfc08ddc64a7173e19f437c4a9b147298371b6ef5cb22accdde40669561 day 22 hrs ago0x3d6f8823ad21cd299814b62d198d9001e67e20b3  IN   Chainy.info0 Ether0.00247184
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
  Latest 1 Internal Transaction

ParentTxHash Block Age From To Value
0x9d0f227ad53ca11411e8d5160918e696fe3b8f0d23f1c31b9178e3f7bcd942b12721000238 days 1 hr ago0xf3763c30dd6986b53402d41a8552b8f7f6a6089b0xc2be1c765d622bcfa3ab30bedb508b633ab792171 Ether
[ Download CSV Export  ] 
Contract Name: Chainy
Compiler Version: v0.3.4-nightly.2016.6.8+commit.d593166
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
/**
 * Copyright 2016 Everex https://everex.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


/* String utility library */
library strUtils {
    string constant CHAINY_JSON_ID = '"id":"CHAINY"';
    uint8 constant CHAINY_JSON_MIN_LEN = 32;

    /* Converts given number to base58, limited by _maxLength symbols */
    function toBase58(uint256 _value, uint8 _maxLength) internal returns (string) {
        string memory letters = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
        bytes memory alphabet = bytes(letters);
        uint8 base = 58;
        uint8 len = 0;
        uint256 remainder = 0;
        bool needBreak = false;
        bytes memory bytesReversed = bytes(new string(_maxLength));

        for (uint8 i = 0; i < _maxLength; i++) {
            if(_value < base){
                needBreak = true;
            }
            remainder = _value % base;
            _value = uint256(_value / base);
            bytesReversed[i] = alphabet[remainder];
            len++;
            if(needBreak){
                break;
            }
        }

        // Reverse
        bytes memory result = bytes(new string(len));
        for (i = 0; i < len; i++) {
            result[i] = bytesReversed[len - i - 1];
        }
        return string(result);
    }

    /* Concatenates two strings */
    function concat(string _s1, string _s2) internal returns (string) {
        bytes memory bs1 = bytes(_s1);
        bytes memory bs2 = bytes(_s2);
        string memory s3 = new string(bs1.length + bs2.length);
        bytes memory bs3 = bytes(s3);

        uint256 j = 0;
        for (uint256 i = 0; i < bs1.length; i++) {
            bs3[j++] = bs1[i];
        }
        for (i = 0; i < bs2.length; i++) {
            bs3[j++] = bs2[i];
        }

        return string(bs3);
    }

    /* Checks if provided JSON string has valid Chainy format */
    function isValidChainyJson(string _json) internal returns (bool) {
        bytes memory json = bytes(_json);
        bytes memory id = bytes(CHAINY_JSON_ID);

        if (json.length < CHAINY_JSON_MIN_LEN) {
            return false;
        } else {
            uint len = 0;
            if (json[1] == id[0]) {
                len = 1;
                while (len < id.length && (1 + len) < json.length && json[1 + len] == id[len]) {
                    len++;
                }
                if (len == id.length) {
                    return true;
                }
            }
        }

        return false;
    }
}


// Ownership
contract owned {
    address public owner;

    function owned() {
        owner = msg.sender;
    }

    modifier onlyOwner {
        if (msg.sender != owner) throw;
        _
    }

    function transferOwnership(address newOwner) onlyOwner {
        owner = newOwner;
    }
}

contract Chainy is owned {
    // Chainy viewer url
    string CHAINY_URL;

    // Configuration
    mapping(string => uint256) private chainyConfig;

    // Service accounts
    mapping (address => bool) private srvAccount;

    // Fee receiver
    address private receiverAddress;

    struct data {uint256 timestamp; string json; address sender;}
    mapping (string => data) private chainy;

    event chainyShortLink(uint256 timestamp, string code);

    // Constructor
    function Chainy(){
        setConfig("fee", 0);
        // change the block offset to 1000000 to use contract in testnet
        setConfig("blockoffset", 2000000);
        setChainyURL("https://txn.me/");
    }

    // Sets new Chainy viewer URL
    function setChainyURL(string _url) onlyOwner {
        CHAINY_URL = _url;
    }

    // Returns current Chainy viewer URL
    function getChainyURL() constant returns(string){
        return CHAINY_URL;
    }

    // Sets configuration option
    function setConfig(string _key, uint256 _value) onlyOwner {
        chainyConfig[_key] = _value;
    }

    // Returns configuration option
    function getConfig(string _key) constant returns (uint256 _value) {
        return chainyConfig[_key];
    }

    // Add/Remove service account
    function setServiceAccount(address _address, bool _value) onlyOwner {
        srvAccount[_address] = _value;
    }

    // Set receiver address
    function setReceiverAddress(address _address) onlyOwner {
        receiverAddress = _address;
    }

    // Send all ether back to owner
    function releaseFunds() onlyOwner {
        if(!owner.send(this.balance)) throw;
    }

    // Add record
    function addChainyData(string json) {
        checkFormat(json);

        var code = generateShortLink();
        // Checks if the record exist
        if (getChainyTimestamp(code) > 0) throw;

        processFee();
        chainy[code] = data({
            timestamp: block.timestamp,
            json: json,
            sender: tx.origin
        });

        // Fire event
        var link = strUtils.concat(CHAINY_URL, code);
        chainyShortLink(block.timestamp, link);
    }

    // Get record timestamp
    function getChainyTimestamp(string code) constant returns (uint256) {
        return chainy[code].timestamp;
    }

    // Get record JSON
    function getChainyData(string code) constant returns (string) {
        return chainy[code].json;
    }

    // Get record sender
    function getChainySender(string code) constant returns (address) {
        return chainy[code].sender;
    }

    // Checks if enough fee provided
    function processFee() internal {
        var fee = getConfig("fee");
        if (srvAccount[msg.sender] || (fee == 0)) return;

        if (msg.value < fee)
            throw;
        else
            if (!receiverAddress.send(fee)) throw;
    }

    // Checks if provided string has valid format
    function checkFormat(string json) internal {
        if (!strUtils.isValidChainyJson(json)) throw;
    }

    // Generates a shortlink code for this transaction
    function generateShortLink() internal returns (string) {
        var s1 = strUtils.toBase58(block.number - getConfig("blockoffset"), 11);
        var s2 = strUtils.toBase58(uint256(tx.origin), 2);

        var s = strUtils.concat(s1, s2);
        return s;
    }

}

  Contract ABI  
[{"constant":true,"inputs":[{"name":"code","type":"string"}],"name":"getChainyData","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"},{"name":"_value","type":"bool"}],"name":"setServiceAccount","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"getChainyURL","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_key","type":"string"},{"name":"_value","type":"uint256"}],"name":"setConfig","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"releaseFunds","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setReceiverAddress","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"code","type":"string"}],"name":"getChainySender","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"json","type":"string"}],"name":"addChainyData","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"_key","type":"string"}],"name":"getConfig","outputs":[{"name":"_value","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"code","type":"string"}],"name":"getChainyTimestamp","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"_url","type":"string"}],"name":"setChainyURL","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"type":"function"},{"inputs":[],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":false,"name":"code","type":"string"}],"name":"chainyShortLink","type":"event"}]

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