|
1 | 1 | # Tokengen |
2 | 2 |
|
3 | | -`tokengen` is an utility for generating Fabric Token-SDK material. |
4 | | -It is provided as a means of preconfiguring public parameters, token chaincode, and so. |
5 | | -It would normally not be used in the operation of a production network. |
| 3 | +`tokengen` is a utility for generating Fabric Token-SDK material, such as public parameters, token chaincode packages, and other cryptographic artifacts. |
6 | 4 |
|
7 | | -## Syntax |
| 5 | +It is primarily used for pre-configuring development and testing environments. |
8 | 6 |
|
9 | | -The `tokengen` command has five subcommands, as follows: |
| 7 | +## Build |
10 | 8 |
|
11 | | -- artifacts |
12 | | -- certifier-keygen |
13 | | -- gen |
14 | | -- help |
15 | | -- version |
16 | | - |
17 | | -## tokengen artifacts |
18 | | - |
19 | | -This command is used to centrally generate key material and configuration files. |
20 | | -It takes in input a `topology` file, in `yaml` format, that describes the topologies of the networks involved. |
21 | | -An example can be found [`here`](./samples/topology/fungible.yaml). |
22 | | -Topology files can be edited directly or they can be generated programmatically as shown [`here`](./samples/topology/fungible.go). |
23 | | - |
24 | | -``` |
25 | | -Read topology from file and generates artifacts. |
26 | | -
|
27 | | -Usage: |
28 | | -tokengen artifacts [flags] |
29 | | -
|
30 | | -Flags: |
31 | | --h, --help help for artifacts |
32 | | --o, --output string output folder (default "./testdata") |
33 | | --p, --port int host starting port (default 20000) |
34 | | --t, --topology string topology file in yaml format |
35 | | -``` |
36 | | - |
37 | | -## tokengen certifier-keygen |
38 | | - |
39 | | -``` |
40 | | -Gen Token Certifier Key Pair. |
41 | | -
|
42 | | -Usage: |
43 | | - tokengen certifier-keygen [flags] |
44 | | -
|
45 | | -Flags: |
46 | | - -d, --driver string driver (zkatdlognogh.v1) (default "zkatdlognogh.v1") |
47 | | - -h, --help help for certifier-keygen |
48 | | - -o, --output string output folder (default ".") |
49 | | - -p, --pppath string path to the public parameters file |
50 | | -``` |
51 | | - |
52 | | -## tokengen gen |
53 | | - |
54 | | -The `tokengen gen` command has two subcommands, as follows: |
55 | | - |
56 | | -- fabtoken.v1: generates the public parameters for the fabtoken driver |
57 | | -- zkatdlognogh.v1: generates the public parameters for the zkatdlognogh.v1 driver |
58 | | - |
59 | | -## tokengen gen fabtoken.v1 |
60 | | - |
61 | | -``` |
62 | | -Usage: |
63 | | - tokengen gen fabtoken.v1 [flags] |
64 | | -
|
65 | | -Flags: |
66 | | - -a, --auditors strings list of auditor MSP directories containing the corresponding auditor certificate |
67 | | - --cc generate chaincode package |
68 | | - -h, --help help for fabtoken.v1 |
69 | | - -s, --issuers strings list of issuer MSP directories containing the corresponding issuer certificate |
70 | | - -o, --output string output folder (default ".") |
71 | | - -v, --version uint allows the caller of tokengen to override the version number put in the public params |
72 | | -``` |
73 | | - |
74 | | -The public parameters are stored in the output folder with name `fabtokenv1_pp.json`. |
75 | | -If version is overridden, then file name will be `("fabtokenv%d_pp.json", version)`. |
76 | | - |
77 | | -### tokengen gen zkatdlognogh.v1 |
| 9 | +To build `tokengen`, run the following command from the root of the repository: |
78 | 10 |
|
| 11 | +```bash |
| 12 | +make tokengen |
79 | 13 | ``` |
80 | | -Usage: |
81 | | - tokengen gen zkatdlognogh.v1 [flags] |
82 | 14 |
|
83 | | -Flags: |
84 | | - -r, --aries flag to indicate that aries should be used as backend for idemix |
85 | | - -a, --auditors strings list of auditor MSP directories containing the corresponding auditor certificate |
86 | | - -b, --bits uint bits is used to define the maximum quantity a token can contain (default 64) |
87 | | - --cc generate chaincode package |
88 | | - -x, --extra stringArray extra data in key=value format, where value is the path to a file containing the data to load and store in the key |
89 | | - -h, --help help for zkatdlognogh.v1 |
90 | | - -i, --idemix string idemix msp dir |
91 | | - -s, --issuers strings list of issuer MSP directories containing the corresponding issuer certificate |
92 | | - -o, --output string output folder (default ".") |
93 | | - -v, --version uint allows the caller of tokengen to override the version number put in the public params |
94 | | -``` |
| 15 | +The binary will be generated in the `$GOROOT/bin` directory. |
95 | 16 |
|
96 | | -The public parameters are stored in the output folder with name `zkatdlognoghv1_pp.json`. |
97 | | -If version is overridden, then file name will be `("zkatdlognogh%d_pp.json", version)`. |
| 17 | +## Usage |
98 | 18 |
|
99 | | -### tokengen update zkatdlognogh.v1 |
| 19 | +The `tokengen` tool uses a command-line interface with several subcommands. You can always use the `--help` flag to see available options for any command. |
100 | 20 |
|
101 | | -This command takes an existing `zkatdlognoghv1_pp.json` and allows you to update the issuer and/or auditor certificates, while keeping the public parameters intact. |
102 | | - |
103 | | -``` |
104 | | -Usage: |
105 | | - tokengen update zkatdlognogh.v1 [flags] |
106 | | -
|
107 | | -Flags: |
108 | | - -a, --auditors strings list of auditor MSP directories containing the corresponding auditor certificate |
109 | | - -x, --extra stringArray extra data in key=value format, where is the path to a file containing the data to load and store in the key |
110 | | - -h, --help help for zkatdlognogh.v1 |
111 | | - -i, --input string path of the public param file |
112 | | - -s, --issuers strings list of issuer MSP directories containing the corresponding issuer certificate |
113 | | - -o, --output string output folder (default ".") |
114 | | - -v, --version uint allows the caller of tokengen to override the version number put in the public params |
| 21 | +```bash |
| 22 | +tokengen [command] --help |
115 | 23 | ``` |
116 | 24 |
|
117 | | -## tokengen pp |
| 25 | +### Core Commands |
118 | 26 |
|
119 | | -The `tokengen pp` command has the following subcommands: |
| 27 | +- **`artifacts`**: Generates key material and configuration files from a topology description (YAML). |
| 28 | +- **`gen`**: Generates public parameters for specific drivers (e.g., `fabtoken.v1`, `zkatdlognogh.v1`). |
| 29 | +- **`update`**: Updates certificates within existing public parameters. |
| 30 | +- **`pp print`**: Inspects and prints human-readable details of a public parameters file. |
| 31 | +- **`certifier-keygen`**: Generates key pairs for token certifiers. |
| 32 | +- **`version`**: Displays the build version information. |
120 | 33 |
|
121 | | -- print: Inspect public parameters |
122 | | - |
123 | | -### tokengen pp print |
124 | | - |
125 | | -``` |
126 | | -Usage: |
127 | | - tokengen pp print [flags] |
128 | | -
|
129 | | -Flags: |
130 | | - -h, --help help for print |
131 | | - -i, --input string path of the public param file |
132 | | -``` |
133 | | - |
134 | | -## tokengen help |
| 34 | +### Examples |
135 | 35 |
|
| 36 | +#### Generate Public Parameters for FabToken |
| 37 | +```bash |
| 38 | +tokengen gen fabtoken.v1 --auditors ./msp/auditor --issuers ./msp/issuer --output ./params |
136 | 39 | ``` |
137 | | -Help provides help for any command in the application. |
138 | | -Simply type tokengen help [path to command] for full details. |
139 | 40 |
|
140 | | -Usage: |
141 | | - tokengen help [command] [flags] |
142 | | -
|
143 | | -Flags: |
144 | | - -h, --help help for help |
| 41 | +#### Inspect Public Parameters |
| 42 | +```bash |
| 43 | +tokengen pp print --input ./params/fabtokenv1_pp.json |
145 | 44 | ``` |
146 | 45 |
|
147 | | -## tokengen version |
148 | | - |
| 46 | +#### Generate Artifacts from Topology |
| 47 | +```bash |
| 48 | +tokengen artifacts --topology ./topology.yaml --output ./artifacts |
149 | 49 | ``` |
150 | | -Print current version of tokengen. |
151 | 50 |
|
152 | | -Usage: |
153 | | - tokengen version [flags] |
| 51 | +## Configuration |
154 | 52 |
|
155 | | -Flags: |
156 | | - -h, --help help for version |
157 | | -``` |
| 53 | +`tokengen` can also be configured via environment variables prefixed with `CORE_`. For example, `CORE_LOGGING_LEVEL=debug` will set the logging level to debug. |
0 commit comments