the territory of the then Kievan Rus') occurs in the 10th-century policy manual by Byzantine emperor Constantine VII. Princely state within Kievan Rus' In 882, Rurik's successor, Oleg of Novgorod, conquered Kiev and founded the state of Kievan Rus'. Novgorod's size as well as its political, economic, and cultural influence made it the second most important city in Kievan Rus'. According to a custom, the elder son and heir of the ruling Kievan monarch was sent to rule Novgorod even as a minor. When the ruling monarch had no such son, Novgorod was governed by posadniks, such as the legendary Gostomysl, Dobrynya, Konstantin, and Ostromir. Of all their princes, Novgorodians most cherished the memory of Yaroslav the Wise, who sat as Prince of Novgorod from 1010 to 1019, while his father, Vladimir the Great, was a prince in Kiev. Yaroslav promulgated the first written code of laws (later incorporated into Russkaya Pravda) among the Eastern Slavs and is said to have granted the city a number of freedoms or privileges, which they often referred to in later centuries as precedents in their relations with other princes. His son, Vladimir, sponsored construction of the great St. Sophia Cathedral, more accurately translated as the Cathedral of Holy Wisdom, which stands to this day. Early foreign ties In Norse sagas the city is mentioned as the capital of Gardariki. Many Viking kings and yarls came to Novgorod seeking refuge or employment, including Olaf I of Norway, Olaf II of Norway, Magnus I of Norway, and Harald Hardrada. No more than a few decades after the 1030 death and subsequent canonization of Olaf II of Norway, the city's community had erected in his memory Saint Olaf's Church in Novgorod. The Gotland town of Visby functioned as the leading trading center in the Baltic before the Hansa League. At Novgorod in 1080, Visby merchants established a trading post which they named Gutagard (also known as Gotenhof). Later, in the first half of the 13th century, merchants from northern Germany also established their own trading station in Novgorod, known as Peterhof. At about the same time, in 1229, German merchants at Novgorod were granted certain privileges, which made their position more secure. Novgorod Republic In 1136, the Novgorodians dismissed their prince Vsevolod Mstislavich. The year is seen as the traditional beginning of the Novgorod Republic. The city was able to invite and dismiss a number of