mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-04 20:05:50 +00:00
Assign a regular key pair: apply tabs for all code types
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
The most secure way to sign a transaction is to do it locally with a [client library](client-libraries.html). Alternatively, if you run your own `rippled` node you can sign the transaction using the [sign method](sign.html), but this must be done through a trusted and encrypted connection, or through a local (same-machine) connection.
|
||||
The most secure way to sign a transaction is to [sign locally with a client library](set-up-secure-signing.html#local-signing-example). Alternatively, if you run your own `rippled` node you can sign the transaction using the [sign method](sign.html), but this must be done through a trusted and encrypted connection, or through a local (same-machine) connection.
|
||||
|
||||
In all cases, note the signed transaction's identifying hash for later.
|
||||
|
||||
@@ -24,53 +24,22 @@ This tutorial walks through the steps required to assign a regular key pair to y
|
||||
|
||||
Generate a key pair that you'll assign to your account as a regular key pair.
|
||||
|
||||
You can generate the key pair using one the following methods.
|
||||
This key pair is the same data type as a master key pair, so you can generate it the same way: you can use the client library of your choice or use the [wallet_propose method][] of a server you operate. This might look as follows:
|
||||
|
||||
### The wallet_propose method
|
||||
|
||||
Use the [wallet_propose method][] to generate the key pair that you'll assign to your account as a regular key pair.
|
||||
|
||||
#### Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
_WebSocket_
|
||||
|
||||
```json
|
||||
// Request:
|
||||
|
||||
{
|
||||
"command": "wallet_propose"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
// Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "wallet_propose"
|
||||
}
|
||||
```
|
||||
|
||||
*Commandline*
|
||||
|
||||
```sh
|
||||
#Syntax: wallet_propose
|
||||
rippled wallet_propose
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
|
||||
#### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"account_id": "rsprUqu6BHAffAeG4HpSdjBNvnA6gdnZV7",
|
||||
@@ -86,9 +55,17 @@ An example of a successful response:
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
_JSON-RPC_
|
||||
|
||||
```json
|
||||
// Request:
|
||||
|
||||
{
|
||||
"method": "wallet_propose"
|
||||
}
|
||||
|
||||
// Response:
|
||||
|
||||
{
|
||||
"result": {
|
||||
"account_id": "rsprUqu6BHAffAeG4HpSdjBNvnA6gdnZV7",
|
||||
@@ -103,9 +80,11 @@ An example of a successful response:
|
||||
}
|
||||
```
|
||||
|
||||
*Commandline*
|
||||
_Commandline_
|
||||
|
||||
```sh
|
||||
$ rippled wallet_propose
|
||||
|
||||
```json
|
||||
{
|
||||
"result" : {
|
||||
"account_id" : "rsprUqu6BHAffAeG4HpSdjBNvnA6gdnZV7",
|
||||
@@ -120,35 +99,34 @@ An example of a successful response:
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
_Python_
|
||||
|
||||
### Python using xrpl-py
|
||||
|
||||
````python
|
||||
```py
|
||||
keypair = xrpl.wallet.Wallet.create()
|
||||
print("seed:", keypair.seed)
|
||||
print("classic address:", keypair.classic_address)
|
||||
````
|
||||
```
|
||||
|
||||
### JavaScript using xrpl-js
|
||||
_JavaScript_
|
||||
|
||||
````javascript
|
||||
```js
|
||||
const keypair = new xrpl.Wallet()
|
||||
console.log("seed:", keypair.seed)
|
||||
console.log("classic address:", keypair.classicAddress)
|
||||
````
|
||||
```
|
||||
|
||||
### Java using xrpl4j
|
||||
_Java_
|
||||
|
||||
````java
|
||||
```java
|
||||
WalletFactory walletFactory = DefaultWalletFactory.getInstance();
|
||||
Wallet keypair = walletFactory.randomWallet(true).wallet();
|
||||
System.out.println(keypair);
|
||||
System.out.println(keypair.privateKey().get());
|
||||
````
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
In the next step, you'll use the `account_id` from this response to assign the key pair as a regular key pair to your account. Also, save the `master_seed` value somewhere securely. (Everything else, you can forget about.)
|
||||
In the next step, you'll use the address from this response (`account_id` in the API response) to assign the key pair as a regular key pair to your account. Also, save the seed value from this key pair (`master_seed` in the API response) somewhere securely; you'll use that key to sign transactions later. (Everything else, you can forget about.)
|
||||
|
||||
|
||||
## 2. Assign the Key Pair to Your Account as a Regular Key Pair
|
||||
|
||||
Reference in New Issue
Block a user