adapted for Cachecoin