Given a natural number $n\geqslant 2$, find the smallest possible number of edges in a graph that has the following property: for any coloring of the vertices of the graph in $n{}$ colors, there is a vertex that has at least two neighbors of the same color as itself.
1. **Construction:**
   - Consider the complete graph \( K_{2n+1} \). This graph has \( 2n+1 \) vertices and \(\binom{2n+1}{2} = \frac{(2n+1)2n}{2} = n(2n+1) \) edges.
   - We need to show that this graph satisfies the given property: for any coloring of the vertices in \( n \) colors, there is a vertex that has at least two neighbors of the same color as itself.

2. **Bound:**
   - We will use induction on \( n \) to show that the smallest number of edges required is \( 2n^2 \).

3. **Base Case:**
   - For \( n = 2 \), consider \( K_5 \). This graph has \( \binom{5}{2} = 10 \) edges.
   - Any 2-coloring of \( K_5 \) will have at least one vertex with at least two neighbors of the same color, satisfying the property.

4. **Inductive Step:**
   - Assume the statement is true for \( n-1 \), i.e., the smallest number of edges required for \( n-1 \) colors is \( 2(n-1)^2 \).
   - We need to show that the smallest number of edges required for \( n \) colors is \( 2n^2 \).

5. **Degree Consideration:**
   - Any vertex of degree less than \( n \) does not affect the property, as we can color all other vertices and then color this vertex with a color not appearing among its neighbors.
   - Assume all vertices have degree at least \( n \).

6. **Existence of High-Degree Vertex:**
   - We claim there must be a vertex \( v \) of degree at least \( 2n \). If not, consider the coloring with the least number of monochromatic edges.
   - If a vertex \( v \) belongs to at least 2 such edges, among its neighbors there is a color appearing at most once. Recolor \( v \) with that color, reducing the number of monochromatic edges, contradicting the minimality of the coloring.

7. **Case 1: \( v \) is a universal vertex:**
   - Let \( G' \) be the induced subgraph without \( v \).
   - There must be a vertex \( v' \) with degree at least \( 2n-2 \) in \( G' \). Otherwise, we can apply the above claim for \( n-1 \) colors and color \( v \) with the \( n \)-th color.
   - Color \( v \) and \( v' \) with color \( n \) and apply the inductive hypothesis for \( G' \) without \( v' \).
   - Since \( v \) and \( v' \) contribute to at least \( 2n + 2n - 2 = 4n - 2 \) edges, we get a total of at least \( 2(n-1)^2 + 4n - 2 = 2n^2 \) edges.

8. **Case 2: \( v \) is not a universal vertex:**
   - Let \( v' \) be a vertex not adjacent to \( v \).
   - If \( v' \) has degree at least \( 2n \), color \( v \) and \( v' \) with color \( n \) and apply the inductive hypothesis for the other vertices.
   - Since \( v \) and \( v' \) contribute to at least \( 4n \) edges, we get a total of more than \( 2n^2 \) edges.
   - If \( v' \) has degree less than \( 2n \), there is a vertex \( u \) adjacent to \( v \) but not to \( v' \). Color \( v, v', u \) with color \( n \) and apply the inductive hypothesis.
   - By the initial remark, \( v' \) and \( u \) have degree at least \( n \), so \( v, v', u \) contribute to at least \( 4n - 1 \) edges, giving a total of more than \( 2n^2 \) edges.

Thus, the smallest number of edges required is \( 2n^2 \).

The final answer is \( \boxed{ 2n^2 } \).