다중 서명 인증
다음 단계는 다중 서명(multisig) transaction을 생성한 다음 Sui CLI를 사용해 network에 제출하는 방법을 보여준다. transaction은 object transfer, package publish 또는 upgrade, SUI payment 등이 될 수 있다.
TypeScript SDK를 사용해 다중 서명 주소(multisig address)를 만들고 다중 서명 transaction을 생성하는 방법을 더 알아보려면 SDK documentation을 참조한다.
- Prerequisites
-
Set up your Sui account and CLI environment.
Create Sui account and setup CLI environment
$ sui client
If this is the first time running the sui client CLI tool, it asks you to provide a Sui full node server URL and a meaningful environment alias. It also generates an address with a random key pair in sui.keystore and a config client.yaml.
By default, the client.yaml and sui.keystore files are located in ~/.sui/sui_config. For more information, refer to the Sui client CLI tutorial.
If this is not your first time running sui client, then you already have a client.yaml file in your local environment. If you'd like to create a new address for this tutorial, use the command:
$ sui client new-address ed25519
- Obtain test tokens.
How to obtain tokens
If you are connected to Devnet or Testnet networks, use the Faucet UI to request tokens.
If you are connected to a local full node, learn how to get local network tokens.
이 문서는 Sui CLI, 특히 sui client와 sui keytool command에 어느 정도 익숙하다고 가정한다.
따라서 어떤 command는 별도의 맥락 설명 없이 소개될 수 있다.
참조된 command의 세부사항이 확실하지 않다면 Sui CLI documentation에서 자세한 정보를 확인한다.
object를 받으려면 작업 중인 network에 이미 존재하는 address가 하나 필요하다.
이 문서는 이 address가 현재 active address(sui client active-address)라고 가정하지만, 접근 가능한 어떤 address여도 괜찮다.
이 문서는 또한 active environment가 Testnet(sui client active-env)이라고 가정한다.
이 단계는 Devnet 또는 local network에서도 수행할 수 있지만, command를 그에 맞게 조정해야 한다.
Executing multisig transactions
다중 서명을 보여주기 위해 이 문서는 Sui CLI를 사용해 다중 서명 transaction을 설정하고 실행하는 과정을 안내한다.
Create addresses with different schemes
먼저 나중에 instruction에서 수행할 transaction의 signer 역할을 할 address 세 개를 만든다.
sui client new-address command를 사용해 지원되는 세 가지 key scheme에 대한 Sui address와 public key를 생성한다.
$ sui client new-address ed25519
$ sui client new-address secp256k1
$ sui client new-address secp256r1
console은 각 성공적인 호출에 대해 다음과 비슷한 response를 표시한다:
╭──────────────────────────────────────────────────╮
│ Created new key pair and saved it to keystore. │
├────────────────┬─────────────────────────────────┤
│ alias │ <ALIAS> │
│ address │ <SUI-ADDRESS> │
│ keyScheme │ <KEY-SCHEME> │
│ recoveryPhrase │ <RECOVERY-PHRASE> │
╰────────────────┴─────────────────────────────────╯
blockchain data를 다룰 때 address와 hashed value는 CLI 환경에서 다루기 번거로운 긴 string을 만든다.
후속 command에서 값을 더 쉽게 참조하고(그리고 copy and paste를 쉽게 하기 위해) 이 문서는 shell variable을 사용한다.
console response에서 받은 값을 사용해 이 address들에 대한 shell variable을 설정하되, <SUI-ADDRESS-*> 변수는 적절한 address로 바꾼다.
$ ADDRESS1=<SUI-ADDRESS-ED25519>
$ ADDRESS2=<SUI-ADDRESS-SECP256K1>
$ ADDRESS3=<SUI-ADDRESS-SECP256R1>
active address를 할당한 shell variable도 하나 더 만든다.
$ ACTIVE=<ACTIVE-ADDRESS>
원한다면 shell variable에 address 대신 alias 값을 설정해도 된다.
Verify addresses
sui keytool을 사용해 이전 section에서 만든 address를 나열한다.
$ sui keytool list
response는 다음과 비슷하지만 실제 alias 이름, address, key, peer ID를 표시한다:
╭────────────────────────────────────────────────────────────────────╮
│ ╭─────────────────┬──────────────────────────────────────────────╮ │
| | alias | <ALIAS-NAME> | |
│ │ suiAddress │ <SUI-ADDRESS> │ │
│ │ publicBase64Key │ <PUBLIC-KEY> │ │
│ │ keyScheme │ ed25519 │ │
│ │ flag │ 0 │ │
│ │ peerId │ <PEER-ID> │ │
│ ╰─────────────────┴──────────────────────────────────────────────╯ │
│ ╭─────────────────┬──────────────────────────────────────────────╮ │
| | alias | <ALIAS-NAME> | |
│ │ suiAddress │ <SUI-ADDRESS> │ │
│ │ publicBase64Key │ <PUBLIC-KEY> │ │
│ │ keyScheme │ secp256k1 │ │
│ │ flag │ 0 │ │
│ │ peerId │ <PEER-ID> │ │