最終更新:
編集

Enable No Freeze

If you issue tokens in the XRP Ledger, can enable the No Freeze setting to permanently limit your own ability to use the token freezing features of the XRP Ledger. (As a reminder, this only applies to issued tokens, not XRP.) This tutorial shows how to enable the No Freeze setting on your issuing account.

Prerequisites

  • You need a connection to the XRP Ledger network. As shown in this tutorial, you can use public servers for testing.
  • You should be familiar with the Getting Started instructions for your preferred client library. This page provides examples for the following:
  • You don't need to have issued a token in the XRP Ledger to enable No Freeze, but the main reason you would do so is if you intend to or have already issued such a token.

Example Code

Complete sample code for all of the steps of this tutorial is available under the MIT license.

Steps

1. Get Credentials

To transact on the XRP Ledger, you need an address and secret key, and some XRP. If you use the best practice of having separate "cold" and "hot" addresses, you need the master keys to the cold address, which is the issuer of the token. Only the issuer's No Freeze setting has any effect on a token.

Caution
You cannot use a regular key pair or multi-signing to enable the No Freeze setting.

For this tutorial, you can get credentials from the following interface:

(loading)暗号鍵を作成しています…

注意
RippleはTestnetとDevnetをテストの目的でのみ運用しており、その状態とすべての残高を定期的にリセットしています。予防措置として、Testnet、DevnetとMainnetで同じアドレスを使用しないことをお勧めします。

When you're building production-ready software, you should use an existing account, and manage your keys using a secure signing configuration.

2. Connect to the Network

You must be connected to the network to submit transactions to it. The following code shows how to connect to a public XRP Ledger Testnet server a supported client library:

// In browsers, use a <script> tag. In Node.js, uncomment the following line:
// const xrpl = require('xrpl')

// Wrap code in an async function so we can use await
async function main() {

  // Define the network client
  const client = new xrpl.Client("wss://s.altnet.rippletest.net:51233")
  await client.connect()

  // ... custom code goes here

  // Disconnect when done (If you omit this, Node.js won't end the process)
  await client.disconnect()
}

main()

For this tutorial, click the following button to connect:

接続ステータス:接続されていません
(loading)...

3. Send AccountSet Transaction

To enable the No Freeze setting, send an AccountSet transaction with a SetFlag field containing the asfNoFreeze value (6). To send the transaction, you first prepare it to fill out all the necessary fields, then sign it with your account's secret key, and finally submit it to the network.

For example:

  // Submit an AccountSet transaction to enable No Freeze ----------------------
  const accountSetTx = {
    TransactionType: "AccountSet",
    Account: wallet.address,
    // Set the NoFreeze flag for this account
    SetFlag: xrpl.AccountSetAsfFlags.asfNoFreeze
  }

  // Best practice for JS users - validate checks if a transaction is well-formed
  xrpl.validate(accountSetTx)

  console.log('Sign and submit the transaction:', accountSetTx)
  await client.submitAndWait(accountSetTx, { wallet: wallet })

  

4. Wait for Validation

Most transactions are accepted into the next ledger version after they're submitted, which means it may take 4-7 seconds for a transaction's outcome to be final. If the XRP Ledger is busy or poor network connectivity delays a transaction from being relayed throughout the network, a transaction may take longer to be confirmed. (For information on how to set an expiration for transactions, see Reliable Transaction Submission.)

トランザクションのID:(無)
最新の検証レジャーインデックス:接続されていません
送信時のレジャーインデックス:(まだ送信されません)
トランザクションのLastLedgerSequence:(準備されません)

5. Confirm Account Settings

After the transaction is validated, you can check your account's settings to confirm that the No Freeze flag is enabled. You can do this by calling the account_info method and checking the value of the account's Flags field to see if the lsfNoFreeze bit (0x00200000) is enabled.

  // Request account info for my_address to check account settings ------------
  const response = await client.request(
    {command: 'account_info', account: my_address })
  const settings = response.result
  const lsfNoFreeze = xrpl.LedgerEntry.AccountRootFlags.lsfNoFreeze

  console.log('Got settings for address', my_address);
  console.log('No Freeze enabled?',
    (settings.account_data.Flags & lsfNoFreeze) 
    === lsfNoFreeze)

  

See Also