0

There must be a .dat file or something that stores the accounts in the geth client, where is this file located?

As an aside, are Externally Owned Accounts (EOAs) and Contract Accounts actually represented differently?

Update:

In ~/Library/Ethereum/keystore I found a file called UTC--2017-05-26T21-30-22.367673851Z--ca02951f8bcd593e26f54801a4da85c221f89731 which has been reproduced below:

{
    "address":"ca02951f8bcd593e26f54801a4da85c221f89731",
    "crypto":{
                "cipher":"aes-128-ctr",
                "ciphertext":"8e13b86398de9bc1977153c683315d13771d65b38fcb425a99bcc59761071e1f",
                "cipherparams":{
                                "iv":"49227b95cf1fb8c96c749fe1d180b25b"
                                },
                "kdf":"scrypt",
                "kdfparams":{
                                "dklen":32,
                                "n":262144,
                                "p":1,
                                "r":8,
                                "salt":"6233be72e2478cf7ed4aee675e7862c5d55f23a270cd8c46f66cf37460badca0"
                            },
                "mac":"5243792b391ea7171f23b5378cf77bdcf90f4baa03067ba55d988c6ecb9ee8e5"
            },
    "id":"6b3fba5f-d3cb-452e-9d73-2b760085be71",
    "version":3
}

Would someone please explain to me the significance of this file?

I was under the impression that this would be all the accounts on the entire Ethereum blockchain, but it seems to me that this is perhaps only my own account that was automatically generated when I fired up geth, is that right?

  • After starting the geth node with JSON API enabled, you have a screenshot of what looks like you opening that URL in Mist. That's not how you interact with an RPC API (which is why the screen is just blank). If you want a web-browsable interface for seeing blockchain data, that's what Etherscan.io is; just use that. If you're looking for something specific in the blockchain data, what exactly are you wanting as an output? – MidnightLightning Jun 2 '17 at 16:16
  • basically I want something analygous to the utxo in bitcoin – smatthewenglish Jun 2 '17 at 16:24
  • 1
    Ah sure. That information isn't readily available in Etherscan, but you could parse it yourself using the JSON API. If that's your key goal, probably best to create a new question asking that ("How to get UTXO set using JSON API?"), I can give more details on that – MidnightLightning Jun 2 '17 at 17:20
  • Doing something like that using JSON would take (almost literally) forever :-) Ideally you'd want something to run locally on your machine and read the .ldb files in the downloaded chain data. There are tools available (in Go, Python, Javascript), but you'd need to know what you were doing. – Richard Horrocks Jun 3 '17 at 8:34
1

something that stores the accounts in the geth client, where is this file located?

The accounts are stored in the keystore folder of the data directory. The default data directory is

Mac: ~/Library/Ethereum
Linux: ~/.ethereum
Windows: %APPDATA%\Ethereum

are Externally Owned Accounts (EOAs) and Contract Accounts actually represented differently?

Externally Owned Accounts and Contract Accounts have differences as Externally owned accounts have only value associated with them, whereas Contract Accounts have value, contract code and data associated with them.

Would someone please explain to me the significance of this file?

The keyfile contains data which combined with your password can decrypt your private key, with which anyone can control your account.

Yes, only the accounts that you have generated will be in that keystore.

  • but both types of accounts ultimately live in that file? i.e. ~/Library/Ethereum on MacOS? – smatthewenglish Jun 2 '17 at 12:53
  • man, that isn't really the while story, I mean, that's just a directory that has geth, keystore, and testnet, do you know exactly where the file is located? – smatthewenglish Jun 2 '17 at 12:55
  • Keyfiles are associated only with EOAs with which you can control them. But contract addresses do not have a keyfile associated, they represent the address on blockchain with which you can invoke the contract code. – joifsi Jun 2 '17 at 12:56
  • Inside the keystore you can find the keyfiles associated with the accounts – joifsi Jun 2 '17 at 12:57
  • it seems that is just my own account though, is it so? I've updated to OP with some additional detail – smatthewenglish Jun 2 '17 at 13:08
1

I was under the impression that this would be all the accounts on the entire Ethereum blockchain

The Keyfile on your computer (the one in the keystore folder) is where your private keys are stored, for your own account, so it gives you the ability to spend assets sent to you.

All other accounts (public keys) in the Ethereum blockchain belong to someone else, and you don't have the private keys of those. The data about what funds have been sent/received by any account is in the blockchain data, not the keyfile.

Are you asking about some sort of addressbook functionality? You want to enumerate the public account addresses of other people? Any 160-bit number (64 hexadecimal characters) is a valid Ethereum account number. But, there's no guarantee that anyone holds the private key associated with it and would be able to spend them. So, there's no way to enumerate all addresses that are owned by someone. You could do a reasonable guess by looking at the blockchain and looking at all addresses that have both received Ether and spent it. Some of the addresses that have only received Ether but not spent it could be owned by someone who will eventually spend it, or it could be a dead account that someone "burned" their Ether by sending to it (inadvertently or not).

  • the blockchain data is exactly what I'm looking for, do you know in which file I can find it? I suppose, if I'm running geth, that I got from github or homebrew it should be a full node and I should be able to find the public blockchain data somewhere, isn't it? – smatthewenglish Jun 2 '17 at 14:22
  • The blockchain data itself geth stores compressed on disk in the ~/Library/Ethereum/geth/chaindata folder. But it's not that useful to browse those files directly (since it's just raw binary data). If you want to get information about the blockchain, your best bet is via the JSON API to query your running node, or the geth Javascript console. Alternatively, sites like Etherscan give a friendlier interface for querying blockchain data. – MidnightLightning Jun 2 '17 at 14:26
  • I've posted what the JSON API looks like, that's not really what I'm looking for either. So then, is it the case that there is no global snapshot of the blockchain available on my full node other than what is available in the unintelligible chaindata binaries? – smatthewenglish Jun 2 '17 at 15:22

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.