This is not intended to be a math question, so much as an understanding of how the current technology and techniques would view this problem.
The initial detection would almost certainly be a ground based telescope that could no longer see a particular star (because there is a giant cube in the way, cf. occultation). From that point, once a bunch of people looked they would be able to triangulate to discover that there was an unexpected something and would be able to figure out roughly the size and orbit. At this point a geostationary satellite could be moved over to where the object was to get a direct image.
Remember, the moon is black, or at least almost as dark as fresh asphalt (the moon reflects about 7% of incoming light, compared to 5% for asphalt). It's just brightly lit against a truly dark background when we see it. So, if the cube were only as black as asphalt, I suspect it would be naked-eye visible, looking like a star that never rises nor sets but just stays at the same spot in the sky.
Now, if you mean Vantablack black, then you'd have to wait for occultation or IR visibility.