The owner of target permanent shuffles it into their library, then reveals the top card of their library. If it's a permanent card, they put it onto the battlefield.
The owner of a token is the player under whose control the token was put onto the battlefield. If a token is shuffled into a player’s library this way, that player shuffles before revealing the top card of that library.
If the permanent is an illegal target by the time Chaos Warp tries to resolve, it won’t resolve and none of its effects will occur. No library will be shuffled and no card will be revealed.
A permanent card is a card with one or more of the following card types: artifact, creature, enchantment, land, or planeswalker.
If the revealed card is a permanent card but can’t enter the battlefield (perhaps because it’s an Aura with nothing to enchant), it remains on top of that library.
If the revealed card is not a permanent card, it remains on top of that library.