"record public key does not match the verified name"

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

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)

1 Like

Hi,

the issue was sorted. Everything working fine now.

Cheers,

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

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 :laughing: ).

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


Method A:

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

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

and validated the ipns-record.bin using inspect


Method B(the one that I am using):

  • Using GO(crypto/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

  • Validated the IPNS record(ipns-record.bin) using inspect

  • Write a key/value pair using api-v0-routing-put.

Cheers,

1 Like