One of the most important open problems in the theory of error-correcting codes is to determine the tradeoff between the rate R and minimum distance δ of a binary code. The best known tradeoff is the Gilbert-Varshamov bound, and says that for every δϵ (0; 1=2), there are codes with minimum distance δ and rate R = RGV(δ) > 0 (for a certain simple function RGV(.)). In this paper we show that the Gilbert-Varshamov bound can be achieved by codes which support local error-detection and error- correction algorithms. Specifically, we show the following results. 1. Local Testing: For all δϵ (0; 1=2) and all R < RGV(δ), there exist codes with length n, rate R and minimum distance that are locally testable with quasipolylog(n) query complexity. 2. Local Correction: For all ϵ > 0, for all δ < 1=2 sufficiently large, and all R < (1 - ϵ)RGV(δ), there exist codes with length n, rate R and minimum distance that are locally correctable from δ 2 - o(1) fraction errors with O(nϵ) query complexity. Furthermore, these codes have an efficient randomized construction, and the local testing and local correction algorithms can be made to run in time polynomial in the query complexity. Our results on locally correctable codes also immediately give locally decodable codes with the same parameters. Our local testing result is obtained by combining Thommesen's random concatenation technique and the best known locally testable codes from [KMRS16]. Our local correction result, which is significantly more in- volved, also uses random concatenation, along with a number of further ideas: The Guruswami-Sudan-Indyk list decoding strategy for concatenated codes, Alon- Edmonds-Luby distance ampliffication, and the local list- decodability, local list-recoverability and local testability of Reed-Muller codes. Curiously, our final local correction algorithms go via local list-decoding and local testing al- gorithms; this seems to be the first time local testability is used in the construction of a locally correctable code.