[proofplan]
We obtain the model of $\mathrm{ZFC}+\mathrm{CH}$ by passing from a countable transitive model $M$ to its internal constructible universe $L^M$, which is again countable and transitive externally and satisfies $\mathrm{ZFC}$ plus the generalized continuum hypothesis, denoted $\mathrm{GCH}$, internally. For the negation of $\mathrm{CH}$, we force over the second countable transitive model $N$ with the Cohen forcing $\operatorname{Add}(\omega,\omega_2^N)^N$. Countability of $N$ supplies an $N$-generic filter; the [forcing theorem](/theorems/6531) gives a countable transitive forcing extension satisfying $\mathrm{ZFC}$; ccc preservation keeps $\omega_1^N$ and $\omega_2^N$ as the first two uncountable cardinals; and the standard Cohen-real and nice-name arguments show that the continuum in the extension is exactly $\omega_2^N$.
[/proofplan]
[step:Pass to the constructible universe to obtain a countable transitive model of $\mathrm{ZFC}+\mathrm{CH}$]
Let $M$ be a countable transitive model of $\mathrm{ZFC}$. Define $L^M$ to be the constructible universe computed inside $M$, that is, the class of all sets which $M$ regards as constructible. Since $M$ is transitive, the membership relation on $L^M$ is the ambient membership relation restricted to $L^M$, so $L^M$ is transitive. Since $L^M \subseteq M$ and $M$ is countable externally, $L^M$ is countable externally.
Let $\mathrm{GCH}$ denote the generalized continuum hypothesis. By [Gödel's theorem that $L$ satisfies GCH](/theorems/4856), applied inside the transitive model $M$, the class $L^M$ satisfies $L^M \models \mathrm{ZFC}+\mathrm{GCH}$. Since $\mathrm{GCH}$ implies $\mathrm{CH}$, $L^M$ is a countable transitive model of $\mathrm{ZFC}+\mathrm{CH}$.
[/step]
[step:Choose the Cohen forcing over the ground model for the $\neg\mathrm{CH}$ construction]
Let $N$ be a countable transitive model of $\mathrm{ZFC}$ such that $N \models (\omega_2)^\omega=\omega_2$. Let $\lambda$ denote the ordinal which $N$ calls $\omega_1$, so $\lambda=\omega_1^N$, and let $\kappa$ denote the ordinal which $N$ calls $\omega_2$, so $\kappa=\omega_2^N$.
Inside $N$, define the forcing notion
\begin{align*}
\mathbb{P}:=\operatorname{Add}(\omega,\kappa)^N
\end{align*}
to be the set of all finite partial functions
\begin{align*}
p:\kappa \times \omega \to 2
\end{align*}
ordered by reverse inclusion: $q \leq p$ iff $q \supseteq p$. Thus stronger conditions decide more bits.
Since $N$ is countable externally, the collection of dense subsets of $\mathbb{P}$ which belong to $N$ is countable externally. By the Rasiowa-Sikorski genericity construction, applied to the externally countable family of dense subsets of $\mathbb{P}$ in $N$, there exists a filter $G \subseteq \mathbb{P}$ meeting every [dense subset](/page/Dense%20Subset) of $\mathbb{P}$ that lies in $N$; such a filter is called $N$-generic. A $\mathbb{P}$-name is a set in $N$ built recursively from ordered pairs $(\dot{y},p)$ with $p\in\mathbb{P}$ and lower-rank names $\dot{y}$, and its interpretation by $G$ is the recursively defined set $\dot{x}^G=\{\dot{y}^G:(\dot{y},p)\in\dot{x}\text{ for some }p\in G\}$. By the forcing theorem for set forcing over countable transitive models, applied because $N\models\mathrm{ZFC}$, $N$ is transitive, and $\mathbb{P}\in N$ is a set forcing notion, the forcing extension $N[G]$ is a transitive model of $\mathrm{ZFC}$. Since $N$ is countable externally and every element of $N[G]$ is the interpretation of a forcing name from $N$, the model $N[G]$ is countable externally.
[guided]
We now set up the forcing extension carefully. The ground model is the countable transitive model $N$, and the ordinal $\kappa$ is defined to be the ordinal which $N$ identifies as $\omega_2$. The forcing notion is computed inside $N$:
\begin{align*}
\mathbb{P}:=\operatorname{Add}(\omega,\kappa)^N.
\end{align*}
A condition $p \in \mathbb{P}$ is a finite partial function $p:\kappa \times \omega \to 2$. The order is reverse inclusion: $q \leq p$ means $q \supseteq p$. This convention means that $q$ is stronger than $p$ because $q$ makes at least all the bit decisions made by $p$, and possibly more.
Why does an $N$-generic filter exist? Externally, $N$ is countable, so the family of dense subsets of $\mathbb{P}$ which are elements of $N$ can be enumerated as $(D_m)_{m\in\omega}$. The Rasiowa-Sikorski construction chooses a descending sequence of conditions meeting these dense sets one by one, and the upward closure of that sequence is a filter $G\subseteq\mathbb{P}$ meeting every dense set in $N$. This is an external construction; $G$ need not belong to $N$.
The forcing theorem for set forcing over countable transitive models then gives the extension $N[G]$. This theorem has two roles here: first, it says that the forcing relation correctly defines truth in $N[G]$; second, because $N\models\mathrm{ZFC}$ and $\mathbb{P}\in N$ is a set forcing notion, it gives $N[G]\models\mathrm{ZFC}$. Transitivity is preserved because the forcing extension is built from names over a transitive ground model using the same membership relation. Finally, $N[G]$ is countable externally because the collection of names in $N$ is externally countable and every element of $N[G]$ has the form $\dot{x}^G$ for some $\mathbb{P}$-name $\dot{x}\in N$.
[/guided]
[/step]
[step:Use ccc preservation to keep $\omega_1$ and $\omega_2$ unchanged]
Inside $N$, the forcing $\mathbb{P}=\operatorname{Add}(\omega,\kappa)^N$ satisfies the countable chain condition. Indeed, if $A\in N$ is an uncountable family of finite partial functions from $\kappa\times\omega$ to $2$, the $\Delta$-system lemma in $N$ gives two distinct conditions $p,q\in A$ whose finite domains have the same root and agree on that root after thinning by the finitely many possible root values; hence $p\cup q$ is a common extension, so $p$ and $q$ are compatible. Thus $A$ is not an antichain.
By the ccc preservation theorem, applied in $N$ to the ccc forcing notion $\mathbb{P}$, forcing with $\mathbb{P}$ preserves all ground-model cardinals and cofinalities at least $\lambda=\omega_1^N$. In particular, $\lambda$ remains an uncountable cardinal of cofinality $\lambda$, and $\kappa=\omega_2^N$ remains a cardinal of cofinality $\kappa$ in $N[G]$. Because every ordinal strictly below $\kappa$ has ground-model cardinality at most $\lambda$ in $N$, preservation of cardinals at and above $\lambda$ implies that no ground-model cardinal in the interval $[\lambda,\kappa]$ is collapsed. Hence $\lambda$ remains the first uncountable cardinal and $\kappa$ remains the successor cardinal of $\lambda$ in $N[G]$. Therefore, in $N[G]$, the ordinal $\kappa=\omega_2^N$ is still $\omega_2$, and $\lambda=\omega_1^N$ is still $\omega_1$.
[/step]
[step:Add $\kappa$ many distinct Cohen reals]
For each $\alpha\in\kappa$, define the function
\begin{align*}
c_\alpha:\omega \to 2
\end{align*}
in $N[G]$ by
\begin{align*}
c_\alpha(n)=i \quad \text{iff there exists } p\in G \text{ such that } p(\alpha,n)=i.
\end{align*}
This is well-defined because any two conditions in the filter $G$ are compatible, so they cannot assign different values to the same coordinate $(\alpha,n)$.
For each fixed $\alpha\in\kappa$ and $n\in\omega$, the set
\begin{align*}
D_{\alpha,n}:=\{p\in\mathbb{P}:(\alpha,n)\in\operatorname{dom}(p)\}
\end{align*}
is dense in $\mathbb{P}$ and belongs to $N$. Since $G$ meets $D_{\alpha,n}$, the value $c_\alpha(n)$ is defined for every $n\in\omega$.
If $\alpha,\beta\in\kappa$ with $\alpha\neq\beta$, define
\begin{align*}
E_{\alpha,\beta}:=\{p\in\mathbb{P}:\text{for some } n\in\omega,\ p(\alpha,n)\neq p(\beta,n)\}.
\end{align*}
The set $E_{\alpha,\beta}$ is dense: given $p\in\mathbb{P}$, choose $n\in\omega$ such that neither $(\alpha,n)$ nor $(\beta,n)$ lies in $\operatorname{dom}(p)$, and extend $p$ by assigning value $0$ at $(\alpha,n)$ and value $1$ at $(\beta,n)$. Since $G$ meets $E_{\alpha,\beta}$, we have $c_\alpha\neq c_\beta$. Hence $N[G]$ contains at least $\kappa$ distinct reals, so
\begin{align*}
N[G]\models 2^\omega \geq \kappa.
\end{align*}
[/step]
[step:Bound the continuum above by counting nice names for reals]
Every real in $N[G]$ is the interpretation of a $\mathbb{P}$-name $\dot{x}\in N$ such that
\begin{align*}
N \models \dot{x}\text{ is a name for an element of }2^\omega.
\end{align*}
By the nice-name lemma for ccc forcing, applied in $N$ because $\mathbb{P}$ is ccc in $N$, each such name is equivalent to a nice name for a function from $\omega$ to $2$. For each $n\in\omega$, let $\check{n}$ denote the canonical forcing name for the ground-model natural number $n$, and for each $i\in 2$, let $\check{i}$ denote the canonical forcing name for the ground-model element $i$ of $2$. Using the standard coding of a function $x:\omega\to 2$ by its graph as a subset of $\omega\times 2$, a nice name has the form
\begin{align*}
\dot{x}=\{((\check{n},\check{i}),p): n\in\omega,\ i\in 2,\ p\in A_{n,i}\}
\end{align*}
where, for each $n\in\omega$ and $i\in 2$, the set $A_{n,i}\subseteq\mathbb{P}$ is an antichain in $N$.
Since $\mathbb{P}$ is ccc in $N$, every antichain $A_{n,i}$ is countable in $N$. The forcing $\mathbb{P}$ has cardinality $\kappa$ in $N$, and $N\models \kappa^\omega=\kappa$. Therefore, inside $N$, the number of countable antichains in $\mathbb{P}$ is at most $\kappa^\omega=\kappa$, and the number of sequences indexed by $\omega\times 2$ of such antichains is also at most $\kappa^\omega=\kappa$. Thus, in $N$, there is an enumeration $(\dot{x}_\xi)_{\xi<\kappa}$ of all nice $\mathbb{P}$-names for reals, allowing repetitions if fewer than $\kappa$ such names exist.
This ground-model enumeration remains a sequence of length $\kappa$ in $N[G]$. For every real $x\in N[G]$, choose a $\mathbb{P}$-name $\dot{y}\in N$ with $\dot{y}^G=x$; replacing $\dot{y}$ by an equivalent nice name gives some $\xi<\kappa$ with $x=\dot{x}_\xi^G$. Hence the map $\xi\mapsto \dot{x}_\xi^G$ is a surjection from $\kappa$ onto the reals of $N[G]$. It follows in the extension that
\begin{align*}
N[G]\models 2^\omega \leq \kappa.
\end{align*}
Combining this with the lower bound from the previous step gives
\begin{align*}
N[G]\models 2^\omega=\kappa.
\end{align*}
[/step]
[step:Conclude that the forcing extension satisfies $\neg\mathrm{CH}$]
From the ccc preservation step, $N[G]$ regards $\kappa=\omega_2^N$ as its own $\omega_2$. From the continuum calculation,
\begin{align*}
N[G]\models 2^\omega=\kappa=\omega_2.
\end{align*}
Since $\omega_2\neq\omega_1$ in every model of $\mathrm{ZFC}$, the continuum is not $\omega_1$ in $N[G]$. Therefore
\begin{align*}
N[G]\models \neg\mathrm{CH}.
\end{align*}
The model $N[G]$ is countable, transitive, and satisfies $\mathrm{ZFC}$ by the forcing construction above. Hence $N[G]$ is a countable transitive model of $\mathrm{ZFC}+\neg\mathrm{CH}$.
Together with the model $L^M$ of $\mathrm{ZFC}+\mathrm{CH}$ constructed earlier, this proves that both $\mathrm{ZFC}+\mathrm{CH}$ and $\mathrm{ZFC}+\neg\mathrm{CH}$ have countable transitive models under the stated hypotheses.
[/step]