We ropose a blockchain-based automatic reward mechanism. Since it is based on public blockchains, codes deployed in smart contracts are public and form a tamper-proof ledger. Rewards are recorded in a smart contract. If anyone has doubts about the reward accumulated, he/she can appeal through smart contracts without third-party mediation, and obtain indemnity in a short time. There is no need to establish and run a customer service center with human employees. Moreover, the traditional third-party trust is no longer needed because we employ public blockchains as the core of the trust. An application of rewarding photographers in a running race is used as an example to illustrate the proposed scheme. We solve problems that public blockchains are slow and their miner fees are high. The feasibility of the proposed application has been demonstrated through pilot implementation and testing.