Skip to content

Commit

Permalink
docs: sync cosmos-sdk to latest version & integrate pnft module (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuguen committed Mar 20, 2024
1 parent 997c018 commit c9bf16a
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .gitbook/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

* [AOL](specifications/aol.md)
* [DID](specifications/did.md)
* [Token](specifications/token.md)
* [PNFT](specifications/pnft.md)

## Resources

Expand Down
7 changes: 4 additions & 3 deletions .gitbook/guide/deploy-a-testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ panacead keys add validator
# Add that key into the genesis.app_state.accounts array in the genesis file
# NOTE: this command lets you set the number of coins. Make sure this account has some coins
# with the genesis.app_state.staking.params.bond_denom denom.
panacead add-genesis-account $(panacead keys show validator -a) 100000000000000umed
panacead genesis add-genesis-account $(panacead keys show validator -a) 100000000000000umed

# Generate the transaction that creates your validator
panacead gentx validator 1000000000000umed --commission-rate 0.1 --commission-max-rate 0.2 --commission-max-change-rate 0.01 --min-self-delegation 1000000 --chain-id testing
panacead genesis gentx validator 1000000000000umed --commission-rate 0.1 --commission-max-rate 0.2 --commission-max-change-rate 0.01 --min-self-delegation 1000000 --chain-id testing

# Add the generated bonding transaction to the genesis file
panacead collect-gentxs
panacead genesis collect-gentxs

# Now its safe to start `panacead`
panacead start
Expand All @@ -46,6 +46,7 @@ Overwrite `~/.panacea/config/genesis.json` with the first node's `genesis.json`.
Get a node ID of the first node.
```bash
panacead tendermint show-node-id
# example response
> 46046c89ec576daa0662613ee0142ab61dd2421e
```

Expand Down
2 changes: 1 addition & 1 deletion .gitbook/guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting started

This section will guide the reader to install, deploy, and interact with the Panacea blockchain.
This section will guide the reader to install, deploy, and interact with the Panacea blockchain.

### Table of contents <a id="table-of-contents"></a>

Expand Down
17 changes: 9 additions & 8 deletions .gitbook/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Install Go

[Go 1.19+](https://golang.org/doc/install) is required.
[Go 1.22+](https://golang.org/doc/install) is required.

## Install the `panacead`

Expand All @@ -12,15 +12,15 @@ please clone the `panacea-core` project and build it.

```bash
# Make sure to checkout the correct branch.
git clone -b v2.0.7-2 https://github.com/medibloc/panacea-core
git clone -b v2.2.0 https://github.com/medibloc/panacea-core
cd panacea-core
make install # All binaries are installed in $GOPATH/bin
```

Verify that the `panacead` binary is installed successfully.
```bash
$ panacead version
2.0.6
2.2.0
```

## Import `panacea-core` as a Go dependency
Expand All @@ -33,13 +33,14 @@ As a workaround, please add `replace` directives in your `go.mod` as below.
```
module your.com/yours
go 1.19
go 1.22
replace (
github.com/cosmos/cosmos-sdk => github.com/medibloc/cosmos-sdk v0.45.12-panacea.1
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/tendermint/tendermint => github.com/informalsystems/tendermint v0.34.24
google.golang.org/grpc => google.golang.org/grpc v1.33.2
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
// If you are using a ledger, you may need to replace the line as shown below:
github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4
)
```

Expand Down
169 changes: 115 additions & 54 deletions .gitbook/guide/interaction-with-the-network-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ panacead keys add <account_name>

Previously, you had to enter a password to save it to disk, but you do not currently need to.

[Setting up the keyring](https://docs.cosmos.network/v0.42/run-node/keyring.html)
[Setting up the keyring](https://docs.cosmos.network/v0.47/learn/beginner/accounts#keyring)

If you check your private keys, you'll now see `<account_name>`:

Expand Down Expand Up @@ -85,7 +85,7 @@ panacead tx send ... --fees=1000000umed
or

```bash
panacead tx send ... --gas-prices=500.0umed
panacead tx send ... --gas-prices=5umed
```

## Account
Expand Down Expand Up @@ -120,6 +120,8 @@ panacead tx bank send \
<to_address> \
<amount> \
--chain-id <chain_id> \
--from <from_key> \
--fees 1000000umed
````

where `to_address` is a key matching the format: `panacea1y3mhszahwatjc3023datq46a0u2fv337tes4n9`
Expand Down Expand Up @@ -148,6 +150,7 @@ panacead tx bank send \
<from_key_or_address> \
<to_address> \
<amount> \
--from <from_key> \
--chain-id <chain_id> \
--dry-run
```
Expand All @@ -160,6 +163,7 @@ panacead tx bank send \
<to_address> \
<amount> \
--chain-id <chain_id> \
--fees 1000000umed \
--generate-only > unsignedSendTx.json
```

Expand Down Expand Up @@ -233,7 +237,8 @@ To unjail your jailed validator
```bash
panacead tx slashing unjail \
--from <validator-operator-addr> \
--chain-id <chain_id>
--chain-id <chain_id> \
--fees 1000000umed
```

### Signing Info
Expand Down Expand Up @@ -282,7 +287,7 @@ panacead tx staking create-validator \
--commission-max-change-rate "0.01" \
--min-self-delegation "1" \
--amount 10000000umed \
--fees "1000000umed" \
--fees 1000000umed \
--from <key-name>
```

Expand Down Expand Up @@ -327,7 +332,7 @@ panacead tx staking edit-validator \
--chain-id <chain_id> \
--commission-rate "0.15" \
--from <key_name> \
--fees "1000000umed"
--fees 1000000umed
```
**Note**: The `--commission-rate` value must adhere to the following invariants:
Expand Down Expand Up @@ -776,74 +781,130 @@ so that Panacea can verify that you are the DID owner.
Deactivating a DID is not the same as deleting a DID. DIDs cannot be deleted permanently. They can just be deactivated.
And DIDs cannot be reused to create another DID Documents forever.

## Token
## PNFT

### Creating a Denom
To issue an NFT, you first need to create a Denom. The `--denom-id` value is optional; if left empty, a random UUID will be generated.

```bash
panacead tx pnft create-denom \
--denom-id <your_denom_id> \
--denom-name <your_denom_name> \
--denom-description <your_denom_description> \
--denom-symbol <your_denom_symbol> \
--denom-uri <your_denom_uri> \
--denom-uri-hash <your_denom_hash> \
--denom-data <your_denom_data> \
--from <key or address> \
--chain-id <chain-id> \
--fees 1000000umed
```

You can confirm the creation of the denom with the following query:

```bash
panacead q pnft get-denom <denom_id>
### Issue a new token
## Response
denom:
data: This is panacea denom data
description: panacea denom detail
id: 6a0e781a-c4a8-43ff-b15f-1a885adda8e3
name: panacea denom
owner: panacea1a392sz78y3hx72aegsczuu29v3rx7l8p9vxgqk
symbol: panacea
uri: https://medibloc.org
uri_hash: hash...
```

A new token can be issued by the following command. Anyone can issue a new token with fee paid.
After issuing, the token would appear in the issuer's account.
### Updating a Denom
You can update a denom. All fields except the id are updatable.

The symbol doesn't have to be unique. `-` followed by random 3 letters will be appended to the provided symbol to avoid uniqueness constraint.
Those 3 letters are the first three letters of the Tx hash of the `issue` transaction.
The generated symbol will be returned as a Tx response.
```bash
panacead tx pnft update-denom <denom_id> \
--denom-name <update_denom_name> \
--denom-description <update_denom_description> \
--denom-symbol <update_denom_symbol> \
--denom-uri <update_denom_uri> \
--denom-uri-hash <update_denom_hash> \
--denom-data <update_denom_data> \
--from <key or address> \
--chain-id <chain-id> \
--fees 1000000umed
```

For more details of each parameter, please see the [Token specification](../specifications/token.md).
### Transferring a Denom
You can change the owner of a denom. Only the current owner (`sender_address`) can initiate this transfer.

```bash
# Note that the total supply must be in micro unit without a denomination.
panacead tx token issue \
"my token" \
KAI \
1000000000 \
--mintable \
--from panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc \
--chain-id testing
panacead tx pnft transfer-denom <denom_id> <sender_address> <receiver_address> \
--from <sender_key or sender_address> \
--chain-id <chain-id> \
--fees 1000000umed
```

### Query a token
### Deleting a Denom
A denom can be deleted. Only the current owner (`remover_address`) can initiate this deletion.

```bash
# List all token symbols
$ panacead query token list-tokens --chain-id testing
panacead tx pnft delete-denom <denom_id> \
--from <remover_address> \
--chain-id <chain-id> \
--fees 1000000umed
```

- KAI-0C5
- KAI-0EA

# Query a token
$ panacead query token get-token KAI-0EA
### Minting PNFT
You can mint an NFT, but only the owner of the corresponding Denom has the right to do so.

name: my secret token
symbol: KAI-0EA
totalsupply:
denom: ukai0ea
amount: "1000000000"
mintable: true
owneraddress: panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc
```bash
panacead tx pnft mint-pnft <denom_id> <id> \
--pnft-name <your_nft_name> \
--pnft-description <your_nft_description> \
--pnft--uri <your_nft_uri> \
--pnft-uri-hash <your_nft_uri_hash> \
--pnft-data <your_nft_data> \
--from <key or address> \
--chain-id <chain-id> \
--fees 1000000umed
```

### Query account balances and send tokens
The NFT can be queried with the following:

Of course, the new token is visible in the account balance.
```bash
$ panacead query account panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc
panacead q pnft get-pnf <denom_id> <id>
address: panacea126r28pr7sstg7yfmedv3qq4st4a4exlwccx2vc
coins:
- denom: ukai0c5
amount: "1000000000"
- denom: ukai0ea
amount: "999999900"
- denom: ukai62e
amount: "1000000000"
- denom: umed
amount: "99000000000000"
pubkey: panaceapub1addwnpepqf2m7rxgazcem4e6x4hjnwexeagrqjfdlkvz65e0jpxv5sn76jurgpqmpd5
accountnumber: 0
sequence: 6
# Response
pnft:
created_at: "2024-03-20T00:27:12.970988074Z"
creator: panacea1a392sz78y3hx72aegsczuu29v3rx7l8p9vxgqk
data: ""
denom_id: 6a0e781a-c4a8-43ff-b15f-1a885adda8e3
description: ""
id: token1
name: med
owner: panacea1a392sz78y3hx72aegsczuu29v3rx7l8p9vxgqk
uri: ""
uri_hash: ""
```

Also, the new token can be sent to other accounts.
Note that the `amount` must be specified with the micro-denomination that contains the 3-letter suffix (without `-`).
### Transferring PNFT
You can transfer the ownership of an NFT to another account.

```bash
panacead tx send <from-address> <to-address> 1000000ukai0ea
panacead tx pnft transfer-pnft <denom_id> <id> <receiver> \
--from <key or address> \
--chain-id <chain-id> \
--fees 1000000umed
```

### Burning PNFT
An NFT can be burned, which is an action that can only be performed by the owner.
This command permanently removes the specified PNFT from the blockchain. Once an NFT is burned, it cannot be recovered, so this action should be considered final and irreversible.

```bash
panacead tx pnft burn-pnft <denom_id> <id> \
--from <key or address> \
--chain-id <chain-id> \
--fees 1000000umed
```
38 changes: 19 additions & 19 deletions .gitbook/guide/join-the-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ Choose the `m5.large` instance type (minimum spec).

### Configure instance details

Configuration | Value
--------------|-------
Network | Choose an existing VPC or default one if you don't have any
Subnet | Choose an existing subnet or default one if you don't have any
Auto-assign Public IP | Enable only if you access a full node from the outside of its VPC
Other fields | Follow default settings
| Configuration | Value |
|-----------------------|------- |
| Network | Choose an existing VPC or default one if you don't have any |
| Subnet | Choose an existing subnet or default one if you don't have any |
| Auto-assign Public IP | Enable only if you access a full node from the outside of its VPC |
| Other fields | Follow default settings |

### Add a storage

Configuration | Value
--------------|-------
Size | 500 GiB
Volume Type | `General Purpose SSD (gp3)`
IOPS | 3000
Throughput | 125 MB/s
| Configuration | Value |
|---------------|------- |
| Size | 500 GiB |
| Volume Type | `General Purpose SSD (gp3)` |
| IOPS | 3000 |
| Throughput | 125 MB/s |

### Configure a Security Group

Type | Protocol | Port range | Description
-----|----------|------------|-------------
SSH | TCP | 22 |
Custom TCP | TCP | 26656 | P2P with other nodes
Custom TCP | TCP | 26657 | RPC
Custom TCP | TCP | 1317 | HTTP
| Type | Protocol | Port range | Description |
|-------------|----------|------------|------------- |
| SSH | TCP | 22 |
| Custom TCP | TCP | 26656 | P2P with other nodes |
| Custom TCP | TCP | 26657 | RPC |
| Custom TCP | TCP | 1317 | HTTP |

The P2P `26656` port must be exposed to other Panacea nodes.
If your node will be in the VPC guarded by Sentry nodes, expose `26656` to only Sentry nodes (recommended).
Expand Down Expand Up @@ -169,7 +169,7 @@ panacead status

View the status of the network with the Block Explorer
- Mainnet: https://explorer.medibloc.org
- Testnet: ~~https://testnet-explorer.medibloc.org~~ https://dev.mintscan.io/hygieia
- Testnet: https://testnet-explorer.medibloc.org

## Join as a validator

Expand Down
Loading

0 comments on commit c9bf16a

Please sign in to comment.