# "record public key does not match the verified name"

**URL:** <https://discuss.ipfs.tech/t/record-public-key-does-not-match-the-verified-name/16207>\
**Category:** Kubo\
**Created:** [March 30, 2023, 6:56am UTC](https://discuss.ipfs.tech/t/record-public-key-does-not-match-the-verified-name/16207 "2023-03-30T06:56:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EvilKyle](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@EvilKyle](https://discuss.ipfs.tech/u/EvilKyle)\
**Post date:** [March 30, 2023, 6:56am UTC](https://discuss.ipfs.tech/t/record-public-key-does-not-match-the-verified-name/16207/1 "2023-03-30T06:56:30Z")

</div>

Hi to all,

I am creating a IPNS record together with the IPNS name. But the IPNS name does not match the verified name.Despite using the public key used in the creation of the IPNS record to create the IPNS name.

## What I am doing wrong in this script ? [reference](https://gist.github.com/miguelmota/08686dc24e77fe648639cb251a9bfb10)

```
privateKey, publicKey, err := crypto.GenerateKeyPair(crypto.RSA, 2048)
    publicBytes, err := publicKey.Raw()
    var alg uint64 = mh.SHA2_256
maxInlineKeyLength := 42
if len(publicBytes) <= maxInlineKeyLength {
	alg = mh.ID
}
hash, _ := mh.Sum(publicBytes, alg, -1)
peerID := b58.Encode(hash)
fmt.Println("IPNS name::", peerID)

```

* * *

---

<div class="post-metadata">

**Author:** ![EvilKyle](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@EvilKyle](https://discuss.ipfs.tech/u/EvilKyle)\
**Post date:** [March 31, 2023, 8:56am UTC](https://discuss.ipfs.tech/t/record-public-key-does-not-match-the-verified-name/16207/2 "2023-03-31T08:56:59Z")

</div>

Hi,

the issue was sorted. Everything working fine now.

Cheers,

---

<div class="post-metadata">

**Author:** ![Discordian](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/discordian/32/4692_2.png) [@Discordian](https://discuss.ipfs.tech/u/Discordian)\
**Post date:** [March 31, 2023, 5:05pm UTC](https://discuss.ipfs.tech/t/record-public-key-does-not-match-the-verified-name/16207/3 "2023-03-31T17:05:17Z")

</div>

Heya! What was the solution you ended up on? Just in case someone else stumbles into this issue.

---

<div class="post-metadata">

**Author:** ![EvilKyle](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@EvilKyle](https://discuss.ipfs.tech/u/EvilKyle)\
**Post date:** [April 1, 2023, 7:04am UTC](https://discuss.ipfs.tech/t/record-public-key-does-not-match-the-verified-name/16207/4 "2023-04-01T07:04:50Z")

</div>

The main reason was because I was doing an extra calculation for the IPNS key which did not need it (I am a Rust guy not a GO guy 😆 ).

Nevertheless, there are some gaps in the current Kubo RPC API documentation. For creating a IPNS record we have two methods :

* * *

Method A:

- Generate a new keypair using [/api/v0/key/gen](https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-key-gen)

- Publish a IPNS name using [api-v0-name-publish](https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-name-publish)

For validation we can download the ipns record from the Kubo Gateway:

wget “[http://127.0.0.1:8080/ipns/key?format=ipns-record](http://127.0.0.1:8080/ipns/key?format=ipns-record)” -O ipns-record.bin

and validated the ipns-record.bin using [inspect](https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-name-inspect)

* * *

Method B(the one that I am using):

- Using GO([crypto](https://pkg.go.dev/github.com/libp2p/go-libp2p/core/crypto)/[ipns](https://pkg.go.dev/github.com/ipfs/go-ipns)) to create the IPNS record and save the private key(key.bin) and the IPNS record(ipns-record.bin)

- Import the key(key.bin) using [api-v0-key-import](https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-key-import)

- Validated the IPNS record(ipns-record.bin) using [inspect](https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-name-inspect)

- Write a key/value pair using [api-v0-routing-put](https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-routing-put).

Cheers,
