Sitting on a rickety bench at his home in Kipipiri, in central Kenya, Samuel Macharia pulls a piece of paper from his pocket and proudly points to the signature at the bottom.
"This paper means I get paid on time for my potatoes, even when the weather is bad," he said.
The precious document is a farming contract Macharia signed in March with the East African Potato Consortium. It says he will sell at least two tons of potatoes to food processors each harvesting season for the next two years.
"Thanks to this contract I can earn up to 22,000 Kenyan shillings ($213) per season," he said.
Recurring drought and sudden cold spells have affected the quality of potatoes and other staples across Kenya.
Peris Mukami, a farmer from Timau village, in Meru County, said her potato yields had declined by over 10 percent in the past two years because "it is either too cold or too hot."
"The cold damages potato vines with frostbite while heat makes them wilt," she explained.
To try to fight back, Kenyan potato farmers such as Macharia are increasingly turning to production contracts with food processors — a system known as contract farming — through the East African Potato Consortium.
By working with the consortium, they get access to seeds that better stand up to harsher conditions, as well as better fertilizers.
They also get a guaranteed price for their crop, as long as they produce good-quality potatoes on time, said Wachira Kaguongo, head of the National Potato Council.
The consortium, which was set up in 2016 by the National Potato Council, the Alliance for a Green Revolution in Africa and the Grow Africa partnership, aims to increase private investment in agriculture by linking potato farmers with food processors across the country, Kaguongo said.
Each production agreement is reviewed and approved by the National Potato Council, which ensures it is fair to both parties, said Willy Bett, cabinet secretary of the Kenyan Ministry of Agriculture, Livestock and Fisheries.
"Businessmen will always want to get farmers to sign something that may not be favorable to them," Bett told the Thomson Reuters Foundation. "We're trying to prevent that by ensuring that farming activity is done on a contract basis in Kenya."
Contract farming has allowed farmers to sell produce to food giants such as the fast-food chain KFC, formerly known as Kentucky Fried Chicken.
Macharia's potatoes now fetch 22 shillings ($0.20) per kilo, more than double what he used to get when selling them at the Kipipiri open air market.
"I am paid in cash at my farm," he said. "And I do not have to travel to the market when I don't want to."
So far 5,000 farmers have signed up to the system, with a total of 23,000 expected to have made the switch by 2020, said Kaguongo.
Felix Matheri, a researcher at the International Center of Insect Physiology and Ecology, said that while contract farming provides farmers with a steady income, it risks depriving poor families of their food supply.
"Contracts bind farmers to supplying an agreed amount of potatoes, meaning that when the harvest is low farmers are forced to sell all their produce to meet their obligations," he explained.
"But potatoes are rich in starch and a critical source of nutrients -- farmers should save some for home consumption," he said.
Others have concerns about contract farming as well. Louise Wangari, a roadside seller of potatoes in Nyandarua County, said she is worried it might affect the supply she gets from farmers.
"The quantity of potatoes I was getting from farmers was already decreasing due to extreme weather," she said.
"If they start signing contracts with other buyers, then I may be out of business soon, as I can't afford to pay them as much as the food processors."