Extension of sheaves

I have to define a sheaf over $X$ knowing what happens in each open for a basis of the topology of $X$. That is, I have $\mathcal{B} = \{U_i\}$ a basis of $X$, for each $U_i$ I have an $k$-algebra $K_i$ and $\rho_{U_i}^{U_j}: K_j \to K_i$ morphisms such that $\rho_{U_i}^{U_i} = id_{K_i}$ and $\rho_{U_i}^{U_j} \circ \rho_{U_j}^{U_k} = \rho_{U_i}^{U_k}$ for all $U_i \subseteq U_j \subseteq U_k \subseteq X$ and I want a sheaf over $X$ to match with the open sets of $\mathcal{B}$.

Here is the link to notes by Ravi Vakil: http://math.stanford.edu/~vakil/216blog/. Look at chapter 3, section 7. It is best to try and do the exercises in this section once. He also explains how to define a sheaf on X when you are given a sheaf on a base of X. If you know why the sheaf of compatible germs is a sheaf (i.e. why sheafification of a presheaf gives you a sheaf), then it should be clear why a sheaf on a base extends to a sheaf on the whole space according to Ravi's definition. Hence, you might also want to look at $3.4$ of the notes. I am also looking at the October 23rd version of the notes, and I don't know if the numbers are different in earlier versions.