其他分享
首页 > 其他分享> > 使用ipns解决ipfs内容更新的问题

使用ipns解决ipfs内容更新的问题

作者:互联网

1、生成key
ipfs key gen --type=rsa --size=2048 filetestkey

2、文件上ipfs
[bcyf@bc02 /bc/bcyf]$ipfs add audit_jmap.log
added QmSkqy14YofQgtCKGXVTWYW3HZDTAUZxLvpb29MVBkV4cd audit_jmap.log
92 B / 92 B [==========================================================================================================================================================] 100.00%

3、绑定key和文件
[bcyf@bc02 /bc/bcyf]$ipfs name publish --key=filetestkey QmSkqy14YofQgtCKGXVTWYW3HZDTAUZxLvpb29MVBkV4cd
Published to k2k4r8lrbxszjovfh46nrpg3x4a98l0i0deakpye95ie4zvvsn6zpzvx: /ipfs/QmSkqy14YofQgtCKGXVTWYW3HZDTAUZxLvpb29MVBkV4cd

4、前端访问:
http://172.18.194.70:8080/ipns/k2k4r8lrbxszjovfh46nrpg3x4a98l0i0deakpye95ie4zvvsn6zpzvx

5、修改文件内容
[bcyf@bc02 /bc/bcyf]$vi audit_jmap.log

6、修改文件上ipfs
[bcyf@bc02 /bc/bcyf]$ipfs add audit_jmap.log
added QmXKzfFfrFde9F4RY8nx9iTtv446ypippTqKG1zoNuN6fV audit_jmap.log
103 B / 103 B [========================================================================================================================================================] 100.00%
7、再次绑定key和文件
[bcyf@bc02 /bc/bcyf]$ipfs name publish --key=filetestkey QmXKzfFfrFde9F4RY8nx9iTtv446ypippTqKG1zoNuN6fV
Published to k2k4r8lrbxszjovfh46nrpg3x4a98l0i0deakpye95ie4zvvsn6zpzvx: /ipfs/QmXKzfFfrFde9F4RY8nx9iTtv446ypippTqKG1zoNuN6fV


8、前端访问:
http://172.18.194.70:8080/ipns/k2k4r8lrbxszjovfh46nrpg3x4a98l0i0deakpye95ie4zvvsn6zpzvx

显示的为修改后内容

 

 

文件夹操作一样,仅绑定文件改为绑定文件夹

标签:bcyf,audit,ipfs,bc,bc02,更新,key,ipns
来源: https://www.cnblogs.com/ybswc/p/15571890.html