Replay protection and time sync

Closes #1