Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 8 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7at txn 0x4bdf54914b5401d9130f4e2f093848ff271db1e63a4d4ce6a4a5f269cb9708f6
 Latest 8 txns

TxHash Age From To Value [TxFee]
0xc8683004d610d5b98798e15b8e35320e95e873d25996815b255d884fd4366f454 days 3 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.0002135016
0x1702f194507d5f5b54ababdd767513a3c30107be2027ee18578ffbebaa46fa5536 days 2 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.0001675975
0xf354e9622fdfb19c5c6269aa6a7cf4278b6aa6d53e77f75cc75a10c9f62bd8c063 days 4 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.0001073648
0x0757baa6540a99b992cebd48cd0c51a17af5d3d7fead6f618bf5b16dc0fb9b9d63 days 4 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.0001424368
0xc87bce223dc5e99fd6eed4e40eb03fc1427507d68bb65b2e1ab662cbd6ab7c8763 days 20 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.0001425392
0xdcb52975c58889b33217bb59a8f796b84ceb714997af045e0a303f1fe2fbd8bc65 days 10 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.000089087
0x3721f22dcb26e7a364b19f3f66f0f35ca3f6329a2154c1e5673c16a3a8283cbc67 days 5 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN   0x997715d0eb47a50d7521ed0d2d023624a4333f9a0 Ether0.000255162
0x4bdf54914b5401d9130f4e2f093848ff271db1e63a4d4ce6a4a5f269cb9708f671 days 12 hrs ago0x00c2b10d58daeaaa7c11a8e79542fb7568e1c2c7  IN    Contract Creation0 Ether0.0012318
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: PubKeyTrust
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity 0.4.24;

/**
 * This contract is used to protect the users of Storm4:
 * https://www.storm4.cloud
 * 
 * That is, to ensure the public keys of users are verifiable, auditable & tamper-proof.
 * 
 * Here's the general idea:
 * - We batch the public keys of multiple users into a merkle tree.
 * - We publish the merkle tree root to this contract.
 * - The merkle tree root for any user can only be assigned once.
 * 
 * In order to verify a user:
 * - Use this contract to fetch the merkle tree root value for the userID.
 * - Then use HTTPS to fetch the corresponding merkle file from our server.
 *   For example, if the merkle tree root value is
 *   "0xcd59b7bda6dc1dd82cb173d0cdfa408db30e9a747d4366eb5b60597899eb69c1",
 *   then you could fetch the corresponding JSON file at
 *   https://blockchain.storm4.cloud/cd59b7bda6dc1dd82cb173d0cdfa408db30e9a747d4366eb5b60597899eb69c1.json
 * - The JSON file allows you to independently verify the public key information
 *   by calculating the merkle tree root for yourself.
**/
contract PubKeyTrust {
	address public owner;
	string public constant HASH_TYPE = "sha256";

	/**
	 * users[userID] => merkleTreeRoot
	 * 
	 * A value of zero indicates that a merkleTreeRoot has not been
	 * published for the userID.
	**/
	mapping(bytes20 => bytes32) private users;
	
	/**
	 * merkleTreeRoots[merkleTreeRootValue] => blockNumber
	 * 
	 * Note: merkleTreeRoots[0x0] is initialized in the constructor to store
	 * the block number of when the contract was published.
	**/
	mapping(bytes32 => uint) private merkleTreeRoots;

	constructor() public {
		owner = msg.sender;
		merkleTreeRoots[bytes32(0)] = block.number;
	}

	modifier onlyByOwner()
	{
		if (msg.sender != owner)
			require(false);
		else
			_;
	}

	/**
	 * We originally passed the userIDs as: bytes20[] userIDs
	 * But it was discovered that this was inefficiently packed,
	 * and ended up sending 12 bytes of zero's per userID.
	 * Since gtxdatazero is set to 4 gas/bytes, this translated into
	 * 48 gas wasted per user due to inefficient packing.
	**/
	function addMerkleTreeRoot(bytes32 merkleTreeRoot, bytes userIDsPacked) public onlyByOwner {

		if (merkleTreeRoot == bytes32(0)) require(false);

		bool addedUser = false;

		uint numUserIDs = userIDsPacked.length / 20;
		for (uint i = 0; i < numUserIDs; i++)
		{
			bytes20 userID;
			assembly {
				userID := mload(add(userIDsPacked, add(32, mul(20, i))))
			}

			bytes32 existingMerkleTreeRoot = users[userID];
			if (existingMerkleTreeRoot == bytes32(0))
			{
				users[userID] = merkleTreeRoot;
				addedUser = true;
			}
		}

		if (addedUser && (merkleTreeRoots[merkleTreeRoot] == 0))
		{
			merkleTreeRoots[merkleTreeRoot] = block.number;
		}
	}

	function getMerkleTreeRoot(bytes20 userID) public view returns (bytes32) {

		return users[userID];
	}

	function getBlockNumber(bytes32 merkleTreeRoot) public view returns (uint) {

		return merkleTreeRoots[merkleTreeRoot];
	}

    function getUserInfo(bytes20 userID) public view returns (bytes32, uint) {
        
        bytes32 merkleTreeRoot = users[userID];
        uint blockNumber = merkleTreeRoots[merkleTreeRoot];
        
        return (merkleTreeRoot, blockNumber);
    }	
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"merkleTreeRoot","type":"bytes32"},{"name":"userIDsPacked","type":"bytes"}],"name":"addMerkleTreeRoot","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"merkleTreeRoot","type":"bytes32"}],"name":"getBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"userID","type":"bytes20"}],"name":"getUserInfo","outputs":[{"name":"","type":"bytes32"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"HASH_TYPE","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"userID","type":"bytes20"}],"name":"getMerkleTreeRoot","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555043600260008060010260001916600019168152602001908152602001600020819055506105d1806100836000396000f300608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312e365301461007d57806347378145146100f4578063829a34c6146101395780638da5cb5b14610198578063b01c68be146101ef578063ee94c7971461027f575b600080fd5b34801561008957600080fd5b506100f26004803603810190808035600019169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506102d7565b005b34801561010057600080fd5b506101236004803603810190808035600019169060200190929190505050610482565b6040518082815260200191505060405180910390f35b34801561014557600080fd5b5061017360048036038101908080356bffffffffffffffffffffffff191690602001909291905050506104a7565b6040518083600019166000191681526020018281526020019250505060405180910390f35b3480156101a457600080fd5b506101ad61050c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101fb57600080fd5b50610204610531565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610244578082015181840152602081019050610229565b50505050905090810190601f1680156102715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028b57600080fd5b506102b960048036038101908080356bffffffffffffffffffffffff1916906020019092919050505061056a565b60405180826000191660001916815260200191505060405180910390f35b60008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610347576000151561034257600080fd5b610479565b60006001026000191687600019161415610369576000151561036857600080fd5b5b600094506014865181151561037a57fe5b049350600092505b8383101561042a5782601402602001860151915060016000836bffffffffffffffffffffffff19166bffffffffffffffffffffffff191681526020019081526020016000205490506000600102600019168160001916141561041d578660016000846bffffffffffffffffffffffff19166bffffffffffffffffffffffff191681526020019081526020016000208160001916905550600194505b8280600101935050610382565b8480156104525750600060026000896000191660001916815260200190815260200160002054145b156104785743600260008960001916600019168152602001908152602001600020819055505b5b50505050505050565b6000600260008360001916600019168152602001908152602001600020549050919050565b60008060008060016000866bffffffffffffffffffffffff19166bffffffffffffffffffffffff191681526020019081526020016000205491506002600083600019166000191681526020019081526020016000205490508181935093505050915091565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600681526020017f736861323536000000000000000000000000000000000000000000000000000081525081565b600060016000836bffffffffffffffffffffffff19166bffffffffffffffffffffffff191681526020019081526020016000205490509190505600a165627a7a72305820a3e34e5625c9f4c43ef1beaadb29e949c2cd6a051d3d675b319c08a02212796d0029

   Swarm Source:
bzzr://a3e34e5625c9f4c43ef1beaadb29e949c2cd6a051d3d675b319c08a02212796d

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.