We generalize the idea of Vassiliev invariants to the spin network context, with the aim of using these invariants as a kinematical arena for a canonical quantization of gravity. This paper presents a detailed construction of these invariants (both ambient and regular isotopic) requiring a significant elaboration based on the use of Chern-Simons perturbation theory which extends the work of Kauffman, Martin and Witten to four-valent networks. We show that this space of knot invariants has the crucial property -from the point of view of the quantization of gravity-of being loop differentiable in the sense of distributions. This allows the definition of diffeomorphism and Hamiltonian constraints. We show that the invariants are annihilated by the diffeomorphism constraint. In a companion paper we elaborate on the definition of a Hamiltonian constraint, discuss the constraint algebra, and show that the construction leads to a consistent theory of canonical quantum gravity.CGPG-99/11-2 gr-qc/9911009