In the application of wireless sensor networks (WSN), the balance of energy consumption plays an important role in extending the life cycle of WSN. Aim at energy consumption of Wireless sensors network, a dynamic cluster-based routing protocol based on the greedy algorithm (GDCRP). In the protocol, nodes run for the cluster head according to the energy and location. The elected cluster head has optimal value of energy and location. When the cluster is formed, the sink node initiates the request of routing establishment; the cluster heads choose the nodes that send it the packet as the upper nodes according to energy and hops count to the sink node. After a period of the network operating, then choose nodes according to the energy value and distance as the cluster head once again in order to avoid network failure because of one node failure. The protocol balances energy consumption of the network effectively, and extends the life cycle of the entire network.