The Avestas were collated over several hundred years. The oldest portion, the Gathas are the hymns written by Zoroaster himself. The later portions constitute elaborations of Zoroastrian thinking along with detailed descriptions of ritual practices.
According to legend the full text of the Avestas was destroyed by Alexander the Great when he invaded Persia. It was later only partly reconstructed from the memories of Zoroastrian priests. This story is not generally accepted by scholars now, but it is acknowledged that the existing text of the Avsesta is a fraction of the full texts that existed in antiquity, befoe the decline of the Zoroastrian faith.