Blockchain bugfix & use generics

- Using DBIterator.hasNext() function to check if DB is empty instead of looking at index.size() which will always be empty at initialization.
- Added missing generics to HashMap in TrackTrie
- Update Cache to use the same ByteArrayWrapper. Because a byte[] should not be used as a unique key in a map. As discussed here: http://stackoverflow.com/a/1058169 - Currently it works fine but might cause issues in the future,