store chainhead in db