Skip to content

Commit

Permalink
A bit better, but still giving addresses start from 1A
Browse files Browse the repository at this point in the history
  • Loading branch information
ErakhtinB committed Dec 8, 2024
1 parent 77bec17 commit c271f36
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions core/utils/key_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,9 @@ namespace kagome {
.value();
auto keypair = ed25519_provider->generateKeypair(seed, {}).value();
auto libp2p_key = crypto::ed25519KeyToLibp2pKeypair(keypair);
// auto key_marshaller =
// std::make_shared<libp2p::crypto::marshaller::KeyMarshaller>();
// libp2p::crypto::ProtobufKey libp2p_key_pb = {
// key_marshaller->marshal(libp2p_key.publicKey).value()};
// auto peer_id = libp2p::peer::PeerId::fromPublicKey(libp2p_key_pb);

auto protofbuf_key_from_keypair =
libp2p::crypto::ProtobufKey{std::vector<uint8_t>(
keypair.public_key.begin(), keypair.public_key.end())};
auto peer_id =
libp2p::peer::PeerId::fromPublicKey(protofbuf_key_from_keypair);
libp2p::crypto::ProtobufKey protobuf_key{
common::Buffer{libp2p_key.publicKey.data}};
auto peer_id = libp2p::peer::PeerId::fromPublicKey(protobuf_key);
std::cerr << peer_id.value().toBase58() << std::endl;
std::cout << kagome::common::hex_lower(keypair.secret_key.unsafeBytes())
<< std::endl;
Expand Down

0 comments on commit c271f36

Please sign in to comment.