Arvtagaren by Christopher Paolini

Book Four of the Inheritance Cycle

A farm boy finds a mysterious blue stone that hatches into a dragon and is swept from his quiet life into a dangerous world of ancient magic, hidden legacies, and political rebellion; guided by a secretive mentor and forced to learn swordsmanship and spellcraft, he uncovers truths about his heritage and the vanished order of Dragon Riders while joining a nascent resistance against a ruthless king to protect the people he cares for.