Whether to prevent erosion or create a lovely terrace, building a retaining wall on the slope can transform a sloping area into enjoyable space. Depending on the depth of your frost line, dig a trench at least 18 to 24 inches below ground level to prevent upheaval. To provide footing space for your wall dig the trench twice as wide as your stones or bricks. Line the trench with gravel and, for added stability, pour a layer of level concrete. Check with local codes for any other information you should know before you dig.