Chemical and biological evolution of a nucleotide-binding protein