Skip to content

Commit

Permalink
New translations value-transfer.md (Japanese)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaia-docs committed Jan 16, 2025
1 parent 07deee7 commit e258c80
Showing 1 changed file with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Transfer cross-chain value
# クロスチェーンの価値移転

This section will explain how to enable ERC-20 value transfer between Baobab network and your ServiceChain with the provided test code.
You will add KLAY to the operator account and deploy bridge and ERC-20 contracts.
Then you will register the contract address on SCN. And you will test an ERC-20 value transferring.
その後、SCNに契約アドレスを登録します。 そして、ERC-20の値を転送するテストを行う。

## Prerequisites <a id="prerequisites"></a>
## 前提条件<a id="prerequisites"></a>

- We assume that you installed the ServiceChain, and connected the ServiceChain to the Baobab EN by the instructions in [Connecting to Baobab](en-scn-connection.md).
- Clone the repository [servicechain-value-transfer-examples](https://github.com/klaytn/servicechain-value-transfer-examples).
- Install `Node.js` (v14) and `npm` ([How to install](https://nodejs.org/en/download/package-manager/))
- This example leverages two packages, axios and caver-js, which both support v14.
- リポジトリ[servicechain-value-transfer-examples](https://github.com/klaytn/servicechain-value-transfer-examples)をクローンします。
- Node.js`(v14) `npm\` をインストールする ([インストール方法](https://nodejs.org/en/download/package-manager/))
- この例では、axiosとcaver-jsという2つのパッケージを利用しているが、どちらもv14をサポートしている。

## ERC-20 Token Transfer (one-step) <a id="erc-20-token-transfer-onestep"></a>
## ERC-20トークン転送(ワンステップ)<a id="erc-20-token-transfer-onestep"></a>

### Step 1: Add KLAY to the operator accounts. <a id="step-1-add-klay-to-the-operator-accounts"></a>

Connect to the SCN and check the account addresses by executing `subbridge.parentOperator` and `subbridge.childOperator`.
SCN に接続し、`subbridge.parentOperator` `subbridge.childOperator` を実行してアカウントアドレスを確認する。

```
$ kscn attach --datadir ~/data
Expand All @@ -28,7 +28,7 @@ $ kscn attach --datadir ~/data
![](/img/nodes/sc-vt-add-klay.png)

`subbridge.parentOperator` and `subbridge.childOperator` must have enough KLAY to send a transaction. Note that `subbridge.parentOperator` is an account on the Baobab network, and `subbridge.childOperator` is an account on the ServiceChain network.
Create a test account at [https://toolkit.kaia.io/account/accountKeyLegacy](https://toolkit.kaia.io/account/accountKeyLegacy) and get test KAIA from [the faucet](https://faucet.kaia.io/). Then send some KLAY to the `parentOperator`. `childOperator` has to get KLAY from the test account generated by `homi` ([Refer to EN Setup and SCN Connection Guide](en-scn-connection.md)).
https://toolkit.kaia.io/account/accountKeyLegacy](https://toolkit.kaia.io/account/accountKeyLegacy)でテストアカウントを作成し、[the faucet](https://faucet.kaia.io/)からテストKAIAを入手する。 Then send some KLAY to the `parentOperator`. `childOperator` has to get KLAY from the test account generated by `homi` ([Refer to EN Setup and SCN Connection Guide](en-scn-connection.md)).

```
$ kscn account import ~/homi-output/keys_test/testkey1
Expand All @@ -48,7 +48,7 @@ True
"0x84caab84ebf0c4bb4ecf0a7849f1de3e479f1863a95f70c51047a7ca7bc64b33"
```

Check if the operator accounts have enough balance. You can query from the console of the SCN node where the subbridge is installed as follows:
オペレーターの口座に十分な残高があるか確認する。 サブブリッジがインストールされている SCN ノードのコンソールから、以下のように問い合わせることができます:

```
> klay.getBalance(subbridge.childOperator)
Expand All @@ -59,15 +59,15 @@ Check if the operator accounts have enough balance. You can query from the conso
1e+18
```

### Step 2: Deploy Contracts <a id="step-2-deploy-contracts"></a>
### ステップ2:契約の展開<a id="step-2-deploy-contracts"></a>

- Connect to the SCN and prepare the node environment for contract deployment.
Clone the repository [servicechain-value-transfer-examples](https://github.com/klaytn/servicechain-value-transfer-examples).
- SCN に接続し、契約展開のためのノード環境を準備します。
リポジトリ[servicechain-value-transfer-examples](https://github.com/klaytn/servicechain-value-transfer-examples)をクローンします。

![](/img/nodes/sc-vt-deploy.png)

In this step, we would deploy both the bridge contract and token contract in the parent as well as the child chain.
Token contracts are for mint/transfer test and bridge contracts are used to listen/handle value transfer requests.
このステップでは、ブリッジ・コントラクトとトークン・コントラクトの両方を、親チェーンと子チェーンにデプロイする。
トークンコントラクトは、鋳造/移転テスト用であり、ブリッジコントラクトは、価値移転リクエストをリッスン/処理するために使用される。

```bash
$ git clone https://github.com/klaytn/servicechain-value-transfer-examples
Expand All @@ -76,14 +76,14 @@ $ npm install
$ cd erc20
```

On a text editor, edit the `bridge_info.json` as below.
テキストエディタで `bridge_info.json` を以下のように編集する。

- Replace `url` in the `child` section (SCN node on ServiceChain network) with your SCN node IP and the proper port number from `RPC_PORT` in `kscnd.conf`.
- Replace `child.key` with `testkey1` that was generated by `homi`.
- Set `child.operator` to the `subbridge.childOperator` address that we examined in the previous step.
- child`セクションの`url` (ServiceChain ネットワーク上の SCN ノード) を SCN ノードの IP アドレスに、`kscnd.conf``RPC_PORT\` を適切なポート番号に置き換えてください。
- child.key``homi`が生成した`testkey1\`に置き換える。
- child.operator`に、前のステップで調べた`subbridge.childOperator\`アドレスを設定する。
- Replace `url` in the `parent` section (EN node on Baobab network) with your EN node IP and the proper port number from `RPC_PORT` in `kend.conf`.
- Replace `parent.key` with the private key of the test account created from [https://toolkit.kaia.io/account/accountKeyLegacy](https://toolkit.kaia.io/account/accountKeyLegacy) in the previous step.
- Set `parent.operator` as the `subbridge.parentOperator` of the previous step.
- parent.key\`を、前のステップで[https://toolkit.kaia.io/account/accountKeyLegacy](https://toolkit.kaia.io/account/accountKeyLegacy)から作成したテストアカウントの秘密鍵に置き換える。
- parent.operator`を前のステップの`subbridge.parentOperator\`に設定する。

```
{
Expand All @@ -100,7 +100,7 @@ On a text editor, edit the `bridge_info.json` as below.
}
```

Perform the token deployment by running the command `node erc20-deploy.js`. This script deploys both the bridge contract and the token contract, and it outputs API usage to initialize bridge pair.
コマンド `node erc20-deploy.js` を実行して、トークンのデプロイを実行する。 このスクリプトは、ブリッジ・コントラクトとトークン・コントラクトの両方をデプロイし、ブリッジ・ペアを初期化するためのAPIの使用法を出力する。

```
$ node erc20-deploy.js
Expand All @@ -115,11 +115,11 @@ $ node erc20-deploy.js
------------------------- erc20-deploy END -------------------------
```

### Step 3: Token transfer <a id="step-3-token-transfer"></a>
### ステップ3:トークン譲渡<a id="step-3-token-transfer"></a>

![](/img/nodes/sc-vt-transfer.png)

Perform token transfer with the command `node erc20-transfer-1step.js`. This one-step token transfer requires modification of an ERC-20 token implementation. If you don't want to modify the token contract or you have a token contract that is already deployed, please refer to [ERC-20 Token Transfer (two-step)](#erc-20-token-transfer-twostep).
コマンド `node erc20-transfer-1step.js` でトークン転送を実行する。 このワンステップのトークン転送には、ERC-20トークンの実装を変更する必要がある。 トークンコントラクトを変更したくない場合、または既にデプロイされているトークンコントラクトをお持ちの場合は、[ERC-20トークン転送(2ステップ)](#erc-20-token-transfer-twostep)をご参照ください。

```
$ node erc20-transfer-1step.js
Expand All @@ -130,13 +130,13 @@ alice balance: 100
------------------------- erc20-transfer-1step END -------------------------
```

If the result is `alice balance: 100`, then it has been executed successfully.
もし結果が`alice balance: 100`なら、正常に実行されたことになる。

## ERC-20 Token Transfer (two-step) <a id="erc-20-token-transfer-twostep"></a>
## ERC-20トークン転送(2ステップ)<a id="erc-20-token-transfer-twostep"></a>

Run erc20-transfer-2step.js for the two-step transfer example. With this two-step token transfer example, unmodified ERC-20 token contracts can be used.
The two-step transfer consists of two function calls: (1) approve the bridge contract first, and then (2) call the contract function `requestERC20Transfer()`.
We do not deploy contracts in this section since we already deployed both bridge and token contracts. You must deploy first if you didn't deploy them. You can deploy the contract using `node erc20-deploy.js`.
erc20-transfer-2step.jsを実行し、2段階移籍の例を見る。 この2段階のトークン移転の例では、未修正のERC-20トークンコントラクトを使用することができます。
(1)まずブリッジ契約を承認し、次に(2)契約関数 `requestERC20Transfer()` を呼び出す。
ブリッジ・コントラクトとトークン・コントラクトの両方をすでにデプロイしているので、このセクションではコントラクトをデプロイしない。 デプロイしていない場合は、最初にデプロイしなければならない。 コントラクトは `node erc20-deploy.js` を使ってデプロイできる。

```
$ node erc20-transfer-2step.js
Expand All @@ -147,11 +147,11 @@ $ node erc20-transfer-2step.js
------------------------- erc20-transfer-2step END -------------------------
```

## KIP-7 Token Transfer via ERC-20 Interface (two-step) <a id="kip-7-token-transfer-via-erc-20-interface-two-step"></a>
## ERC-20インターフェースを介したKIP-7トークン転送(2ステップ)<a id="kip-7-token-transfer-via-erc-20-interface-two-step"></a>

[KIP-7](https://kips.kaia.io/KIPs/kip-7) is a token standard compatible with ERC-20. We can call `requestERC20Transfer()` function to a KIP-7 token contract to transfer KIP-7 tokens between a parent chain and a child chain.
In the case of sending KIP-7 tokens via the ERC-20 interface, we call the `approve()` function to allow the bridge to send the tokens on behalf of the transaction sender. Then call the `requestERC20Transfer()` function.
The below command deploys the bridge contract and a KIP-7 contract.
[KIP-7](https://kips.kaia.io/KIPs/kip-7)はERC-20と互換性のあるトークン規格です。 KIP-7トークンコントラクトに `requestERC20Transfer()` 関数を呼び出して、親チェーンと子チェーンの間でKIP-7トークンを転送することができる。
ERC-20インタフェースを介してKIP-7トークンを送信する場合、トランザクション送信者に代わってブリッジがトークンを送信できるように、`approve()`関数を呼び出す。 次に `requestERC20Transfer()` 関数を呼び出す。
以下のコマンドは、ブリッジ契約とKIP-7契約を展開する。

```
$ node kip7-deploy.js
Expand All @@ -166,7 +166,7 @@ $ node kip7-deploy.js
------------------------- kip7-deploy END -------------------------
```

The below command is an example of sending KIP-7 tokens using the ERC-20 interface with `requestERC20Transfer()`.
以下のコマンドは `requestERC20Transfer()` を使ってERC-20インターフェイスを使ってKIP-7トークンを送信する例である。

```
$ node kip7-transfer-2step-erc20-interface.js
Expand All @@ -177,11 +177,11 @@ $ node kip7-transfer-2step-erc20-interface.js
> ------------------------- kip7-transfer-2step-erc20-interface END -------------------------
```

Please refer [service-chain-value-transfer-example](https://github.com/klaytn/servicechain-value-transfer-examples) for the other cases.
その他のケースについては、[service-chain-value-transfer-example](https://github.com/klaytn/servicechain-value-transfer-examples)をご参照ください。

## Native Support for KIP-7 and KIP-17 (To Be Implemented) <a id="native-support-for-kip-7-and-kip-17-to-be-implemented"></a>
## KIP-7およびKIP-17のネイティブ・サポート(実装予定)<a id="native-support-for-kip-7-and-kip-17-to-be-implemented"></a>

Currently, the bridge contract provided by the Klaytn team supports only `requestERC20Transfer()` and `requestERC721Transfer()` for token transfer. The corresponding request functions for KIP-7 and KIP-17 will be supported soon. Before the implementation is done, as you can see above, you can transfer KIP-7 tokens using ERC-20 interfaces.
Currently, the bridge contract provided by the Klaytn team supports only `requestERC20Transfer()` and `requestERC721Transfer()` for token transfer. KIP-7とKIP-17に対応するリクエスト機能は近日中にサポートされる予定である。 実装が完了する前に、上で見たように、ERC-20インターフェースを使用してKIP-7トークンを転送することができます。

## Value Transfer for ERC-721, KIP-17, and KLAY <a id="value-transfer-for-erc721-kip17-and-klay"></a>

Expand Down

0 comments on commit e258c80

Please sign in to comment.