> For the complete documentation index, see [llms.txt](https://toshio.gitbook.io/icp-rust-cdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://toshio.gitbook.io/icp-rust-cdk/tools/quill.md).

# quill

<https://internetcomputer.org/docs/current/references/quill-cli-reference/>

## インストール方法

以下のURLから最新モジュールをダウンロードします。

<https://github.com/dfinity/quill/releases>

| モジュール                     |
| ------------------------- |
| quill-arm\_32             |
| quill-linux-x86\_64       |
| quill-linux-x86\_64-musl  |
| quill-macos-x86\_64       |
| quill-windows-x86\_64.exe |

LinuxなどのOSではchmodコマンドで実行権限を付与しておく。環境変数PATHが通っているディレクトリにバイナリを置いておくと良いでしょう。

## ウォレット作成

```
$ quill generate
Principal id: xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxx
Account id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

seed.txtファイルが出力されます。

## 残高確認

```bash
$ quill account-balance <Account id>
```

## Seed phrase からのpem 出力

Seed phraseからpemファイルを生成するコマンド

```bash
$ quill generate --phrase '…' --pem-file <出力ファイル名.pem>
```

引数で指定したSeed phraseから、seed.txtファイルと、`--pem-file`で指定した対応するpemファイルが出力されます。

## pemファイルのPrincipal、およびAccount Idの表示

```bash
$ quill public-ids --pem-file <pem-file>
Principal id: xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxx
Legacy account id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

## SeedファイルのPrincipal、およびAccount Idの表示

`quill generate`で生成されたseed.txtファイルを引数に指定します。

```bash
$ quill public-ids --seed-file <seed-file>
Principal id: xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxx
Legacy account id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

## Seed phraseからのPrincipal、およびAccount Idの表示

`quill public-ids`には、パラメータから直接Seed phraseを指定する方法がないのでSeedファイルを出力して引数に指定します。

bashの場合には、`<(…)`のようにプロセス置換 (process substitution)を使ってコマンドラインに指定することはできます。

```bash
$ quill public-ids --seed-file <(echo "xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx")
```

## opensslを使った秘密鍵作成

以下に記載されている通り、『ECDSA on curve P-256 (secp256r1)』で秘密鍵が使用できますので、Seed phraseは生成されませんが、opensslコマンドを使うことも可能です。

<https://internetcomputer.org/docs/current/references/ic-interface-spec>

> Ed25519 and ECDSA signatures Plain signatures are supported for the schemes Ed25519 or ECDSA on curve P-256 (also known as secp256r1), using SHA-256 as hash function, as well as on the Koblitz curve secp256k1.

### opensslでサポートを確認

```bash
$ openssl ecparam -list_curves | grep secp256k1
secp256k1 : SECG curve over a 256 bit prime field
```

### opensslによる秘密鍵生成とPrincipal、およびAccount Idの表示

```bash
$ openssl ecparam -name secp256k1 -genkey -noout -out <pem-file>
$ quill public-ids --pem-file <pem-file>
Principal id: xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxx
Legacy account id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://toshio.gitbook.io/icp-rust-cdk/tools/quill.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
