Contract 0x9A0991fc223dFFE420e08f15b88a593a3b8D44B8

 

Contract Overview

Balance:
0 Ether

EtherValue:
$0.00

Token:
 
Txn Hash
Method
Block
From
To
Value
0x1ede12fadbb376ba0f392f3051486d500f5228adbd5a0bb73b990403eab197feFinalize_contrac...54277372018-04-12 14:25:261693 days 12 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.000266514
0x79a33b1900140be61e32656376ebbe6e464a7040d164589c9e61ebf40ffd2574Evaluate_model54166702018-04-10 18:00:251695 days 8 hrs ago0x31e518d6c491af158b5a3d41667e79287d1e9a2e IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.0879211
0xccd6ade0e791da1a94234904d04ea21e27ecfeb9fdc5f6b00c94bf43bfd216590x3af39c2154112292018-04-09 20:34:371696 days 6 hrs ago0xd9568b38482225d63f141cd28c2681c983558313 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.000066113
0xdea600e418c68e37247002f1394db65fb9dee8bc3206287e0ad4eac44e95c8c0Evaluate_model53826422018-04-05 2:51:541701 days ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.017503614
0xd8822d36a61862b2b0664942d46e670b578b72ed9c4581a6924cb19900bbe64bReveal_test_data53685272018-04-02 18:39:461703 days 8 hrs ago0x5cad76ae75137b53df8a104a71639a405b640ae0 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.003480882
0xa3510c4d46c7e8a4d36760e9ae87712a53448d454b1168e97803b024f460ea52Reveal_test_data53685092018-04-02 18:35:301703 days 8 hrs ago0x5cad76ae75137b53df8a104a71639a405b640ae0 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.003480752
0x5bcaf9a561c0427001c11a8078727510100224dc5714355608f5b309f58bca63Reveal_test_data53684962018-04-02 18:32:441703 days 8 hrs ago0x5cad76ae75137b53df8a104a71639a405b640ae0 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.003510882
0x04a98602b18244a34f0eb8b93be4299c32395287847fa43d6fe4461b7366cad5Reveal_test_data53684742018-04-02 18:27:211703 days 8 hrs ago0x5cad76ae75137b53df8a104a71639a405b640ae0 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.003510492
0xc24e11df57edb1ca2c0619ae4edf1cf64a294f0a4ab92223899fc3547771d954Submit_model53638242018-04-02 0:03:301704 days 2 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.009683664
0x90e0741ac30a7bca4da485d795ab2f63b5d545a8d2090f71d2ccab7beed14b9fSubmit_model53638072018-04-01 23:58:561704 days 2 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.004744194
0x3fede2fca30b2ef3ee96ee42ec6a84812f9368b318339674b1d3b934f9a365b6Submit_model53638052018-04-01 23:57:411704 days 2 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.00471274
0x3ec5b7d043e8008d30c947fff27b1a70cdf89663352104c79abbc8764dcc88ecSubmit_model53637082018-04-01 23:37:021704 days 3 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.004751364
0xb8188ca3aec452c9dfadb61379c49b64dd63f1e45221e721b8e59bbdcdac73fbSubmit_model53637002018-04-01 23:35:241704 days 3 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.004712454
0xda2a6bfccadf2b299fb985ccad155ac249282861f6952cd917c475a4f19f5770Submit_model53636432018-04-01 23:23:471704 days 3 hrs ago0x31e518d6c491af158b5a3d41667e79287d1e9a2e IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.02009927
0xe474b7576e19bbe7a8d2da72ed248f82ef15faf6eab307dc8fee49d61df562b2Submit_model53635652018-04-01 23:01:481704 days 3 hrs ago0x31e518d6c491af158b5a3d41667e79287d1e9a2e IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.016932077
0x6d4edfd55c939afee1e1ec5dfb71e125cd2626e1846cf32d2aaacc108a862115Submit_model53635512018-04-01 22:57:511704 days 3 hrs ago0x31e518d6c491af158b5a3d41667e79287d1e9a2e IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.009676494
0x7800edfc250f3a0fdf9ab681636238ccab1eb22d9468cb8f701014b53a811e9cSubmit_model53635282018-04-01 22:51:591704 days 4 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.00884654
0x2eac368f630fb78524e541e576be81c93cea8ba85c2f66fbdb547c5b59f3d928Submit_model53634742018-04-01 22:37:221704 days 4 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.014479434
0xf5555b201210a415717c911d2c98a48e71b2faad75e62c3e19f038a6503e1dcbSubmit_model53634542018-04-01 22:29:031704 days 4 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.013712474
0x206e47b17d93f0b24590999c23907a4a7d00e78942323546e897377fc1b46097Submit_model53634482018-04-01 22:27:531704 days 4 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.013703764
0x91ec88f24b3ed1789c48b1ac75982c7d566a0fc9b0f58685aedf359bf91cbce2Submit_model53634072018-04-01 22:16:471704 days 4 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.013904234
0xc7656ed760f16487915f774f4dcd78fb993ad45bb3ef06e2019b929c1cc4c419Submit_model53634002018-04-01 22:15:351704 days 4 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.013881194
0x88f72778fd921ad9f1f975fad174700ca857d7a35bb2d65294b90ce60f980330Submit_model53630462018-04-01 20:50:031704 days 6 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.004044664
0xdbd41326d94452c6af7d87cbe3756d07cf321a974dea61511482495aebd1824cSubmit_model53630422018-04-01 20:48:541704 days 6 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.004039294
0xd6f4a276fff581a345779a7c2dba34237fd8d5a0b1ef691faadebf2306cab319Submit_model53630362018-04-01 20:47:351704 days 6 hrs ago0x48cd937e15155ad76ad628556c3fcd2468b1cc61 IN  0x9a0991fc223dffe420e08f15b88a593a3b8d44b80 Ether0.004029824
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x1ede12fadbb376ba0f392f3051486d500f5228adbd5a0bb73b990403eab197fe54277372018-04-12 14:25:261693 days 12 hrs ago 0x9a0991fc223dffe420e08f15b88a593a3b8d44b80x48cd937e15155ad76ad628556c3fcd2468b1cc615 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Danku_demo

Compiler Version
v0.4.20-nightly.2017.12.8+commit.226bfe5b

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-04-09
*/

pragma solidity ^0.4.19;
// Danku contract version 0.0.1
// Data points are x, y, and z

contract Danku_demo {
  function Danku_demo() public {
    // Neural Network Structure:
    //
    // (assertd) input layer x number of neurons
    // (optional) hidden layers x number of neurons
    // (assertd) output layer x number of neurons
  }
  struct Submission {
      address payment_address;
      // Define the number of neurons each layer has.
      uint num_neurons_input_layer;
      uint num_neurons_output_layer;
      // There can be multiple hidden layers.
      uint[] num_neurons_hidden_layer;
      // Weights indexes are the following:
      // weights[l_i x l_n_i x pl_n_i]
      // Also number of layers in weights is layers.length-1
      int256[] weights;
      int256[] biases;
  }
  struct NeuralLayer {
    int256[] neurons;
    int256[] errors;
    string layer_type;
  }

  address public organizer;
  // Keep track of the best model
  uint public best_submission_index;
  // Keep track of best model accuracy
  int256 public best_submission_accuracy = 0;
  // The model accuracy criteria
  int256 public model_accuracy_criteria;
  // Use test data if provided
  bool public use_test_data = false;
  // Each partition is 5% of the total dataset size
  uint constant partition_size = 25;
  // Data points are made up of x and y coordinates and the prediction
  uint constant datapoint_size = 3;
  uint constant prediction_size = 1;
  // Max number of data groups
  // Change this to your data group size
  uint16 constant max_num_data_groups = 500;
  // Training partition size
  uint16 constant training_data_group_size = 400;
  // Testing partition size
  uint16 constant testing_data_group_size = max_num_data_groups - training_data_group_size;
  // Dataset is divided into data groups.
  // Every data group includes a nonce.
  // Look at sha_data_group() for more detail about hashing a data group
  bytes32[max_num_data_groups/partition_size] hashed_data_groups;
  // Nonces are revelead together with data groups
  uint[max_num_data_groups/partition_size] data_group_nonces;
  // + 1 for prediction
  // A data group has 3 data points in total
  int256[datapoint_size][] public train_data;
  int256[datapoint_size][] public test_data;
  bytes32 partition_seed;
  // Deadline for submitting solutions in terms of block size
  uint public submission_stage_block_size = 241920; // 6 weeks timeframe
  // Deadline for revealing the testing dataset
  uint public reveal_test_data_groups_block_size = 17280; // 3 days timeframe
  // Deadline for evaluating the submissions
  uint public evaluation_stage_block_size = 40320; // 7 days timeframe
  uint public init1_block_height;
  uint public init3_block_height;
  uint public init_level = 0;
  // Training partition size is 14 (70%)
  // Testing partition size is 6 (30%)
  uint[training_data_group_size/partition_size] public training_partition;
  uint[testing_data_group_size/partition_size] public testing_partition;
  uint256 train_dg_revealed = 0;
  uint256 test_dg_revealed = 0;
  Submission[] submission_queue;
  bool public contract_terminated = false;
  // Integer precision for calculating float values for weights and biases
  int constant int_precision = 10000;

  // Takes in array of hashed data points of the entire dataset,
  // submission and evaluation times
  function init1(bytes32[max_num_data_groups/partition_size] _hashed_data_groups, int accuracy_criteria, address organizer_refund_address) external {
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Make sure it's called in order
    assert(init_level == 0);
    organizer = organizer_refund_address;
    init_level = 1;
    init1_block_height = block.number;

    // Make sure there are in total 20 hashed data groups
    assert(_hashed_data_groups.length == max_num_data_groups/partition_size);
    hashed_data_groups = _hashed_data_groups;
    // Accuracy criteria example: 85.9% => 8,590
    // 100 % => 10,000
    assert(accuracy_criteria > 0);
    model_accuracy_criteria = accuracy_criteria;
  }

  function init2() external {
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Only allow calling it once, in order
    assert(init_level == 1);
    // Make sure it's being called within 20 blocks on init1()
    // to minimize organizer influence on random index selection
    if (block.number <= init1_block_height+20 && block.number > init1_block_height) {
      // TODO: Also make sure it's being called 1 block after init1()
      // Randomly select indexes
      uint[] memory index_array = new uint[](max_num_data_groups/partition_size);
      for (uint i = 0; i < max_num_data_groups/partition_size; i++) {
        index_array[i] = i;
      }
      randomly_select_index(index_array);
      init_level = 2;
    } else {
      // Cancel the contract if init2() hasn't been called within 5
      // blocks of init1()
      cancel_contract();
    }
  }

  function init3(int256[] _train_data_groups, int256 _train_data_group_nonces) external {
    // Pass a single data group at a time
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Only allow calling once, in order
    assert(init_level == 2);
    // Verify data group and nonce lengths
    assert((_train_data_groups.length/partition_size)/datapoint_size == 1);
    // Verify data group hashes
    // Order of revealed training data group must be the same with training partitions
    // Otherwise hash verification will fail
    assert(sha_data_group(_train_data_groups, _train_data_group_nonces) ==
      hashed_data_groups[training_partition[train_dg_revealed]]);
    train_dg_revealed += 1;
    // Assign training data after verifying the corresponding hash
    unpack_data_groups(_train_data_groups, true);
    if (train_dg_revealed == (training_data_group_size/partition_size)) {
      init_level = 3;
      init3_block_height = block.number;
    }
  }

  function get_training_index() public view returns(uint[training_data_group_size/partition_size]) {
    return training_partition;
  }

  function get_testing_index() public view returns(uint[testing_data_group_size/partition_size]) {
    return testing_partition;
  }

  function get_submission_queue_length() public view returns(uint) {
    return submission_queue.length;
  }

  function submit_model(
    // Public function for users to submit a solution
    address payment_address,
    uint num_neurons_input_layer,
    uint num_neurons_output_layer,
    uint[] num_neurons_hidden_layer,
    int[] weights,
    int256[] biases) public {
      // Make sure contract is not terminated
      assert(contract_terminated == false);
      // Make sure it's not the initialization stage anymore
      assert(init_level == 3);
      // Make sure it's still within the submission stage
      assert(block.number < init3_block_height + submission_stage_block_size);
      // Make sure that num of neurons in the input & output layer matches
      // the problem description
      assert(num_neurons_input_layer == datapoint_size - prediction_size);
      // Because we can encode binary output in two different ways, we check
      // for both of them
      assert(num_neurons_output_layer == prediction_size || num_neurons_output_layer == (prediction_size+1));
      // Make sure that the number of weights match network structure
      assert(valid_weights(weights, num_neurons_input_layer, num_neurons_output_layer, num_neurons_hidden_layer));
      // Add solution to submission queue
      submission_queue.push(Submission(
        payment_address,
        num_neurons_input_layer,
        num_neurons_output_layer,
        num_neurons_hidden_layer,
        weights,
        biases));
  }

  function get_submission_id(
    // Public function that returns the submission index ID
    address paymentAddress,
    uint num_neurons_input_layer,
    uint num_neurons_output_layer,
    uint[] num_neurons_hidden_layer,
    int[] weights,
    int256[] biases) public view returns (uint) {
      // Iterate over submission queue to get submission index ID
      for (uint i = 0; i < submission_queue.length; i++) {
        if (submission_queue[i].payment_address != paymentAddress) {
          continue;
        }
        if (submission_queue[i].num_neurons_input_layer != num_neurons_input_layer) {
          continue;
        }
        if (submission_queue[i].num_neurons_output_layer != num_neurons_output_layer) {
          continue;
        }
        for (uint j = 0; j < num_neurons_hidden_layer.length; j++) {
            if (submission_queue[i].num_neurons_hidden_layer[j] != num_neurons_hidden_layer[j]) {
              continue;
            }
        }
        for (uint k = 0; k < weights.length; k++) {
            if (submission_queue[i].weights[k] != weights[k]) {
              continue;
            }
        }
        for (uint l = 0; l < biases.length; l++) {
          if (submission_queue[i].biases[l] != biases[l]) {
            continue;
          }
        }
        // If everything matches, return the submission index
        return i;
      }
      // If submission is not in the queue, just throw an exception
      require(false);
  }

    function reveal_test_data(int256[] _test_data_groups, int256 _test_data_group_nonces) external {
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Make sure it's not the initialization stage anymore
    assert(init_level == 3);
    // Make sure it's revealed after the submission stage
    assert(block.number >= init3_block_height + submission_stage_block_size);
    // Make sure it's revealed within the reveal stage
    assert(block.number < init3_block_height + submission_stage_block_size + reveal_test_data_groups_block_size);
    // Verify data group and nonce lengths
    assert((_test_data_groups.length/partition_size)/datapoint_size == 1);
    // Verify data group hashes
    assert(sha_data_group(_test_data_groups, _test_data_group_nonces) ==
      hashed_data_groups[testing_partition[test_dg_revealed]]);
    test_dg_revealed += 1;
    // Assign testing data after verifying the corresponding hash
    unpack_data_groups(_test_data_groups, false);
    // Use test data for evaluation
    use_test_data = true;
  }

  function evaluate_model(uint submission_index) public {
    // TODO: Make sure that if there's two same submission w/ same weights
    // and biases, the first one submitted should get the reward.
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Make sure it's not the initialization stage anymore
    assert(init_level == 3);
    // Make sure it's evaluated after the reveal stage
    assert(block.number >= init3_block_height + submission_stage_block_size + reveal_test_data_groups_block_size);
    // Make sure it's evaluated within the evaluation stage
    assert(block.number < init3_block_height + submission_stage_block_size + reveal_test_data_groups_block_size + evaluation_stage_block_size);
    // Evaluates a submitted model & keeps track of the best model
    int256 submission_accuracy = 0;
    if (use_test_data == true) {
      submission_accuracy = model_accuracy(submission_index, test_data);
    } else {
      submission_accuracy = model_accuracy(submission_index, train_data);
    }

    // Keep track of the most accurate model
    if (submission_accuracy > best_submission_accuracy) {
      best_submission_index = submission_index;
      best_submission_accuracy = submission_accuracy;
    }
  }

  function cancel_contract() public {
    // Make sure contract is not already terminated
    assert(contract_terminated == false);
    // Contract can only be cancelled if initialization has failed.
    assert(init_level < 3);
    // Refund remaining balance to organizer
    organizer.transfer(this.balance);
    // Terminate contract
    contract_terminated = true;
  }

  function finalize_contract() public {
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Make sure it's not the initialization stage anymore
    assert(init_level == 3);
    // Make sure the contract is finalized after the evaluation stage
    assert(block.number >= init3_block_height + submission_stage_block_size + reveal_test_data_groups_block_size + evaluation_stage_block_size);
    // Get the best submission to compare it against the criteria
    Submission memory best_submission = submission_queue[best_submission_index];
    // If best submission passes criteria, payout to the submitter
    if (best_submission_accuracy >= model_accuracy_criteria) {
      best_submission.payment_address.transfer(this.balance);
    // If the best submission fails the criteria, refund the balance back to the organizer
    } else {
      organizer.transfer(this.balance);
    }
    contract_terminated = true;
  }

  function model_accuracy(uint submission_index, int256[datapoint_size][] data) public constant returns (int256){
    // Make sure contract is not terminated
    assert(contract_terminated == false);
    // Make sure it's not the initialization stage anymore
    assert(init_level == 3);
    // Leave function public for offline error calculation
    // Get's the sum error for the model
    Submission memory sub = submission_queue[submission_index];
    int256 true_prediction = 0;
    int256 false_prediction = 0;
    bool one_hot; // one-hot encoding if prediction size is 1 but model output size is 2
    int[] memory prediction;
    int[] memory ground_truth;
    if ((prediction_size + 1) == sub.num_neurons_output_layer) {
      one_hot = true;
      prediction = new int[](sub.num_neurons_output_layer);
      ground_truth = new int[](sub.num_neurons_output_layer);
    } else {
      one_hot = false;
      prediction = new int[](prediction_size);
      ground_truth = new int[](prediction_size);
    }
    for (uint i = 0; i < data.length; i++) {
      // Get ground truth
      for (uint j = datapoint_size-prediction_size; j < data[i].length; j++) {
        uint d_index = j - datapoint_size + prediction_size;
        // Only get prediction values
        if (one_hot == true) {
          if (data[i][j] == 0) {
            ground_truth[d_index] = 1;
            ground_truth[d_index + 1] = 0;
          } else if (data[i][j] == 1) {
            ground_truth[d_index] = 0;
            ground_truth[d_index + 1] = 1;
          } else {
            // One-hot encoding for more than 2 classes is not supported
            require(false);
          }
        } else {
          ground_truth[d_index] = data[i][j];
        }
      }
      // Get prediction
      prediction = get_prediction(sub, data[i]);
      // Get error for the output layer
      for (uint k = 0; k < ground_truth.length; k++) {
        if (ground_truth[k] == prediction[k]) {
          true_prediction += 1;
        } else {
          false_prediction += 1;
        }
      }
    }
    // We multipl by int_precision to get up to x decimal point precision while
    // calculating the accuracy
    return (true_prediction * int_precision) / (true_prediction + false_prediction);
  }

  function get_train_data_length() public view returns(uint256) {
    return train_data.length;
  }

  function get_test_data_length() public view returns(uint256) {
    return test_data.length;
  }

  function round_up_division(int256 dividend, int256 divisor) private pure returns(int256) {
    // A special trick since solidity normall rounds it down
    return (dividend + divisor -1) / divisor;
  }

  function not_in_train_partition(uint[training_data_group_size/partition_size] partition, uint number) private pure returns (bool) {
    for (uint i = 0; i < partition.length; i++) {
      if (number == partition[i]) {
        return false;
      }
    }
    return true;
  }

  function randomly_select_index(uint[] array) private {
    uint t_index = 0;
    uint array_length = array.length;
    uint block_i = 0;
    // Randomly select training indexes
    while(t_index < training_partition.length) {
      uint random_index = uint(sha256(block.blockhash(block.number-block_i))) % array_length;
      training_partition[t_index] = array[random_index];
      array[random_index] = array[array_length-1];
      array_length--;
      block_i++;
      t_index++;
    }
    t_index = 0;
    while(t_index < testing_partition.length) {
      testing_partition[t_index] = array[array_length-1];
      array_length--;
      t_index++;
    }
  }

  function valid_weights(int[] weights, uint num_neurons_input_layer, uint num_neurons_output_layer, uint[] num_neurons_hidden_layer) private pure returns (bool) {
    // make sure the number of weights match the network structure
    // get number of weights based on network structure
    uint ns_total = 0;
    uint wa_total = 0;
    uint number_of_layers = 2 + num_neurons_hidden_layer.length;

    if (number_of_layers == 2) {
      ns_total = num_neurons_input_layer * num_neurons_output_layer;
    } else {
      for(uint i = 0; i < num_neurons_hidden_layer.length; i++) {
        // Get weights between first hidden layer and input layer
        if (i==0){
          ns_total += num_neurons_input_layer * num_neurons_hidden_layer[i];
        // Get weights between hidden layers
        } else {
          ns_total += num_neurons_hidden_layer[i-1] * num_neurons_hidden_layer[i];
        }
      }
      // Get weights between last hidden layer and output layer
      ns_total += num_neurons_hidden_layer[num_neurons_hidden_layer.length-1] * num_neurons_output_layer;
    }
    // get number of weights in the weights array
    wa_total = weights.length;

    return ns_total == wa_total;
  }

    function unpack_data_groups(int256[] _data_groups, bool is_train_data) private {
    int256[datapoint_size][] memory merged_data_group = new int256[datapoint_size][](_data_groups.length/datapoint_size);

    for (uint i = 0; i < _data_groups.length/datapoint_size; i++) {
      for (uint j = 0; j < datapoint_size; j++) {
        merged_data_group[i][j] = _data_groups[i*datapoint_size + j];
      }
    }
    if (is_train_data == true) {
      // Assign training data
      for (uint k = 0; k < merged_data_group.length; k++) {
        train_data.push(merged_data_group[k]);
      }
    } else {
      // Assign testing data
      for (uint l = 0; l < merged_data_group.length; l++) {
        test_data.push(merged_data_group[l]);
      }
    }
  }

    function sha_data_group(int256[] data_group, int256 data_group_nonce) private pure returns (bytes32) {
      // Extract the relevant data points for the given data group index
      // We concat all data groups and add the nounce to the end of the array
      // and get the sha256 for the array
      uint index_tracker = 0;
      uint256 total_size = datapoint_size * partition_size;
      /* uint256 start_index = data_group_index * total_size;
      uint256 iter_limit = start_index + total_size; */
      int256[] memory all_data_points = new int256[](total_size+1);

      for (uint256 i = 0; i < total_size; i++) {
        all_data_points[index_tracker] = data_group[i];
        index_tracker += 1;
      }
      // Add nonce to the whole array
      all_data_points[index_tracker] = data_group_nonce;
      // Return sha256 on all data points + nonce
      return sha256(all_data_points);
    }

  function relu_activation(int256 x) private pure returns (int256) {
    if (x < 0) {
      return 0;
    } else {
      return x;
    }
  }

  function get_layer(uint nn) private pure returns (int256[]) {
    int256[] memory input_layer = new int256[](nn);
    return input_layer;
  }

  function get_hidden_layers(uint[] l_nn) private pure returns (int256[]) {
    uint total_nn = 0;
    // Skip first and last layer since they're not hidden layers
    for (uint i = 1; i < l_nn.length-1; i++) {
      total_nn += l_nn[i];
    }
    int256[] memory hidden_layers = new int256[](total_nn);
    return hidden_layers;
  }

  function access_hidden_layer(int256[] hls, uint[] l_nn, uint index) private pure returns (int256[]) {
    // TODO: Bug is here, doesn't work for between last hidden and output layer
    // Returns the hidden layer from the hidden layers array
    int256[] memory hidden_layer = new int256[](l_nn[index+1]);
    uint hidden_layer_index = 0;
    uint start = 0;
    uint end = 0;
    for (uint i = 0; i < index; i++) {
      start += l_nn[i+1];
    }
    for (uint j = 0; j < (index + 1); j++) {
      end += l_nn[j+1];
    }
    for (uint h_i = start; h_i < end; h_i++) {
      hidden_layer[hidden_layer_index] = hls[h_i];
      hidden_layer_index += 1;
    }
    return hidden_layer;
  }

  function get_prediction(Submission sub, int[datapoint_size] data_point) private pure returns(int256[]) {
    uint[] memory l_nn = new uint[](sub.num_neurons_hidden_layer.length + 2);
    l_nn[0] = sub.num_neurons_input_layer;
    for (uint i = 0; i < sub.num_neurons_hidden_layer.length; i++) {
      l_nn[i+1] = sub.num_neurons_hidden_layer[i];
    }
    l_nn[sub.num_neurons_hidden_layer.length+1] = sub.num_neurons_output_layer;
    return forward_pass(data_point, sub.weights, sub.biases, l_nn);
  }

  function forward_pass(int[datapoint_size] data_point, int256[] weights, int256[] biases, uint[] l_nn) private pure returns (int256[]) {
    // Initialize neuron arrays
    int256[] memory input_layer = get_layer(l_nn[0]);
    int256[] memory hidden_layers = get_hidden_layers(l_nn);
    int256[] memory output_layer = get_layer(l_nn[l_nn.length-1]);

    // load inputs from input layer
    for (uint input_i = 0; input_i < l_nn[0]; input_i++) {
      input_layer[input_i] = data_point[input_i];
    }
    return forward_pass2(l_nn, input_layer, hidden_layers, output_layer, weights, biases);
  }

  function forward_pass2(uint[] l_nn, int256[] input_layer, int256[] hidden_layers, int256[] output_layer, int256[] weights, int256[] biases) public pure returns (int256[]) {
    // index_counter[0] is weight index
    // index_counter[1] is hidden_layer_index
    uint[] memory index_counter = new uint[](2);
    for (uint layer_i = 0; layer_i < (l_nn.length-1); layer_i++) {
      int256[] memory current_layer;
      int256[] memory prev_layer;
      // If between input and first hidden layer
      if (hidden_layers.length != 0) {
        if (layer_i == 0) {
          current_layer = access_hidden_layer(hidden_layers, l_nn, layer_i);
          prev_layer = input_layer;
        // If between output and last hidden layer
        } else if (layer_i == (l_nn.length-2)) {
          current_layer = output_layer;
          prev_layer = access_hidden_layer(hidden_layers, l_nn, (layer_i-1));
        // If between hidden layers
        } else {
          current_layer = access_hidden_layer(hidden_layers, l_nn, layer_i);
          prev_layer = access_hidden_layer(hidden_layers, l_nn, layer_i-1);
        }
      } else {
        current_layer = output_layer;
        prev_layer = input_layer;
      }
      for (uint layer_neuron_i = 0; layer_neuron_i < current_layer.length; layer_neuron_i++) {
        int total = 0;
        for (uint prev_layer_neuron_i = 0; prev_layer_neuron_i < prev_layer.length; prev_layer_neuron_i++) {
          total += prev_layer[prev_layer_neuron_i] * weights[index_counter[0]];
          index_counter[0]++;
        }
        total += biases[layer_i];
        total = total / int_precision; // Divide by int_precision to scale down
        // If between output and last hidden layer
        if (layer_i == (l_nn.length-2)) {
            output_layer[layer_neuron_i] = relu_activation(total);
        } else {
            hidden_layers[index_counter[1]] = relu_activation(total);
        }
        index_counter[1]++;
      }
    }
    return output_layer;
  }

  // Fallback function for sending ether to this contract
  function () public payable {}
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"init1_block_height","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"init2","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"submission_index","type":"uint256"}],"name":"evaluate_model","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"submission_index","type":"uint256"},{"name":"data","type":"int256[3][]"}],"name":"model_accuracy","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"get_training_index","outputs":[{"name":"","type":"uint256[16]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"evaluation_stage_block_size","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"test_data","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"get_testing_index","outputs":[{"name":"","type":"uint256[4]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_test_data_groups","type":"int256[]"},{"name":"_test_data_group_nonces","type":"int256"}],"name":"reveal_test_data","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"paymentAddress","type":"address"},{"name":"num_neurons_input_layer","type":"uint256"},{"name":"num_neurons_output_layer","type":"uint256"},{"name":"num_neurons_hidden_layer","type":"uint256[]"},{"name":"weights","type":"int256[]"},{"name":"biases","type":"int256[]"}],"name":"get_submission_id","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"best_submission_index","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"use_test_data","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_train_data_groups","type":"int256[]"},{"name":"_train_data_group_nonces","type":"int256"}],"name":"init3","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"l_nn","type":"uint256[]"},{"name":"input_layer","type":"int256[]"},{"name":"hidden_layers","type":"int256[]"},{"name":"output_layer","type":"int256[]"},{"name":"weights","type":"int256[]"},{"name":"biases","type":"int256[]"}],"name":"forward_pass2","outputs":[{"name":"","type":"int256[]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_hashed_data_groups","type":"bytes32[20]"},{"name":"accuracy_criteria","type":"int256"},{"name":"organizer_refund_address","type":"address"}],"name":"init1","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"organizer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"init_level","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"testing_partition","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"get_train_data_length","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"best_submission_accuracy","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"finalize_contract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"contract_terminated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"init3_block_height","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"get_submission_queue_length","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"payment_address","type":"address"},{"name":"num_neurons_input_layer","type":"uint256"},{"name":"num_neurons_output_layer","type":"uint256"},{"name":"num_neurons_hidden_layer","type":"uint256[]"},{"name":"weights","type":"int256[]"},{"name":"biases","type":"int256[]"}],"name":"submit_model","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"training_partition","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"reveal_test_data_groups_block_size","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"cancel_contract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"model_accuracy_criteria","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"train_data","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"get_test_data_length","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"submission_stage_block_size","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}]

606060405260006002556000600460006101000a81548160ff0219169083151502179055506203b100603055614380603155619d8060325560006035556000604a556000604b556000604d60006101000a81548160ff021916908315150217905550341561006c57600080fd5b6130748061007b6000396000f300606060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302a3036d14610198578063069489a2146101c157806310b787d1146101d657806325172c4a146101f9578063251fbe37146102ac5780632e2a6488146102fd578063336664b51461032657806339d51cc0146103665780633dc37539146103b75780633f45c373146103ee578063515ced531461050d5780635bf72bb1146105365780635cd27e8d146105635780635e8153201461059a5780635fce2b3d1461078957806361203265146107d357806366b7afbf146108285780636a2e2076146108515780636bc32c7b146108885780636d48ae25146108b15780637053fe8d146108da578063764c499b146108ef5780637e1db5161461091c57806389128b701461094557806392e43b521461096e578063957b162214610a7957806399b47af814610ab0578063a7f8fbd414610ad9578063a8f5660014610aee578063c158a0b214610b17578063c78974de14610b57578063ebaa32f314610b80575b005b34156101a357600080fd5b6101ab610ba9565b6040518082815260200191505060405180910390f35b34156101cc57600080fd5b6101d4610baf565b005b34156101e157600080fd5b6101f76004808035906020019091905050610c9f565b005b341561020457600080fd5b61029660048080359060200190919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610288578484839050606002016003806020026040519081016040528092919082600360200280828437820191505050505081526020019060010190610243565b505050505091905050610e67565b6040518082815260200191505060405180910390f35b34156102b757600080fd5b6102bf611362565b6040518082601060200280838360005b838110156102ea5780820151818401526020810190506102cf565b5050505090500191505060405180910390f35b341561030857600080fd5b6103106113ad565b6040518082815260200191505060405180910390f35b341561033157600080fd5b61035060048080359060200190919080359060200190919050506113b3565b6040518082815260200191505060405180910390f35b341561037157600080fd5b6103796113e9565b6040518082600460200280838360005b838110156103a4578082015181840152602081019050610389565b5050505090500191505060405180910390f35b34156103c257600080fd5b6103ec60048080359060200190820180359060200191909192908035906020019091905050611434565b005b34156103f957600080fd5b6104f7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611587565b6040518082815260200191505060405180910390f35b341561051857600080fd5b610520611812565b6040518082815260200191505060405180910390f35b341561054157600080fd5b610549611818565b604051808215151515815260200191505060405180910390f35b341561056e57600080fd5b6105986004808035906020019082018035906020019190919290803590602001909190505061182b565b005b34156105a557600080fd5b6107326004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611968565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561077557808201518184015260208101905061075a565b505050509050019250505060405180910390f35b341561079457600080fd5b6107d16004808061028001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611bca565b005b34156107de57600080fd5b6107e6611c8e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561083357600080fd5b61083b611cb3565b6040518082815260200191505060405180910390f35b341561085c57600080fd5b6108726004808035906020019091905050611cb9565b6040518082815260200191505060405180910390f35b341561089357600080fd5b61089b611cd3565b6040518082815260200191505060405180910390f35b34156108bc57600080fd5b6108c4611ce0565b6040518082815260200191505060405180910390f35b34156108e557600080fd5b6108ed611ce6565b005b34156108fa57600080fd5b610902611fd8565b604051808215151515815260200191505060405180910390f35b341561092757600080fd5b61092f611feb565b6040518082815260200191505060405180910390f35b341561095057600080fd5b610958611ff1565b6040518082815260200191505060405180910390f35b341561097957600080fd5b610a77600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611ffe565b005b3415610a8457600080fd5b610a9a60048080359060200190919050506121a2565b6040518082815260200191505060405180910390f35b3415610abb57600080fd5b610ac36121bc565b6040518082815260200191505060405180910390f35b3415610ae457600080fd5b610aec6121c2565b005b3415610af957600080fd5b610b01612284565b6040518082815260200191505060405180910390f35b3415610b2257600080fd5b610b41600480803590602001909190803590602001909190505061228a565b6040518082815260200191505060405180910390f35b3415610b6257600080fd5b610b6a6122c0565b6040518082815260200191505060405180910390f35b3415610b8b57600080fd5b610b936122cd565b6040518082815260200191505060405180910390f35b60335481565b610bb7612c0c565b6000801515604d60009054906101000a900460ff161515141515610bd757fe5b6001603554141515610be557fe5b6014603354014311158015610bfb575060335443115b15610c925760196101f461ffff16811515610c1257fe5b04604051805910610c205750595b90808252806020026020018201604052509150600090505b60196101f461ffff16811515610c4a57fe5b04811015610c7c57808282815181101515610c6157fe5b90602001906020020181815250508080600101915050610c38565b610c85826122d3565b6002603581905550610c9b565b610c9a6121c2565b5b5050565b6000801515604d60009054906101000a900460ff161515141515610cbf57fe5b6003603554141515610ccd57fe5b60315460305460345401014310151515610ce357fe5b60325460315460305460345401010143101515610cfc57fe5b6000905060011515600460009054906101000a900460ff1615151415610db557610dae82602e805480602002602001604051908101604052809291908181526020016000905b82821015610da55783829060005260206000209060030201600380602002604051908101604052809291908260038015610d91576020028201915b815481526020019060010190808311610d7d575b505050505081526020019060010190610d42565b50505050610e67565b9050610e4a565b610e4782602d805480602002602001604051908101604052809291908181526020016000905b82821015610e3e5783829060005260206000209060030201600380602002604051908101604052809291908260038015610e2a576020028201915b815481526020019060010190808311610e16575b505050505081526020019060010190610ddb565b50505050610e67565b90505b600254811315610e635781600181905550806002819055505b5050565b6000610e71612c20565b6000806000610e7e612c7f565b610e86612c7f565b60008060008060001515604d60009054906101000a900460ff161515141515610eab57fe5b6003603554141515610eb957fe5b604c8d815481101515610ec857fe5b906000526020600020906006020160c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020018280548015610f9b57602002820191906000526020600020905b815481526020019060010190808311610f87575b5050505050815260200160048201805480602002602001604051908101604052809291908181526020018280548015610ff357602002820191906000526020600020905b815481526020019060010190808311610fdf575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561104b57602002820191906000526020600020905b815481526020019060010190808311611037575b5050505050815250509950600098506000975089604001516001800114156110c0576001965089604001516040518059106110835750595b9080825280602002602001820160405250955089604001516040518059106110a85750595b90808252806020026020018201604052509450611109565b6000965060016040518059106110d35750595b9080825280602002602001820160405250955060016040518059106110f55750595b908082528060200260200182016040525094505b600093505b8b5184101561133e57600160030392505b8b8481518110151561112d57fe5b906020019060200201515060038310156112ab576001600384030191506001151587151514156112575760008c8581518110151561116757fe5b906020019060200201518460038110151561117e57fe5b602002015114156111cd576001858381518110151561119957fe5b9060200190602002018181525050600085600184018151811015156111ba57fe5b9060200190602002018181525050611252565b60018c858151811015156111dd57fe5b90602001906020020151846003811015156111f457fe5b60200201511415611243576000858381518110151561120f57fe5b90602001906020020181815250506001856001840181518110151561123057fe5b9060200190602002018181525050611251565b6000151561125057600080fd5b5b5b61129e565b8b8481518110151561126557fe5b906020019060200201518360038110151561127c57fe5b6020020151858381518110151561128f57fe5b90602001906020020181815250505b828060010193505061111f565b6112cc8a8d868151811015156112bd57fe5b90602001906020020151612425565b9550600090505b84518110156113315785818151811015156112ea57fe5b90602001906020020151858281518110151561130257fe5b90602001906020020151141561131d57600189019850611324565b6001880197505b80806001019150506112d3565b838060010194505061110e565b8789016127108a0281151561134f57fe5b059a505050505050505050505092915050565b61136a612c93565b60366010806020026040519081016040528092919082601080156113a3576020028201915b81548152602001906001019080831161138f575b5050505050905090565b60325481565b602e828154811015156113c257fe5b9060005260206000209060030201816003811015156113dd57fe5b01600091509150505481565b6113f1612cbc565b604660048060200260405190810160405280929190826004801561142a576020028201915b815481526020019060010190808311611416575b5050505050905090565b60001515604d60009054906101000a900460ff16151514151561145357fe5b600360355414151561146157fe5b60305460345401431015151561147357fe5b60315460305460345401014310151561148857fe5b6001600360198585905081151561149b57fe5b048115156114a557fe5b041415156114af57fe5b60056046604b546004811015156114c257fe5b01546014811015156114d057fe5b01546000191661150f84848080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505083612523565b6000191614151561151c57fe5b6001604b600082825401925050819055506115678383808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050506000612649565b6001600460006101000a81548160ff021916908315150217905550505050565b60008060008060008093505b604c805490508410156117f6578a73ffffffffffffffffffffffffffffffffffffffff16604c858154811015156115c657fe5b906000526020600020906006020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561161a576117e9565b89604c8581548110151561162a57fe5b906000526020600020906006020160010154141515611648576117e9565b88604c8581548110151561165857fe5b906000526020600020906006020160020154141515611676576117e9565b600092505b87518310156116ef57878381518110151561169257fe5b90602001906020020151604c858154811015156116ab57fe5b9060005260206000209060060201600301848154811015156116c957fe5b9060005260206000209001541415156116e1576116e2565b5b828060010193505061167b565b600091505b865182101561176857868281518110151561170b57fe5b90602001906020020151604c8581548110151561172457fe5b90600052602060002090600602016004018381548110151561174257fe5b90600052602060002090015414151561175a5761175b565b5b81806001019250506116f4565b600090505b85518110156117e157858181518110151561178457fe5b90602001906020020151604c8581548110151561179d57fe5b9060005260206000209060060201600501828154811015156117bb57fe5b9060005260206000209001541415156117d3576117d4565b5b808060010191505061176d565b839450611804565b8380600101945050611593565b6000151561180357600080fd5b5b505050509695505050505050565b60015481565b600460009054906101000a900460ff1681565b60001515604d60009054906101000a900460ff16151514151561184a57fe5b600260355414151561185857fe5b6001600360198585905081151561186b57fe5b0481151561187557fe5b0414151561187f57fe5b60056036604a5460108110151561189257fe5b01546014811015156118a057fe5b0154600019166118df84848080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505083612523565b600019161415156118ec57fe5b6001604a600082825401925050819055506119378383808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050506001612649565b601961019061ffff1681151561194957fe5b04604a541415611963576003603581905550436034819055505b505050565b611970612c7f565b611978612c0c565b6000611982612c7f565b61198a612c7f565b6000806000600260405180591061199e5750595b90808252806020026020018201604052509650600095505b60018e5103861015611bb65760008c51141515611a335760008614156119eb576119e18c8f8861282c565b94508c9350611a2e565b60028e5103861415611a0f578a9450611a088c8f6001890361282c565b9350611a2d565b611a1a8c8f8861282c565b9450611a2a8c8f6001890361282c565b93505b5b611a3a565b8a94508c93505b600092505b8451831015611ba95760009150600090505b8351811015611ad85789876000815181101515611a6a57fe5b90602001906020020151815181101515611a8057fe5b906020019060200201518482815181101515611a9857fe5b906020019060200201510282019150866000815181101515611ab657fe5b9060200190602002018051809190600101815250508080600101915050611a51565b8886815181101515611ae657fe5b906020019060200201518201915061271082811515611b0157fe5b05915060028e5103861415611b3a57611b1982612965565b8b84815181101515611b2757fe5b9060200190602002018181525050611b78565b611b4382612965565b8c886001815181101515611b5357fe5b90602001906020020151815181101515611b6957fe5b90602001906020020181815250505b866001815181101515611b8757fe5b9060200190602002018051809190600101815250508280600101935050611a3f565b85806001019650506119b6565b8a9750505050505050509695505050505050565b60001515604d60009054906101000a900460ff161515141515611be957fe5b6000603554141515611bf757fe5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016035819055504360338190555060196101f461ffff16811515611c5857fe5b046014141515611c6457fe5b826005906014611c75929190612ce4565b50600082131515611c8257fe5b81600381905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60355481565b604681600481101515611cc857fe5b016000915090505481565b6000602d80549050905090565b60025481565b611cee612c20565b60001515604d60009054906101000a900460ff161515141515611d0d57fe5b6003603554141515611d1b57fe5b6032546031546030546034540101014310151515611d3557fe5b604c600154815481101515611d4657fe5b906000526020600020906006020160c060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020018280548015611e1957602002820191906000526020600020905b815481526020019060010190808311611e05575b5050505050815260200160048201805480602002602001604051908101604052809291908181526020018280548015611e7157602002820191906000526020600020905b815481526020019060010190808311611e5d575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015611ec957602002820191906000526020600020905b815481526020019060010190808311611eb5575b5050505050815250509050600354600254121515611f4157806000015173ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611f3c57600080fd5b611fba565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611fb957600080fd5b5b6001604d60006101000a81548160ff02191690831515021790555050565b604d60009054906101000a900460ff1681565b60345481565b6000604c80549050905090565b60001515604d60009054906101000a900460ff16151514151561201d57fe5b600360355414151561202b57fe5b603054603454014310151561203c57fe5b60016003038514151561204b57fe5b600184148061205c57506001800184145b151561206457fe5b61207082868686612981565b151561207857fe5b604c805480600101828161208c9190612d2e565b9160005260206000209060060201600060c0604051908101604052808a73ffffffffffffffffffffffffffffffffffffffff16815260200189815260200188815260200187815260200186815260200185815250909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155606082015181600301908051906020019061215c929190612d60565b506080820151816004019080519060200190612179929190612dad565b5060a0820151816005019080519060200190612196929190612dad565b50505050505050505050565b6036816010811015156121b157fe5b016000915090505481565b60315481565b60001515604d60009054906101000a900460ff1615151415156121e157fe5b60036035541015156121ef57fe5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561226757600080fd5b6001604d60006101000a81548160ff021916908315150217905550565b60035481565b602d8281548110151561229957fe5b9060005260206000209060030201816003811015156122b457fe5b01600091509150505481565b6000602e80549050905090565b60305481565b6000806000806000935084519250600091505b60108410156123cb578260028343034060006040516020015260405180826000191660001916815260200191505060206040518083038160008661646e5a03f1151561233157600080fd5b5050604051805190506001900481151561234757fe5b069050848181518110151561235857fe5b9060200190602002015160368560108110151561237157fe5b0181905550846001840381518110151561238757fe5b90602001906020020151858281518110151561239f57fe5b9060200190602002018181525050828060019003935050818060010192505083806001019450506122e6565b600093505b600484101561241e5784600184038151811015156123ea57fe5b9060200190602002015160468560048110151561240357fe5b018190555082806001900393505083806001019450506123d0565b5050505050565b61242d612c7f565b612435612c0c565b600060028560600151510160405180591061244d5750595b90808252806020026020018201604052509150846020015182600081518110151561247457fe5b9060200190602002018181525050600090505b8460600151518110156124dc578460600151818151811015156124a657fe5b9060200190602002015182600183018151811015156124c157fe5b90602001906020020181815250508080600101915050612487565b8460400151826001876060015151018151811015156124f757fe5b90602001906020020181815250506125198486608001518760a0015185612a62565b9250505092915050565b6000806000612530612c7f565b6000809350601960030292506001830160405180591061254d5750595b90808252806020026020018201604052509150600090505b828110156125b457868181518110151561257b57fe5b90602001906020020151828581518110151561259357fe5b90602001906020020181815250506001840193508080600101915050612565565b8582858151811015156125c357fe5b906020019060200201818152505060028260006040516020015260405180828051906020019060200280838360005b8381101561260d5780820151818401526020810190506125f2565b5050505090500191505060206040518083038160008661646e5a03f1151561263457600080fd5b50506040518051905094505050505092915050565b612651612dfa565b6000806000806003875181151561266457fe5b046040518059106126725750595b9080825280602002602001820160405280156126a857816020015b612695612e0e565b81526020019060019003908161268d5790505b509450600093505b600387518115156126bd57fe5b0484101561273857600092505b600383101561272b57868360038602018151811015156126e657fe5b9060200190602002015185858151811015156126fe57fe5b906020019060200201518460038110151561271557fe5b60200201818152505082806001019350506126ca565b83806001019450506126b0565b6001151586151514156127b657600091505b84518210156127b157602d80548060010182816127679190612e36565b91600052602060002090600302016000878581518110151561278557fe5b9060200190602002015190919091509060036127a2929190612e68565b5050818060010192505061274a565b612823565b600090505b845181101561282257602e80548060010182816127d89190612e36565b9160005260206000209060030201600087848151811015156127f657fe5b906020019060200201519091909150906003612813929190612e68565b505080806001019150506127bb565b5b50505050505050565b612834612c7f565b61283c612c7f565b6000806000806000808960018a0181518110151561285657fe5b9060200190602002015160405180591061286d5750595b90808252806020026020018201604052509650600095506000945060009350600092505b888310156128c55789600184018151811015156128aa57fe5b90602001906020020151850194508280600101935050612891565b600091505b600189018210156129015789600183018151811015156128e657fe5b906020019060200201518401935081806001019250506128ca565b8490505b83811015612954578a8181518110151561291b57fe5b90602001906020020151878781518110151561293357fe5b90602001906020020181815250506001860195508080600101915050612905565b869750505050505050509392505050565b600080821215612978576000905061297c565b8190505b919050565b6000806000806000809350600092508551600201915060028214156129aa578688029350612a4d565b600090505b8551811015612a2a5760008114156129e45785818151811015156129cf57fe5b90602001906020020151880284019350612a1d565b85818151811015156129f257fe5b906020019060200201518660018303815181101515612a0d57fe5b9060200190602002015102840193505b80806001019150506129af565b86866001885103815181101515612a3d57fe5b9060200190602002015102840193505b88519250828414945050505050949350505050565b612a6a612c7f565b612a72612c7f565b612a7a612c7f565b612a82612c7f565b6000612aa5866000815181101515612a9657fe5b90602001906020020151612b55565b9350612ab086612b8f565b9250612ad6866001885103815181101515612ac757fe5b90602001906020020151612b55565b9150600090505b856000815181101515612aec57fe5b90602001906020020151811015612b39578881600381101515612b0b57fe5b60200201518482815181101515612b1e57fe5b90602001906020020181815250508080600101915050612add565b612b47868585858c8c611968565b945050505050949350505050565b612b5d612c7f565b612b65612c7f565b82604051805910612b735750595b9080825280602002602001820160405250905080915050919050565b612b97612c7f565b600080612ba2612c7f565b60009250600191505b6001855103821015612be0578482815181101515612bc557fe5b90602001906020020151830192508180600101925050612bab565b82604051805910612bee5750595b90808252806020026020018201604052509050809350505050919050565b602060405190810160405280600081525090565b60c060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001612c5f612ea8565b8152602001612c6c612ebc565b8152602001612c79612ebc565b81525090565b602060405190810160405280600081525090565b610200604051908101604052806010905b6000815260200190600190039081612ca45790505090565b6080604051908101604052806004905b6000815260200190600190039081612ccc5790505090565b8260148101928215612d1d579160200282015b82811115612d1c57823560001916829060001916905591602001919060010190612cf7565b5b509050612d2a9190612ed0565b5090565b815481835581811511612d5b57600602816006028360005260206000209182019101612d5a9190612ef5565b5b505050565b828054828255906000526020600020908101928215612d9c579160200282015b82811115612d9b578251825591602001919060010190612d80565b5b509050612da99190612f7b565b5090565b828054828255906000526020600020908101928215612de9579160200282015b82811115612de8578251825591602001919060010190612dcd565b5b509050612df69190612fa0565b5090565b602060405190810160405280600081525090565b6060604051908101604052806003905b6000815260200190600190039081612e1e5790505090565b815481835581811511612e6357600302816003028360005260206000209182019101612e629190612fc5565b5b505050565b8260038101928215612e97579160200282015b82811115612e96578251825591602001919060010190612e7b565b5b509050612ea49190612fa0565b5090565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b612ef291905b80821115612eee576000816000905550600101612ed6565b5090565b90565b612f7891905b80821115612f7457600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160009055600382016000612f4b9190612ff1565b600482016000612f5b9190613012565b600582016000612f6b9190613012565b50600601612efb565b5090565b90565b612f9d91905b80821115612f99576000816000905550600101612f81565b5090565b90565b612fc291905b80821115612fbe576000816000905550600101612fa6565b5090565b90565b612fee91905b80821115612fea5760008181612fe19190613033565b50600301612fcb565b5090565b90565b508054600082559060005260206000209081019061300f9190612f7b565b50565b50805460008255906000526020600020908101906130309190612fa0565b50565b506000815560010160008155600101600090555600a165627a7a7230582095f7601eee82fbca9dd4d614f32b2efeab39e868434f6a5245a8bbb0e785e8c30029

Swarm Source

bzzr://95f7601eee82fbca9dd4d614f32b2efeab39e868434f6a5245a8bbb0e785e8c3
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.