# How to run modified go-libp2p-kad-dht?

**URL:** <https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940>\
**Category:** Help\
**Tags:** go-ipfs, libp2p, dht\
**Created:** [August 11, 2021, 3:47pm UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940 "2021-08-11T15:47:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaheerbakali](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/shaheerbakali/32/5216_2.png) [@shaheerbakali](https://discuss.ipfs.tech/u/shaheerbakali)\
**Post date:** [August 11, 2021, 3:47pm UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940/1 "2021-08-11T15:47:29Z")

</div>

Hello,

So I installed go-libp2p-kad-dht from [[https://github.com/libp2p/go-libp2p-kad-dht.](https://github.com/libp2p/go-libp2p-kad-dht.)]  
Firslty I dont know how to use it because the Usage section in the Github page is very vague.

Secondly, I modified providers\_manager.go code and just added a print statement like ` println("!!??ok i am here can you see me am i showing??!!")`  
Then I rebuilt IPFS like this `go install ./cmd/ipfs` and then I run `ipfs daemon`.  
But the code I modified didnt show up.  
I didnt see my print statement.

Can someone please help me out with this.

Thanks alot I highly appreicate it.

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [August 11, 2021, 5:41pm UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940/2 "2021-08-11T17:41:42Z")

</div>

I’ve made an example of what I was talking about on discord :  
[https://jorropo.net/ipfs/QmSyW7VSpic3YfCbrGXmwytSgJJG9aoenu5obJwztuN9mL/exampleGoModReplace.tar.xz](https://jorropo.net/ipfs/QmSyW7VSpic3YfCbrGXmwytSgJJG9aoenu5obJwztuN9mL/exampleGoModReplace.tar.xz)

You can `go build .` in `go-ipfs/cmd/ipfs`, and run `ipfs daemon` (you would need to init first).  
To see what I’ve changed you can just do `git diff` in both `go-ipfs` or `go-libp2p-kad-dht`.

---

<div class="post-metadata">

**Author:** ![shaheerbakali](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/shaheerbakali/32/5216_2.png) [@shaheerbakali](https://discuss.ipfs.tech/u/shaheerbakali)\
**Post date:** [August 11, 2021, 9:41pm UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940/3 "2021-08-11T21:41:45Z")

</div>

yesss thank you so so much

now its working and i can see the changes

but if i run ` ipfs daemon` outside `go-ipfs/cmd/ipfs` folder, then its the older version of IPFS running without the edited code.  
but if i run ` ipfs daemon` inside `go-ipfs/cmd/ipfs` folder, then its new IPFS running with the edited code of `go-libp2p-kad-dht`.

btw both IPFS either run outside or inside the folder have same peer ID.

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [August 12, 2021, 8:27am UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940/4 "2021-08-12T08:27:13Z")

</div>

> btw both IPFS either run outside or inside the folder have same peer ID.

Yes that because the binary has nothing to do with your identity, else updating IPFS would change it (which we don’t want), your identity is on unix likes stored in `~/.ipfs/`, no idea on windows.

> but if i run ` ipfs daemon` outside `go-ipfs/cmd/ipfs` folder, then its the older version of IPFS running without the edited code.  
> but if i run ` ipfs daemon` inside `go-ipfs/cmd/ipfs` folder, then its new IPFS running with the edited code of `go-libp2p-kad-dht` .

That because you are on windows and windows is confusing.

On unix `ipfs` reffers only to your `PATH`, or what is installed on your system.  
To use the ipfs you just built you would use `./ipfs` instead (`.` just means “the current directory”, so `./ipfs` means “the `ipfs` file in the current directory”).  
On windows `ipfs` first attempt to see if there is a binary called “ipfs” in your current directory, if not then fallback to the PATH.

---

<div class="post-metadata">

**Author:** ![shaheerbakali](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/shaheerbakali/32/5216_2.png) [@shaheerbakali](https://discuss.ipfs.tech/u/shaheerbakali)\
**Post date:** [August 12, 2021, 11:29am UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940/5 "2021-08-12T11:29:16Z")

</div>

Aha okay now i get it.

Thanks alot i highly highly appreciate your help.

Do you know by any chance if there is a way to print out from the code all the requests for CID \> providers mappings you receive at your node.  
Like kind of observing the network and who is providing what and who is asking for what.

---

<div class="post-metadata">

**Author:** ![scut](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@scut](https://discuss.ipfs.tech/u/scut)\
**Post date:** [February 12, 2022, 12:28pm UTC](https://discuss.ipfs.tech/t/how-to-run-modified-go-libp2p-kad-dht/11940/6 "2022-02-12T12:28:47Z")

</div>

hello, Have you implemented this code now?
