add init and term for discovery
test basically discovery lib
implement random magic number