Dr. Martin Reuter of the University of Bonn and colleagues had 100 students memorize series of numbers and then repeat them as correctly as possible. Those who completed the task received about $7.
The study participants could either take their hard-earned money home or donate any portion of it to a charitable cause anonymously into a box already containing cash.
"However, we always knew how much money was in the cash box beforehand and could therefore calculate the amount donated," Reuter says in a statement.
The researcher also took a swab test and checked the DNA for two different variants of the COMT gene: COMT-Val and COMT-Met, which occur in people in approximately equal frequency.
The study, published in the journal Social Cognitive & Affective Neuroscience, found people with the COMT-Val variant, the associated enzyme works up to four times more effectively.
"Students with the COMT-Val gene donated twice as much money on average as did fellow students with the COMT-Met variant," Reuter says.