Kraken: new api ptobject external_code

Will be use by jormungandr to remove the database.
All that can be done in one templated method, no?