Substrate 区块链应用开发之存证模块的功能开发

Substrate区块链应用开发之存证模块的功能开发存证是一种在线服务,可用于在某一时间点验证计算机文件的存在性,最早是通过比特币网络带有时间戳的交易实现的。存证的应用场景有:数字版权司法存证供应链溯源电子发票...存证的作用是:证明文件在某一时间点确实存在证明文件在某一

Substrate 区块链应用开发之存证模块的功能开发

存证是一种在线服务,可用于在某一时间点验证计算机文件的存在性,最早是通过比特币网络带有时间戳的交易实现的。 存证的应用场景有:

  • 数字版权
  • 司法存证
  • 供应链溯源
  • 电子发票
  • ...

存证的作用是:

  • 证明文件在某一时间点确实存在
  • 证明文件在某一时间点确实没有被篡改
  • 证明文件在某一时间点确实由某个人创建

实操

  1. Open a terminal shell on your computer.
  2. Clone the node template repository by running the following command:
git clone https://github.com/substrate-developer-hub/substrate-node-template
  1. Change to the root of the node template directory by running the following command:
    cd substrate-node-template
  1. Create a new branch to contain your work:
    git switch -c my-learning-branch-2024-04-05
  1. Compile the node template by running the following command:
    cargo build --release
  1. In the same terminal where you compiled your node, you can now start the node in development mode by running the following command:
    ./target/release/node-template --dev --tmp

18111712290691_.pic.jpg

  1. polkadot.js.org/apps 查看

Snipaste_2024-04-05_12-16-12.png

  1. 交易前查询状态 None

chainstate_poemodule_0x01_2024-04-05_12-18-51.png

  1. 交易

transaction01_2024-04-05_12-21-25.png

  1. 提交交易

tx02_2024-04-05_12-22-49.png

  1. 交易后查询状态

tx032024-04-05_12-25-36.png

问题

  1. 编译报错后使用的命令
    cargo clean
    cargo update
    cargo update -p wasm-bindgen
    cargo update -p librocksdb-sys
    cargo update -p schnorrkel@0.11.4
    cargo update -p anstream@0.6.13  -Z sparse-registry    
  1. 编译报错:error[E0220]: associated type BlockNumber not found for T

blocknumber_err_2024-04-05_13-01-11.png

解决: 替换T::BlockNumberBlockNumberFor<T>

参考

更多详情

点赞 1
收藏 0
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

0 条评论

请先 登录 后评论
QiaoPengjun(乔鹏军)
QiaoPengjun(乔鹏军)
0x750E...B6f5
江湖只有他的大名,没有他的介绍。