Skip to content

Commit

Permalink
avalanche key transfer (#1910)
Browse files Browse the repository at this point in the history
* new folder and rename ledger tutorial

* document key transfer function

* small changes

* accordion

* add to meta.json

* key-list

* add redirect

---------

Co-authored-by: owenwahlgren <owenwahlgren@gmail.com>
  • Loading branch information
meaghanfitzgerald and owenwahlgren authored Oct 8, 2024
1 parent f8437d8 commit 10b1b65
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 1 deletion.
1 change: 1 addition & 0 deletions content/docs/tooling/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"create-avalanche-nodes",
"cross-chain",
"transfer-p-chain-funds",
"transactions",
"---Scripts & APIs---",
"avalanche-js",
"glacier-api",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Transfer P-Chain Funds
title: Ledger P-Chain Transfer
description: Transferring funds between P-Chain using Avalanche CLI.
---

Expand Down
111 changes: 111 additions & 0 deletions content/docs/tooling/transactions/native-send.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
title: Send AVAX on C/P-Chain
description: Learn how to execute a native transfer on the C or P-Chain using the Avalanche CLI.
---

# Prerequisites

- Install the [Avalanche CLI](https://docs.avax.network/tooling/guides/get-avalanche-cli).
- Use the CLI to [create a key](https://docs.avax.network/tooling/avalanche-cli#key-create).
- Fund the key with AVAX. You can use the [faucet](https://test.core.app/tools/testnet-faucet/?subnet=c&token=c) with coupon code `devrel-avax-0112` to get testnet AVAX.
- *Optionally*, you can [export](https://docs.avax.network/tooling/avalanche-cli#key-export) your private key for use in scripting or other tools.

## Initiate the `transfer` Command and Walk Through the Prompts

In your terminal, run the following command:

```zsh
avalanche key transfer
```

<Callout title="Note">

This command and all of its flags are documented [here](https://docs.avax.network/tooling/avalanche-cli#key-transfer).

</Callout>

You will be prompted to answer the following questions:

```zsh
? On what Network do you want to execute the transfer?:
▸ Mainnet
Fuji Testnet
Devnet
Local Network
```
<Accordions>
<Accordion title="Note: Devnet">
If you select "Devnet", you must input the RPC URL. If your devnet's C-Chain RPC is `https://demo.avax-dev.network/ext/bc/C/rpc`, you should input the URL as:

```zsh
✔ Devnet Endpoint: https://demo.avax-dev.network
```

</Accordion>
</Accordions>

Select the chain you want to transfer funds from:

```zsh
? Where are the funds to transfer?:
▸ P-Chain
C-Chain
My blockchain isn't listed
```
Select the chain you want to transfer funds to:
```zsh
? Destination Chain:
▸ P-Chain
X-Chain
```
Select the step of the transfer process you want to execute:
```zsh
? Step of the transfer:
▸ Send
Receive
```
<Callout title="Note">
If you are performing a native transfer where the sender and receiver address are on the same chain, you only need to complete a "send" transaction.
If you wish to perform a cross-chain transfer (i.e. from C to P-Chain), you should abort this flow and reinitiate the command as `avalanche key transfer --fund-p-chain` or `avalanche key transfer --fund-x-chain`, completing both the "send" and "receive" flows with keys stored in the CLI.
You can fund your CLI-stored key with AVAX on the C-Chain using the [faucet](https://test.core.app/tools/testnet-faucet/?subnet=c&token=c) with coupon code `devrel-avax-0112`.
</Callout>
Select the sender address:
```zsh
? Which key should be used as the sender?:
▸ Use stored key
Use ledger
? Which stored key should be used as the sender address?:
▸ DemoKey
MyKey
ewoq
```
Specify the amount to send, input the destination address:
```zsh
✗ Amount to send (AVAX units): 100
✗ Destination address: P-avax1zgjx8zj7z7zj7z7zj7z7zj7z7zj7zj7zj7zj7e
```
Review the transaction details and confirm/abort:
```zsh
this operation is going to:
- send 100.000000000 AVAX from P-avax1gmuqt8xg9j4h88kj3hyprt23nf50azlfg8txn2 to destination address P-avax1f630gvct4ht35ragcheapnn2n5cv2tkmq73ec0
- take a fee of 0.001000000 AVAX from source address P-avax1gmuqt8xg9j4h88kj3hyprt23nf50azlfg8txn2
? Confirm transfer:
No
▸ Yes
```
After a successful transfer, you can check your CLI keys' balances with the [command](https://docs.avax.network/tooling/avalanche-cli#key-list): `avalanche key list`.
5 changes: 5 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ const config = {
destination: '/nodes/on-third-party-services/microsoft-azure',
permanent: true,
},
{
source: '/tooling/transfer-p-chain-funds',
destination: '/tooling/transactions/ledger-p-chain-transfer',
permanent: true,
},
{
source: '/tooling/avalanchego-postman-collection/data-visualization',
destination: '/tooling/avalanche-postman/data-visualization',
Expand Down

0 comments on commit 10b1b65

Please sign in to comment.