Multiuser cooperative communication significantly improves the performance of wireless communication networks. One key challenge of multiuser cooperative communication is how to design a cooperative mechanism to incentivize potential relay nodes to help a source node in its data transmission. In this paper, to address this problem, we apply a contract-based principal-agent framework to a cognitive-radio-based wireless relaying networks, in which a mobile relay node acts as the principal who designs Incentive Compatible (IC) and Individually Rational (IR) contract items, consisting of a set of rate-price pairs. Subsequently, contract items can be broadcast by a relay to nearby mobile users that want to send data. Once these sources optimally select a relay at the lowest cost and notify the contract items that they are willing to accept, the relay then chooses at least one source for which to provide service. Theoretical analysis and numerical results indicate that this pricing mechanism can lead to a win-win situation in which source nodes get good communication service and relay nodes maximize their own profit that can be used to purchase the relay service of other nodes when needed in the future.