Celestia 백서

Celestia

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 20쪽 중 16쪽

twork` or `home` flags if you have specified a custom directory or network other than Mocha or Mainnet Beta. Also keep in mind that if you do not specify a network with `--p2p.network`, the default one will always be `celestia` (Mainnet Beta). ### Steps for exporting node keys You can export a private key from the local keyring in encrypted and ASCII-armored format. ```bash ./cel-key export <key-name> --keyring-backend test --node.type bridge \ --p2p.network <network> ``` ```bash ./cel-key export <key-name> --keyring-backend test --node.type light \ --p2p.network <network> ``` ### Steps for importing node keys To import from a mnemonic, use the following command, then enter your bip39 mnemonic: ```bash ./cel-key add <key-name> --recover --keyring-backend test \ --node.type bridge --p2p.network <network> ``` ```bash ./cel-key add <key-name> --recover --keyring-backend test \ --node.type light --p2p.network <network> ``` ### View all options for `cel-key` ```sh ./cel-key --help ``` ## Managing the key returned by `celestia state account-address` When you run a Celestia node and use the command `celestia state account-address`, it returns the address of the key that your node is currently using. This key is the same one that was either: 1. Auto-generated during node initialization with `celestia <node-type> init` 2. Manually created using `cel-key add <name> [flags]` 3. Imported/recovered using `cel-key add <name> --recover --node.type <node-type>` ### Understanding the relationship The key reported by `celestia state account-address` is stored in your node's keyring directory: - For Mocha testnet: `~/.celestia-<node-type>-mocha-5/keys/keyring-test/` - For Mainnet Beta: `~/.celestia-<node-type>/keys/keyring-test/` You can verify this by listing your keys with `cel-key`: ```bash cel-key list --keyring-backend test --node.type <node-type> --p2p.network <network> ``` For example, with a light node on Mocha: ```bash cel-key list --keyring-backend test --node.type light --p2p.network mocha ``` The address shown in this output should match the one returned by `celestia state account-address`. ### Backing up your key To back up the key used by your node, you have two options: #### Option 1: Export the key's mnemonic ```bash cel-key export <key-name> --keyring-backend test --node.type <node-type> --p2p.network <network> ``` For example, if your key is named "my_celes_key": ```bash cel-key export my_celes_key --keyring-backend test --node.type light --p2p.network mocha ``` This will prompt you for a password to encrypt the exported key. Store this exported key and password securely. #### Option 2: Back up the keyring directory You can also directly back up the entire keyring directory: ```bash # For Mocha testnet cp -r ~/.celestia-<node-type>-mocha-5/keys/keyring-test /secure/backup/location # For Mainnet Beta cp -r ~/.celestia-<node-type>/keys/keyring-test /secure/backup/location ``` ### Recovering your key If you need to recover your key on a new machine or after reinstalling your node: #### Option 1: Recover using the mnemonic If you have the mnemonic phrase for your key: ```bash cel-key add <key-name> --recover --keyring-backend test --node.type <node-type> --p2p.network <network> ``` For example: ```bash cel-key add my_celes_key --recover --keyring-backend test --node.type light --p2p.network mocha ``` You'll be prompted to enter your mnemonic phrase. #### Option 2: Restore from backup If you backed up the keyring directory: 1. Install and initialize your node as normal 2. Stop the node if it's running 3. Replace the keyring-test directory with your backup: ```bash # For Mocha testnet cp -r /secure/backup/location/* ~/.celestia-<node-type>-mocha-5/keys/keyring-test/ # For Mainnet Beta cp -r /secure/backup/location/* ~/.celestia-<node-type>/keys/keyring-test/ ``` 4. Start your node with the restored key: ```bash celestia <node-type> start --p2p.network <network> --keyring.keyname <key-name> [other flags] ``` ### Using a specific key with your node If you have multiple keys and want to use a specific one with your node: ```bash celestia <node-type> start --p2p.network <network> --keyring.keyname <key-name> [other flags] ``` For example: ```bash celestia light start --p2p.network mocha --keyring.keyname my_celes_key \ --core.ip public-endpoint.celestia-mocha.quiknode.pro \ --core.port 9090 --core.tls ``` This ensures your node uses the specified key for all operations, including those reported by `celestia state account-address`. ## Docker and `cel-key` ### Prerequisites - Docker installed on your machine - Understanding of the [guide on how to run celestia-node with Docker](/operate/getting-started/docker). ### Running your node Run the Docker image (in this example, we are using a light node on Mocha testnet): ```bash docker run --name celestia-node -e NODE_TYPE=light -e P2P_NETWORK=mocha -p 26659:26659 \ ghcr.io/celestiaorg/celestia-node:v0.34.3-mocha celestia light start \ --core.ip public-endpoint.celestia-mocha.quiknode.pro --core.port 9090 \ --core.tls --p2p.network mocha ``` Refer to [the ports section of the celestia-node troubleshooting page](/operate/maintenance/troubleshooting#ports) for information on which ports are required to be open on your machine. You do not need to declare a network for Mainnet Beta. Refer to [the chain ID section on the troubleshooting page for more information](/operate/maintenance/troubleshooting). List active containers in another window with: ```bash docker ps ``` The response will look like: ```bash CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <container-id> celestia-node "/entrypoint.sh cele…" 22 seconds ago Up 21 seconds 2121/tcp docker-compose-test-celestia-1 ``` Interact with the container by replacing `<container-id>` for the container ID: ```bash docker exec -ti <container-id> /bin/bash ``` Now, interact with `cel-key` to check for the key that was autogenerated when you started the node: ```bash ./cel-key list --keyring-backend test --node.type light ``` You can also export your key from the container. In the next section, you'll learn how to mount existing keys to the container. ### Mounting existing keys to container In this example, we'll be mounting an existing key to the container. We're also using an existing image called celestia-node. This will mount the entire `/.celestia-light-<p2p-network>/keys` directory to your image, or on Mainnet Beta the `/.celestia-light/keys` directory. Write a `docker-compose.yml` to accomplish this: ```yaml version: "3.8" services: celestia: image: celestia-node environment: - NODE_TYPE=light command: celestia light start --core.ip public-endpoint.celestia-mocha.quiknode.pro --core.port 9090 --core.tls --p2p.network mocha --keyring.keyname my_celes_key volumes: - ${PWD}/keys:/root/.celestia-light-mocha-5/keys ports: - 26659:26659 ``` Start the container by running the following command in the directory with your `docker-compose.yml`: ```bash docker-compose up ``` List active containers in another window with: ```bash docker ps ``` The response will look like: ```bash CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <container-id> celestia-node "/entrypoint.sh cele…" 22 seconds ago Up 21 seconds 2121/tcp docker-compose-test-celestia-1 ``` Interact with the container by replacing `<container-id>` for the container ID: ```bash docker exec -ti <container-id> /bin/bash ``` Now, interact with `cel-key` to check your address matches the address you expect with the key you mounted: ```bash root@<container-id>:/# ./cel-key list --keyring-backend test --node.type light using directory: ~/.celestia-light-mocha-5/keys - address: celestia1wkhyhr7ngf0ayqlpnsnxg4d72hfs5453dvunm9 name: my_celes_key pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A1/NsoY0RGL7Hqt4VWLg441GQKJsZ2fBUnZXipgns8oV"}' type: local ``` --- Title: Multisig URL: https://docs.celestia.org/operate/keys-wallets/multisig.md Source: app/operate/keys-wallets/multisig/page.mdx --- # Multisig Celestia inherits support for multisig accounts from the Cosmos SDK. Multisig accounts behave similarly to regular accounts with the added requirement that a threshold of signatures is needed to authorize a transaction. Multisig accounts can be created from the [command line](#command-line) or using a graphical interface such as [Keplr](https://multisig.keplr.app/). ## Command line ```bash #!/bin/sh # Prerequisite: prior to running this script, start a single node devnet with ./scripts/single-node.sh CHAIN_ID="private" KEY_NAME="validator" KEYRING_BACKEND="test" BROADCAST_MODE="block" # Create 3 test keys celestia-appd keys add test1 celestia-appd keys add test2 celestia-appd keys add test3 # Create the multisig account celestia-appd keys add multisig \ --multisig test1,test2,test3 \ --multisig-threshold 2 # Send some funds from the validator account to the multisig account celestia-appd tx bank send $VALIDATOR $MULTISIG 100000utia \ --from $VALIDATOR \ --fees 1000utia \ --chain-id $CHAIN_ID \ --keyring-backend $KEYRING_BACKEND \ --broadcast-mode $BROADCAST_MODE \ --yes # Send some funds from the multisig account to the validator account. # Note this transaction will need to be signed by at least 2 of the 3 test accounts. celestia-appd tx bank send $MULTISIG $VALIDATOR 1utia \ --from $MULTISIG \ --fees 1000utia \ --chain-id $CHAIN_ID \ --keyring-backend $KEYRING_BACKEND \ --generate-only > unsignedTx.json # Sign from test1 and test2 celestia-appd tx sign unsignedTx.json \ --multisig $MULTISIG \ --from test1 \ --output-document test1sig.json \ --chain-id $CHAIN_ID celestia-appd tx sign unsignedTx.json \ --multisig $MULTISIG \ --from test2 \ --output-document test2sig.json \ --chain-id $CHAIN_ID # Generate the final signed transaction celestia-appd tx multisign unsignedTx.json multisig \ test1sig.json test2sig.json \ --output-document signedTx.json \ --chain-id $CHAIN_ID ``` ## Resources - [https://figment.io/insights/how-to-multi-sig-on-cosmos/](https://figment.io/insights/how-to-multi-sig-on-cosmos/) - [https://github.com/aura-nw/Aura-Safe](https://github.com/aura-nw/Aura-Safe) - [https://github.com/informalsystems/multisig](https://github.com/informalsystems/multisig) --- Title: How to create a vesting account with celestia-app URL: https://docs.celestia.org/operate/keys-wallets/vesting.md Source: app/operate/keys-wallets/vesting/page.mdx --- # How to create a vesting account with celestia-app In this guide, we will learn how to create a vesting account using celestia-app for both a local devnet and on Mocha testnet. > **Note:** The instructions for this tutorial are for a **continuous** vesting account. To create a delayed vesting account, add the `--delayed` flag to your vesting transaction. ## Local devnet [download and install celestia-app](/operate/consensus-validators/install-celestia-app), selecting the [network and corresponding version](/operate/networks/overview) that you would like to use. ### Setting up the local devnet #### Run the devnet Next, change into the `$HOME/celestia-app` directory and run the single-node-devnet script. ```bash cd $HOME/celestia-app ./scripts/build-run-single-node.sh ``` #### Save the home directory path At the top of the output, you will see a path to the "Home directory", find yours from the output (**it will be unique every time**): ```bash ./scripts/build-run-single-node.sh Home directory: /var/folders/_8/ljj6hspn0kn09qf9fy8kdyh40000gn/T/celestia_app_XXXXXXXXXXXXX.XV92a3qx --> Updating go.mod ``` And set the location as the `CELESTIA_APP_HOME` variable. We will use this for the remainder of the devnet section. ```bash export CELESTIA_APP_HOME=/var/folders/_8/ljj6hspn0kn09qf9fy8kdyh40000gn/T/celestia_app_XXXXXXXXXXXXX.XV92a3qx ``` > **Note:** This does not replace the `celestia-appd` binary that was installed with `celestia-appd`, but builds and runs one in the `$HOME/celestia-app/build` directory. #### Check the version of the devnet If you'd like to check the version of your local devnet, you can use: ```bash cd $HOME/celestia-app/build ./celestia-appd version ``` #### Next steps Congratulations! You now have a private devnet running locally on your machine. The devnet is made up of one validator that is creating new blocks. This is the Celestia consensus network on your machine! The key that was created to run the validator also lives in a temporary directory for the devnet. Now you are ready to test creating a vesting account on our devnet before going to Mocha, a live testnet. ### Setting up vesting account on devnet You already have one key setup, but you will need one more to create a vesting account. #### Create a new key First, create a vesting key: ```bash cd $HOME/celestia-app/build ./celestia-appd keys add vesting-key --home $CELESTIA_APP_HOME ``` You will see the address, mnemonic, and more details about your key in the output: ```bash - address: celestia127fpaygehlsgjdknwvlr2mux7h5uvhkxktgkc5 name: vesting-key pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5JF/we+s5gFt6g944XbKVVYgQB9OY+U/l5dhZjLDczO"}' type: local **Important** write this mnemonic phrase in a safe place. It is the only way to recover your account if you ever forget your password. index enter egg broken ostrich duty bitter blind all car hollow coral youth early verify point void anger daring sausage decline net shove oil ``` #### List your keys ```bash ./celestia-appd keys list --home $CELESTIA_APP_HOME ``` Output: ```bash - address: celestia1adgkqcmzuxvg7x5avx8a8rjwpmxgzex3ztef6j name: validator pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ahzu6yr9XMPIxLquhgBhj9xL3wIaOz6PE3CvML/oPQym"}' type: local - address: celestia127fpaygehlsgjdknwvlr2mux7h5uvhkxktgkc5 name: vesting-key pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5JF/we+s5gFt6g944XbKVVYgQB9OY+U/l5dhZjLDczO"}' type: local ``` #### Set variables Set the keys as variables, using the validator address as the `FROM_ADDRESS` and the vesting-key as the `TO_ADDRESS`. ```bash export FROM_ADDRESS=celestia1adgkqcmzuxvg7x5avx8a8rjwpmxgzex3ztef6j export TO_ADDRESS=celestia127fpaygehlsgjdknwvlr2mux7h5uvhkxktgkc5 ``` #### Create your devnet vesting account Create the vesting account with the following command: > **Note:** The remainder of the instructions are for a **continuous** vesting account. To create a delayed vesting account, use the `--delayed` flag. For example: > `./celestia-appd tx vesting create-vesting-account $TO_ADDRESS 100000utia 1686748051 --from $FROM_ADDRESS --gas auto --fees 100000utia --chain-id private --home $CELESTIA_APP_HOME --delayed` ```bash ./celestia-appd tx vesting create-vesting-account $TO_ADDRESS 100000utia 1686748051 --from $FROM_ADDRESS --gas auto --fees 100000utia --chain-id private --home $CELESTIA_APP_HOME ``` Select "Y" to choose "yes". > **Optional:** Add `-y` to run the transaction without an interactive prompt: > `./celestia-appd tx vesting create-vesting-account $TO_ADDRESS 100000utia 1686748051 --from $FROM_ADDRESS --gas auto --fees 100000utia --chain-id private --home $CELESTIA_APP_HOME -y` Output: ```bash gas estimate: 96112 auth_info: fee: amount: - amount: "100000" denom: utia gas_limit: "96112" granter: "" payer: "" signer_infos: [] tip: null body: extension_options: [] memo: "" messages: - '@type': /cosmos.vesting.v1beta1.MsgCreateVestingAccount amount: - amount: "100000" denom: utia delayed: false end_time: "1686748051" from_address: celestia1adgkqcmzuxvg7x5avx8a8rjwpmxgzex3ztef6j to_address: celestia127fpaygehlsgjdknwvlr2mux7h5uvhkxktgkc5 non_critical_extension_options: [] timeout_height: "0" signatures: [] confirm transaction before signing and broadcasting [y/N]: y code: 0 codespace: "" data: "" events: [] gas_used: "0" gas_wanted: "0" height: "0" info: "" logs: [] raw_log: '[]' timestamp: "" tx: null txhash: 6093DF76DBA90F04FF63D197FC1569F04ED3DBE64081A0BBA9BAD4E69AA570D2 ``` The timestamp for the previous command is in the past, so once you create the vesting account, the tokens will vest. You can check your account balances to verify this. #### Query the devnet vesting account details Check that the account has been created and works as expected by querying the `TO_ADDRESS` account details: ```bash ./celestia-appd query account $TO_ADDRESS --home $CELESTIA_APP_HOME ``` In the output, you will notice that the account type is a `ContinuousVestingAccount`: ```bash '@type': /cosmos.vesting.v1beta1.ContinuousVestingAccount base_vesting_account: base_account: account_number: "7" address: celestia127fpaygehlsgjdknwvlr2mux7h5uvhkxktgkc5 pub_key: null sequence: "0" delegated_free: [] delegated_vesting: [] end_time: "1686748051" original_vesting: - amount: "100000" denom: utia start_time: "1687908352" ``` #### Query the devnet base account details Check the `FROM_ADDRESS` account details: ```bash ./celestia-appd query account $FROM_ADDRESS --home $CELESTIA_APP_HOME ``` In the output, you will notice the account type is `BaseAccount`: ```bash '@type': /cosmos.auth.v1beta1.BaseAccount account_number: "0" address: celestia1adgkqcmzuxvg7x5avx8a8rjwpmxgzex3ztef6j pub_key: '@type': /cosmos.crypto.secp256k1.PubKey key: Ahzu6yr9XMPIxLquhgBhj9xL3wIaOz6PE3CvML/oPQym sequence: "2" ``` #### Query the balances of the devnet accounts Next, we can check the balance of the accounts: ```bash ./celestia-appd query bank balances $TO_ADDRESS --home $CELESTIA_APP_HOME ``` Output will show you the balance of the vesting account: ```bash balances: - amount: "100000" denom: utia pagination: next_key: null total: "0" ``` ```bash ./celestia-appd query bank balances $FROM_ADDRESS --home $CELESTIA_APP_HOME ``` The output will show the remaining balance of the validator: ```bash balances: - amount: "999994999800000" denom: utia pagination: next_key: null total: "0" ``` Congratulations! You've now made your own vesting account on a local devnet. Next, you can learn how to create a vesting account on Mocha testnet. ## Mocha In the previous section of this tutorial, we learned how to create a vesting account on a local devnet. In this portion of the tutorial, we'll cover how to set up a consensus node and set up a vesting account on [Mocha testnet](/operate/networks/mocha-testnet). First, be sure that you have [installed celestia-app for the latest version for Mocha testnet](/operate/consensus-validators/install-celestia-app). ### Create a wallet Set the keyring backend, so you don't need to use the flag for every command: ```bash celestia-appd config keyring-backend test ``` Add a new key for a full node and one for a vesting account: ```bash celestia-appd keys add origin && celestia-appd keys add vesting ``` List the keys: ```bash celestia-appd keys list ``` Set your keys as variables: ```bash export FROM_ADDRESS=address_of_origin_account export TO_ADDRESS=address_of_vesting_account ``` ### Fund your account Head to [the faucet](/operate/networks/mocha-testnet#mocha-testnet-faucet), and fund your `origin` address. ### Create a vesting account on Mocha To create a vesting account on Mocha, you will need an RPC URL to send the transaction to. You can find the [consensus endpoints on the Mocha testnet page](/operate/networks/mocha-testnet#community-consensus-endpoints). If you are running a production application, use a production endpoint. Set your RPC URL: ```bash export RPC_URL=https://public-endpoint.celestia-mocha.quiknode.pro ``` We will use a few flags in our vesting command that are different than the devnet version. Since we aren't using our own validator or full node, we will use an RPC URL. We also need to declare the chain ID as `mocha`. View the help menu for vesting to understand these flags more: ```bash celestia-appd tx vesting --help ``` Here's an example command to
프로젝트로 돌아가기