  We show that every polynomial in $\mathbb Z[x]$ defines an endomorphism of
the $d$-ary rooted tree induced by its action on the ring $\mathbb Z_d$ of
$d$-adic integers. The sections of this endomorphism also turn out to be
induced by polynomials in $\mathbb Z[x]$ of the same degree. In the case of
permutational polynomials acting on $\mathbb Z_d$ by bijections the induced
endomorphisms are automorphisms of the tree. In the case of $\mathbb Z_2$ such
polynomials were completely characterized by Rivest. As our main application we
utilize the result of Rivest to derive the condition on the coefficients of a
permutational polynomial $f(x)\in\mathbb Z[x]$ that is necessary and sufficient
for $f$ to induce a level transitive automorphism of the binary tree, which is
equivalent to the ergodicity of the action of $f(x)$ on $\mathbb Z_2$ with
respect to the normalized Haar measure.
