Doubt regarding question on Bogomolny equations PROBLEM:
Let $\bf E$ and $\bf B$ be static, and source free electric and magnetic fields in $\mathbb R^3,$ respectively which are infinitely many times differentiable. Also assume that they satisfy either of the following : $\mathbf E = \mathbf B ~\textrm{or}~ \mathbf E = -\mathbf B.$ (Bogomolny equations). Prove that as long as the equations describe a finite energy configuration, $\mathbf E = \mathbf B = 0.$
MY ATTEMPT:
Consider a very large boundary $S,$ compared to the region under consideration. Since $\int \mathbf E^2~\mathrm dv$ all over space is a finite value(since the energy configuration described is finite), the integrand must go to zero at infinity. Or, at my chosen surface $S,~~ \mathbf E = -\textrm{grad}(V) = 0.$ Thus we see that the potential $V$ is the same everywhere on the surface $S$ (since $\bf E$ is zero everywhere on the surface). Let $V(S) = a.$ So the problem reduces to the boundary problem, $V(S) = a$ at all points on $S$ and also the laplacian of $V$ is zero everywhere inside $S$ (since it is source free). One evident solution to this is $\bf E = 0,$ (as a result of which $\bf B = 0,$ from the Bogomolny equations). Hence, this must be the only solution by uniqueness.
MY DOUBT:
Is it okay to start working in the boundary conditions using this surface $S$ as I defined it? If not, can the definition of $S$ be changed to satisfy the rest of the solution? If that cannot be done, please suggest other solutions.

PS: This is a problem from RUDOLF ORTVAY COMPETITION IN PHYSICS (1997) problem 28. I do not consider this as a homework question and was asked by no one to get this solved. This is out of my interest only. If you feel like suggesting the homework tag please do so.
 A: It is false that if $\int_{\mathbb R^n} |f|^2~\mathrm dx^n <+ \infty$ then necessarily $f(x) \to 0$ as $|x| \to +\infty$, so your approach cannot work.
The only proof I see  is however based on a non-trivial property of harmonic functions whose proof is a bit technical as it relies upon some properties of subharmonic functions and Hoelder inequality:
Proposition. If $g : \mathbb R^n \to \mathbb R$ is harmonic and $$\int_{\mathbb R^n} |g|^p~\mathrm dx^n <+\infty$$ for some $p$ with $1\leq p < +\infty$, then $g=0$ everywhere.
Next the way is easy. As ${\bf E}$ (supposed to be $C^1$) is static, $\nabla \wedge  {\bf E}=0$ everywhere in $\mathbb R^3$ which is simply connected and thus ${\bf E} = -\nabla f$ for some $C^2$ scalar function $f$. Since ${\bf E} = \pm {\bf B}$, also $\nabla \cdot {\bf E}=0$, so that $\Delta f=0$. In other words $f$ is harmonic on the whole $\mathbb R^3$. In particular $f$ is also $C^\infty$.
On the other hand we know that
$$\int_{\mathbb R^n} {\bf E}^2~\mathrm dx^3 <+ \infty$$
which means
$$\int_{\mathbb R^n} g_k^2~\mathrm dx^3 <+ \infty$$
for $g_k := \frac{\partial f}{\partial x_k}$ where $k=1,2,3$ and every $g_k$ is harmonic as well obviously. Applying Proposition, we immediately have that $g_k=0$ everywhere in $\mathbb R^3$ for $k=1,2,3$. In other words is $f$ is constant (since $\mathbb R^3$ is connected). We have eventually obtained that ${\bf E} = -\nabla f=0$ everywhere as wanted.
ADDENDUM. I constructed a short and quite elementary proof of Proposition for the case $p=2$, the only relevant here.
If $g$ is harmonic and $x$ is a point in its domain, the theorem of average value of harmonic functions states that
$$g(x) = \frac{\displaystyle\int_{B_R} g ~\mathrm dx^n}{\textrm{Vol}(B_R)}\tag{1}$$
where $B_R$ is a closed ball of finite radius $R$ centered on $x$ completely included in the domain of $g$.  The Cauchy-Schwartz inequality  says that
$$\left|\int_{B_R} g~\mathrm dx^n\right|= \left|\int_{B_R} 1 \cdot g~\mathrm dx^n\right|
\leq \sqrt{\int_{B_R} 1^2 ~\mathrm dx^n}\sqrt{\int_{B_R} g^2~\mathrm dx^n}= \sqrt{\textrm{Vol}(B_R)}\sqrt{\int_{B_R} g^2~\mathrm dx^n}\:.$$
Inserting this result in (1),  for $g$ everywhere harmonic in $\mathbb R^n$ we have
$$0\leq |g(x)| \leq \sqrt{\frac{\displaystyle\int_{B_R} g^2~\mathrm dx^n}{\textrm{Vol}(B_R)}} \to 0 \quad \mbox{for $R \to +\infty$}\:.$$
The limit can be computed because (a) $R$ can be taken  arbitrarily large
since $g$ is everywhere defined in $\mathbb R^n$, (b) $\textrm{Vol}(B_R) = C_n R^n \to +\infty$ and (c) $\int_{B_R} g^2~\mathrm dx^n \to \int_{\mathbb R^n} g^2 ~\mathrm dx^n <+\infty$ (e.g., using the dominate convergence theorem). We conclude that 
$g(x)=0$ for every $x \in \mathbb R^n$.
