In the 17th century the northern part of what is now Vietnam belonged to the kingdom of Tonkin. The country was a major silk producer. The silk which the VOC bought there was particularly valuable for trade with Japan. Towards the end of the 1630s, the Company signed an agreement with the king of Tonkin and opened a trading post in or near today's Hanoi. The VOC maintained a trading post in Tonkin from 1636 to 1699. This trading post was run by an 'opperhoofd' or supervisor.