Attach the two 4-by-4 posts to the staircase's stringer (the part of the stairs that creates the rise and stabilizes and holds up the actual wood steps) using hex bolts. Check with a bar level to ensure they are installed straight. Allow the posts to extend about 36 inches above the treads of your stairs.
Measure the distance between the posts and including the posts--this measurement is equal to the length your railing wood should be.
Measure from the top of the posts down about 6 inches on the posts' exterior side and make pencil marks on both posts at that point.
Trim the tops of the posts to a 45-degree angle pointing downward so that the angle matches that of your stairs' slope.
Cut your two handrail pieces. They should be the same length as the distance between the two posts and including the posts.
Nail the top of the handrail--with its widest part down--to the tops of the posts. This forms the railing "cap" or top.
Nail the second piece of handrail to the exterior side of the posts just below the railing cap, so its skinniest side is flush with the underside of the handrail cap wood.
Saw another piece of railing to go at the 6-inch marks on each post. It should match the length of the handrail, or the length of the two posts. Nail to the exterior side of the posts at the 6-inch points.
Sand the edges of your exterior handrail until smooth and paint.