1

EOS requires token holders to generate public keys and register them, by using their "register" function in their smart contract. Here's the function (copied from Etherscan):

mapping (address => string) public keys;
...
event LogRegister (address user, string key);    
...
// Value should be a public key.  Read full key import policy.
// Manually registering requires a base58
// encoded using the STEEM, BTS, or EOS public key format.
function register(string key) {
    assert(today() <=  numberOfDays + 1);
    assert(bytes(key).length <= 64);

    keys[msg.sender] = key;

    LogRegister(msg.sender, key);
}

They store the public keys in:

keys[msg.sender] = key;

I'm thinking of doing something similar, but I do not see how EOS extracts and downloads the "keys" array. EOS does not have a function to iterate through this array and to return the values. How does one download the "keys" array?

Is it possible to get all of the values from "keys" from Etherscan (because of LogRegister event)? If so, how?

2

In the declaration of the variable, the keyword public is used:

mapping (address => string) public keys;

Not:

mapping (address => string) keys;

When that public` keyword is set like that, Solidity makes a getter function with the same name as the variable automatically when compiled.

Hence, when looking at the EOS contract in Etherscan, under the "Read Smart Contract" tab, there's a "keys" option. However, it does not present the whole map to you; you must know the address you wish to look up in order to get just that value back. For EOS's application's purposes, it must not have a need for an exhaustive list of everyone's keys, it typically only would care about the keys of the account interacting with it, so the default getter works just fine for that purpose.

To get a list of all records in that mapping, yes, you could use the JSON-RPC methods or web3js methods to query all the LogRegister events, and build up the complete list.

  • Thanks for your answer. Yes, EOS will need the exhaustive list of everyone's keys, in order to map their EOS Ethereum tokens to the new EOS blockchain in order to be allocated the EOS blockchain tokens. I haven't confirmed that JSON-RPC methods or web3.js methods will query all of the LogRegister events, but it sounds logical and like they should be able to. – Curt Aug 24 '17 at 12:17
  • @Curt They don't need an exhaustive list if, when their blockchain launches, the way a user gets their EOS Ethereum tokens transferred is they need to submit a "claim/transfer" transaction from the account that holds the EOS tokens. That way they don't need to have a master list, and it's up to the users to convert or not. If EOS tried to transfer all tokens in one "convert" action, that would likely be a prohibitively huge transaction on either blockchain. – MidnightLightning Aug 24 '17 at 13:28
  • See eos.io/faq.html : "any person who wishes to launch an EOS Platform adopting the EOS.IO Software will be able to generate a JSON file mapping EOS public keys to the fixed balances of the EOS Tokens from the state of the Ethereum blockchain...EOS.IO Software is built such that any EOS Platform that adopts the EOS.IO Software will require approval of holders of not less than 15% of the total issued EOS Tokens before tokens on such blockchain (the “Blockchain Tokens”) can be transferred." Doesn't that sound like an exhaustive JSON list will be needed? – Curt Aug 24 '17 at 14:27
  • Ah, possibly. In that case they may generate the JSON file via analyzing the LogRegister events or some such. Getting approval of 15% of EOS token holders doesn't need the exhaustive list; it only requires knowing the total supply (to figure out 15% of that total), and as votes come in from individual token-holders, their one address can be looked up to see how much they're contributing to reach that 15% threshold. – MidnightLightning Aug 24 '17 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.