sytchenko

IPFS. Client's useful commands

Feb 17th, 2025 (edited)
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. # Get node list for CID
  2. ipfs routing findprovs <CID>
  3.  
  4. # Get local pinned files CID list
  5. ipfs pin ls
  6.  
  7. # Get addresses by peer ID
  8. ipfs routing findpeer <Peer ID>
  9.  
  10. # Add file to local node by it CID
  11. ipfs pin add <CID>
  12.  
  13. # Provide CID
  14. ipfs routing provide <CID>
  15.  
  16. # Download file to current folder by it CID
  17. ipfs get /ipfs/<CID>
  18.  
  19. # Write all pinned CIDs to text file
  20. ipfs pin ls -q > pinned_cids.txt
  21.  
  22. # Download and add to local repo all data by CIDs using text file
  23. cat pinned_cids.txt | xargs -I {} ipfs pin add {}
  24.  
  25. # Remove pinned CID from repository (required gc)
  26. ipfs pin rm <CID>
  27.  
  28. # Garbage clean (remove unpinned blocks from storage)
  29. ipfs repo gc
  30.  
  31. # Storage common info
  32. ipfs repo stat --human
  33.  
  34. # Provideing statistic
  35. ipfs stats provide
  36.  
  37. # PubSub options
  38. # 1. Run ipfs daemon with --enable-pubsub-experiment option:
  39. ipfs daemon --enable-pubsub-experiment
  40. # 2. Topic subscribe:
  41. ipfs pubsub sub MyTopicName
  42. # 3. Post message to topic:
  43. echo "Hello, PubSub!" | ipfs pubsub pub MyTopicName
  44.  
  45. # Convert CIDv0 hash to CIDv1:
  46. ipfs cid base32 <CIDv0>
  47.  
  48. # Public gateway address format:
  49. https://ipfs.io/ipfs/<CID>
  50. https://<CIDv1>.ipfs.dweb.link
  51. https://dweb.link/ipfs/<CID>
  52.  
  53. # Get list of all IPNS keys
  54. ipfs key list
  55.  
  56. # Rename IPNS key
  57. ipfs key rename "mykey1" "mykey2"
  58.  
  59. # Get CID connected to IPNS key
  60. ipfs name resolve key_id
  61.  
  62. # Generate new IPNS address
  63. ipfs key gen --type=rsa mykey3
  64.  
  65. # Publish content (CID) associated with IPNS address mykey3
  66. ipfs name publish --key=mykey3 /ipfs/<CID>
  67.  
  68. # Publish content (CID) associated with default IPNS address (self)
  69. ipfs name publish /ipfs/<CID>
Tags: ipfs
Advertisement
Add Comment
Please, Sign In to add comment