Skip to content

客户端配置

Iroha CLI 和 SDK 客户使用 TOML 存储库将当前的默认设置发送到 defaults/client.toml; 创建的本地网络也会写出匹配 client.toml 在它们的输出目录中.

客户端配置模板
toml
chain = "00000000-0000-0000-0000-000000000000"
torii_url = "http://127.0.0.1:8080/"

[basic_auth]
web_login = "mad_hatter"
password = "ilovetea"

[account]
domain = "wonderland.universal"
public_key = "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03"
private_key = "802620CCF31D85E3B32A4BEA59987CE0C78E3B8E2DB93881468AB2435FE45D5C9DCD53"

[connect]
# Root directory for Connect queue diagnostics and evidence export. Defaults to `~/.iroha/connect`.
# queue_root = "/home/alice/.iroha/connect"

核心领域

至少,客户端配置识别链, Torii 终点和签字帐户:

toml
chain = "00000000-0000-0000-0000-000000000000"
torii_url = "http://127.0.0.1:8080"

[account]
domain = "wonderland.universal"
public_key = "ed0120..."
private_key = "802620..."
  • chain选择所提交交易属于的链.
  • torii_url点在同行 Torii HTTP API.
  • [account].domain是由 CLI 快捷方式和地址选择器编码所使用的;正规 AccountId本身是无域名.
  • [account].public_key[account].private_key签署交易.

帐户必须已经在链上存在.对于默认的本地网络,这是由捆绑的基因表处理的.

案例敏感性

Iroha 在法典解析后,这些名字对案例敏感. wonderland.universal, Wonderland.universal, 和 looking_glass.universal 它们是不同的字体.

基本身份验证

可选的 [basic_auth] 部分将 HTTP Authorization 标题添加到客户端请求中. Iroha 同龄人不直接解释这些凭证;在 Torii 在像Nginx这样的反向代理后使用时,使用它们.

toml
[basic_auth]
web_login = "mad_hatter"
password = "ilovetea"

交易设置

交易行为设置为 [transaction]部分:

toml
[transaction]
time_to_live_ms = 100000
status_timeout_ms = 15000
nonce = false
  • time_to_live_ms是数毫秒的交易寿命.
  • status_timeout_ms 控制客户等待交易状态的时间.
  • nonce = true 要求客户包含一个非如此重复的交易产生不同的哈希.

连接排列设置

目前的 Iroha 客户端也可以使用可选的 [connect] 部分进行本地队列状态:

toml
[connect]
queue_root = "./queue"

如果工作流需要持久的客户端排队存储时,请使用此方法.

创建配置

对于一次性本地网络,更喜欢 Kagami 因为它写出匹配的 Iroha 3 配置,基因,脚本和 README:

bash
cargo run --bin kagami -- localnet --build-line iroha3 --peers 4 --out-dir ./localnet

使用生成的 ./localnet/client.toml与 CLI:

bash
cargo run --bin iroha -- --config ./localnet/client.toml ledger domain list all