How does blockchain.info get the addressbalance / seen date? I am trying to figure out how blockchain.info gets the following API functions and is there any way to do these calls on a server (without using their API) perhaps through bitcoind?

https://blockchain.info/q/addressfirstseen/
https://blockchain.info/q/addressbalance/


Thanks.
I'm actually working on doing this. To get the balance of an address you have to scan the entire blockchain. This can take a while but blockchain.info returns the balance instantly, which means they've already scanned the entire blockchain and are tracking all addresses. That's a lot of data to store, several gigabytes worth.