Skip to content

Commit f941c50

Browse files
authored
Merge pull request #87 from casper-network/chore/CD-93/replace-bytes-to-chars
Replace key bytes and char length details (CD-93)
2 parents 5759265 + 8c080d4 commit f941c50

File tree

2 files changed

+46
-28
lines changed

2 files changed

+46
-28
lines changed

docs/concepts/accounts-and-keys.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ The Casper blockchain uses an on-chain [account-based model](./design/casper-des
99
By default, a transactional interaction with the blockchain takes the form of a `Transaction` cryptographically signed by the key-pair corresponding to the `PublicKey` used to create the account.
1010

1111
The Casper platform supports two types of keys for creating accounts and signing transactions:
12-
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 bytes long
13-
- [Secp256k1](#ecdsa-keys) keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 bytes long and are also found on the Ethereum blockchain
12+
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 characters / 33 bytes long and comprising of;
13+
- `01` - 1 byte prefix (indicates `Ed25519` key type in Casper)
14+
- 32 bytes of actual `Ed25519` public key data
15+
- Example: [`01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f`](https://cspr.live/account/01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f)
16+
17+
- [Secp256k1](#ecdsa-keys) keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 characters / 34 bytes long and are also found on the Ethereum blockchain. It comprises of;
18+
- `02` - 1 byte prefix (indicates `Secp266k1` key type in Casper)
19+
- 33 bytes of actual `Secp256k1` compressed public key data
20+
- Example: [`02038baa714f1f45aaacb4443df31bf27a8990369c2f9d585f904ec5c5b85aeb231f`](https://cspr.live/account/0203f3f44c9e80e2cedc1a2909631a3adea8866ee32187f74d0912387359b0ff36a2)
1421

1522
You can generate keys using both formats, and it is also possible to [work with existing Ethereum keys](#working-with-existing-ethereum-keys).
1623

@@ -55,7 +62,7 @@ Here are some details about the files generated:
5562
2. `public_key_hex` is a hexadecimal-encoded string of the public key
5663
3. `secret_key.pem` is the *PEM*-encoded secret key
5764

58-
The public-key-hex for `Ed25519` keys starts with 01 and is 66 bytes long:
65+
The public-key-hex for `Ed25519` keys starts with 01 and is 66 characters / 33 bytes long:
5966

6067
```bash
6168
cat ed25519-keys/public_key_hex
@@ -82,7 +89,7 @@ secp256k1-keys/
8289
0 directories, 3 files
8390
```
8491

85-
The public-key-hex for `Secp256k1` keys starts with 02 and is 68 bytes long:
92+
The public-key-hex for `Secp256k1` keys starts with 02 and is 68 characters / 34 bytes long:
8693

8794
```bash
8895
cat secp256k1-keys/public_key_hex
@@ -238,35 +245,37 @@ casper-client get-account-info \
238245
--public-key <FORMATTED STRING or PATH>
239246
```
240247

241-
1. `node-address` - An IP address of a peer on the network. The default port of nodes' JSON-RPC servers on Mainnet and Testnet is 7777
248+
1. `node-address` - An IP address of a peer on the network. The default port for JSON-RPC server, which is now served by Casper Sidecar from Casper 2.0 onwards on Mainnet and Testnet, is 7777. (Refer to [RPC Changes in Casper 2.0](../../condor/rpc-changes.md) for details)
249+
242250
2. `public-key` - This must be a properly formatted public key. The public key may instead be read in from a file, in which case, enter the path to the file as the argument. The file should be one of the two public key files generated via the `keygen` subcommand; "public_key_hex" or "public_key.pem"
243251

244252
<details>
245253
<summary>Sample command and output</summary>
246254

247255
```bash
248256
casper-client get-account-info --node-address http://65.21.75.254:7777 --public-key 0202ceafc0aa35f5a7bdda22f65c046b9b30b858459e18d3670f035839ad887fe5db
257+
249258
{
250-
"id": -2018234245556346849,
251259
"jsonrpc": "2.0",
260+
"id": -4442861421270275102,
252261
"result": {
262+
"api_version": "2.0.0",
253263
"account": {
254264
"account_hash": "account-hash-0ea7998b2822afe5b62b08a21d54c941ad791279b089f3f7ede0d72b477eca34",
255-
"action_thresholds": {
256-
"deployment": 1,
257-
"key_management": 1
258-
},
265+
"named_keys": [],
266+
"main_purse": "uref-974019c976b5f26412ce486158d2431967af35d91387dae8cbcd43c20fce6452-007",
259267
"associated_keys": [
260268
{
261269
"account_hash": "account-hash-0ea7998b2822afe5b62b08a21d54c941ad791279b089f3f7ede0d72b477eca34",
262270
"weight": 1
263271
}
264272
],
265-
"main_purse": "uref-974019c976b5f26412ce486158d2431967af35d91387dae8cbcd43c20fce6452-007",
266-
"named_keys": []
273+
"action_thresholds": {
274+
"deployment": 1,
275+
"key_management": 1
276+
}
267277
},
268-
"api_version": "1.4.15",
269-
"merkle_proof": "[29712 hex chars]"
278+
"merkle_proof": "[32920 hex chars]"
270279
}
271280
}
272281

versioned_docs/version-2.0.0/concepts/accounts-and-keys.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ The Casper blockchain uses an on-chain [account-based model](./design/casper-des
99
By default, a transactional interaction with the blockchain takes the form of a `Transaction` cryptographically signed by the key-pair corresponding to the `PublicKey` used to create the account.
1010

1111
The Casper platform supports two types of keys for creating accounts and signing transactions:
12-
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 bytes long
13-
- [Secp256k1](#ecdsa-keys) keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 bytes long and are also found on the Ethereum blockchain
12+
- [Ed25519](#eddsa-keys) keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA) and are 66 characters / 33 bytes long and comprising of;
13+
- - `01` - 1 byte prefix (indicates `Ed25519` key type in Casper)
14+
- 32 bytes of actual `Ed25519` public key data
15+
- Example: [`01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f`](https://cspr.live/account/01a0d23e084a95cdee9c2fb226d54033d645873a7c7c9739de2158725c7dfe672f)
16+
17+
- [Secp256k1](#ecdsa-keys) keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve; they are 68 characters / 34 bytes long and are also found on the Ethereum blockchain. It comprises of;
18+
- `02` - 1 byte prefix (indicates `Secp266k1` key type in Casper)
19+
- 33 bytes of actual `Secp256k1` compressed public key data
20+
- Example: [`02038baa714f1f45aaacb4443df31bf27a8990369c2f9d585f904ec5c5b85aeb231f`](https://cspr.live/account/0203f3f44c9e80e2cedc1a2909631a3adea8866ee32187f74d0912387359b0ff36a2)
1421

1522
You can generate keys using both formats, and it is also possible to [work with existing Ethereum keys](#working-with-existing-ethereum-keys).
1623

@@ -55,7 +62,7 @@ Here are some details about the files generated:
5562
2. `public_key_hex` is a hexadecimal-encoded string of the public key
5663
3. `secret_key.pem` is the *PEM*-encoded secret key
5764

58-
The public-key-hex for `Ed25519` keys starts with 01 and is 66 bytes long:
65+
The public-key-hex for `Ed25519` keys starts with 01 and is 66 characters / 33 bytes long:
5966

6067
```bash
6168
cat ed25519-keys/public_key_hex
@@ -82,7 +89,7 @@ secp256k1-keys/
8289
0 directories, 3 files
8390
```
8491

85-
The public-key-hex for `Secp256k1` keys starts with 02 and is 68 bytes long:
92+
The public-key-hex for `Secp256k1` keys starts with 02 and is 68 characters / 34 bytes long:
8693

8794
```bash
8895
cat secp256k1-keys/public_key_hex
@@ -238,35 +245,37 @@ casper-client get-account-info \
238245
--public-key <FORMATTED STRING or PATH>
239246
```
240247

241-
1. `node-address` - An IP address of a peer on the network. The default port of nodes' JSON-RPC servers on Mainnet and Testnet is 7777
248+
1. `node-address` - An IP address of a peer on the network. The default port for JSON-RPC server, which is now served by Casper Sidecar from Casper 2.0 onwards on Mainnet and Testnet, is 7777. (Refer to [RPC Changes in Casper 2.0](../../condor/rpc-changes.md) for details)
249+
242250
2. `public-key` - This must be a properly formatted public key. The public key may instead be read in from a file, in which case, enter the path to the file as the argument. The file should be one of the two public key files generated via the `keygen` subcommand; "public_key_hex" or "public_key.pem"
243251

244252
<details>
245253
<summary>Sample command and output</summary>
246254

247255
```bash
248256
casper-client get-account-info --node-address http://65.21.75.254:7777 --public-key 0202ceafc0aa35f5a7bdda22f65c046b9b30b858459e18d3670f035839ad887fe5db
257+
249258
{
250-
"id": -2018234245556346849,
251259
"jsonrpc": "2.0",
260+
"id": -4442861421270275102,
252261
"result": {
262+
"api_version": "2.0.0",
253263
"account": {
254264
"account_hash": "account-hash-0ea7998b2822afe5b62b08a21d54c941ad791279b089f3f7ede0d72b477eca34",
255-
"action_thresholds": {
256-
"deployment": 1,
257-
"key_management": 1
258-
},
265+
"named_keys": [],
266+
"main_purse": "uref-974019c976b5f26412ce486158d2431967af35d91387dae8cbcd43c20fce6452-007",
259267
"associated_keys": [
260268
{
261269
"account_hash": "account-hash-0ea7998b2822afe5b62b08a21d54c941ad791279b089f3f7ede0d72b477eca34",
262270
"weight": 1
263271
}
264272
],
265-
"main_purse": "uref-974019c976b5f26412ce486158d2431967af35d91387dae8cbcd43c20fce6452-007",
266-
"named_keys": []
273+
"action_thresholds": {
274+
"deployment": 1,
275+
"key_management": 1
276+
}
267277
},
268-
"api_version": "1.4.15",
269-
"merkle_proof": "[29712 hex chars]"
278+
"merkle_proof": "[32920 hex chars]"
270279
}
271280
}
272281

0 commit comments

Comments
 (0)