I want, that using the eraser makes the image transparent. How do I do that?
The eraser usually uses the background color. But if an image has an alpha channel/transparency, using the eraser makes an image transparent. An alpha channel/transparency is created by the function Layer Properties (see chapter 7.5.48). In this dialog there is a switch named Use Transparency which allows to both create and remove an alpha channel/transparency.