Refactor hash building of device
Add v2 api for server