XRP 백서

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

by software. Ensuring payments are given for services rendered. ## /docs/use-cases/tokenization/digital-artist Digital Artist Copy As a Digital Artist, I want to use the XRPL to create a NFToken of my work and sell it on the XRPL, because the XRPL is both cost efficient and carbon neutral. When you create a NFToken, you create a unique token on the XRPL that is effectively a placeholder for an actual physical or digital asset. When you create the NFToken, you provide a URL to a digital file that is the item itself, such as a digital artwork, or a URL to a placeholder that represents an item in the physical world. As a digital artist, you’re focused on creating NFTs, presumably to sell on the XRP Ledger (it’s also possible you might create NFTs as a way of establishing provenance for your creations). You can create NFTokens using an app such as the Xaman app . For a more hands-on experience, you can follow the steps in the Quickstart Tutorial 3 - Mint and Burn NFTokens . Use a public server As you get started, you will likely have comparatively few transactions. You can work with one of the free XRP Ledger public servers. As your business grows, you might consider your own NFT Ledger instance to handle increased sales traffic. See Public servers . Create NFTs Build your marketplace by minting NFTs to sell. To create your first NFTs, follow the instructions in the tutorial Mint and Burn NFTokens . Keep the following in mind as you create your NFTs: You can collect royalties from future sales by setting a transfer fee . This is a value from 0-50000 representing 0-50% of the sale price. See Transfer Fee . The NFToken URL is a link to the location where the content of the NFT is stored. One option is create an IPFS account and store the NFToken content at a persistent URL. See Best Practices for Storing NFT Data . [Add link to blog post about alternative NFT cache options.] You can mint NFTs in logical collections using the TokenTaxon field. See Minting NFTs into Collections . If you, as the issuer, want to be able to burn the token in the future, set the Flags field to 1. To make the NFT transferable, set the Flags field to 8 . Set the Flags field to 9 to make the NFT both burnable and transferable. See Burnable flag and Transferable flag . See Mint and Burn NFTokens . Sell NFTs You transfer NFTs by creating a sell offer. See Transfer NFTokens . You can sell your NFTs in an auction format. See Running an NFT Auction . Reserve requirements There are several XRP reserve requirements when you mint NFTs for sale. Each NFToken page requires a reserve of 0.2 XRP . A NFToken page can store 16-32 NFTs. Each NFTokenOffer object requires a reserve of 0.2 XRP . When you post the NFTokenOffer or sell the NFT, there are trivial transfer fees (roughly 6000 drops, or .006 XRP). When you are selling at a high volume, the trivial amounts can add up quickly, and need to be considered as part of your cost of doing business. See: NFTokenOffer NFToken page ( Owner reserve ) Trivial transfer fees Checkout The most straightforward payment for XRPL NFTs is XRP. For examples of selling and buying NFTs using XRP, see Transfer NFTokens . For trade in other currencies, you can leverage the DEX to accept and convert issued currencies of all kinds. See Trade in the Decentralized Exchange . Indexing NFTs When listing NFTs for sale, it can be useful to use object metadata to organize them. You can use queries in the XRPL libraries, the Clio server, and extensions in the XRPL API and Bithomp libraries to sort and filter NFTs by creator, price, collection, rarity, and more. See: Clio setup XRPL Data API Bithomp Burning NFTs There are some workflows where it makes sense for the issuer to retain the right to burn the token at some point in the future, regardless of the current owner. For example, NFTs used for carbon credits can be minted and traded, but once the carbon is captured, the NFT can be burned so that it is no longer transferable. For these scenarios, set the flagBurnable flag when you mint the NFT. Another example might be burning an in-game asset that is lost by a player after losing a life in the game. You might also burn an NFT ticket after successful redemption to prevent it from being used again. ## /docs/use-cases/defi/list-xrp-as-an-exchange List XRP as an Exchange Copy This document describes the steps that an exchange needs to take to list XRP. These steps are targeted at custodial exchanges that hold funds on behalf of users, and allows users to deposit, withdraw, and trade other digital assets, fiat currencies, or other types of asset. Alpha Exchange For illustrative purposes, this document uses a fictitious business called Alpha Exchange to explain the high-level steps required to list XRP. For the purposes of this document, Alpha Exchange: Currently specializes in listing BTC/USD Wants to add BTC/XRP and XRP/USD trading pairs Maintains balances for all of its customers Maintains balances for each of its supported currencies User Benefits Alpha Exchange wants to list BTC/XRP and XRP/USD trading pairs partially because listing these pairs benefits its users. Specifically, this support wants to enable its users to: Deposit XRP to Alpha Exchange from the XRP Ledger Withdraw XRP from Alpha Exchange to the XRP Ledger Trade XRP with other currencies, such as BTC, USD, among others Prerequisites for Supporting XRP To support XRP, Alpha Exchange must: Create and maintain new accounts Create and maintain balance sheets See also: Compliance Guidelines — Token issuers and exchanges are different, but exchanges should also ensure that they are complying with local regulations and reporting to the appropriate agencies. Precautions Partial Payments Before integrating, exchanges should be aware of the partial payments feature. This feature allows XRP Ledger users to send successful payments that reduce the amount received instead of increasing the SendMax . This feature can be useful for returning payments without incurring additional cost as the sender. Partial Payments Warning When the tfPartialPayment flag is enabled, the Amount field is not guaranteed to be the amount received . The delivered_amount field of a payment's metadata indicates the amount of currency actually received by the destination account. When receiving a payment, use delivered_amount instead of the Amount field to determine how much your account received instead. Warning Be aware that malicious actors could exploit this. For more information, see Partial Payments . Accounts XRP is held in accounts (also referred to as wallets or addresses ) on the XRP Ledger. Accounts on the XRP Ledger are different than accounts on other blockchain ledgers, such as Bitcoin, where accounts incur little to no overhead. In the XRP Ledger, account state is stored per ledger and accounts are not easy to delete . To offset the costs associated with storing accounts, each account must hold a separate reserve of XRP that cannot be sent to others. For these reasons, Ripple recommends that institutions not create excessive or needless accounts. To follow Ripple's recommended best practices, Alpha Exchange should create at least two new accounts on the XRP Ledger. To minimize the risks associated with a compromised secret key, Ripple recommends creating cold , hot , and warm accounts (these are sometimes referred to, respectively, as cold, hot, and warm wallets). The hot/warm/cold model is intended to balance security and convenience. Exchanges listing XRP should create the following accounts: A cold wallet to securely hold the majority of XRP and customers' funds. For exchanges, this is also the address to which its users send deposits . To provide optimal security, this account's secret key should be offline. If a malicious actor compromises an exchange's cold wallet, the possible consequences are: The malicious actor gets full access to all XRP in the cold wallet. If the master key is compromised, the malicious actor can irrevocably take control of the cold wallet forever (by disabling the master key and setting a new regular key or signer list). This would also give the malicious actor control over all future XRP received by the cold wallet. If this happens, the exchange has to make a new cold wallet address and tell its customers the new address. If the regular key or signer list are compromised, the exchange can regain control of the cold wallet. However, some of a malicious actor's actions cannot easily be undone: The malicious actor could issue tokens in the XRP Ledger by using the cold wallet, but those tokens should not be valued by anyone (unless the exchange is also a token issuer). If a malicious actor enables the Authorized Trust Lines setting for the account, that cannot be unset, although this only relates to issuing tokens and should not affect an exchange that is not also an issuer. Any other settings a malicious actor changes with a master key can be reverted. One or more hot wallets to conduct the day-to-day business of managing customers' XRP withdrawals and deposits. For example, with a hot wallet, exchanges can securely support these types of automated XRP transfers. Hot wallets need to be online to service instant withdrawal requests. For more information about the possible consequences of a compromised hot wallet, see Operational Account Compromise . Optionally, one or more warm wallets to provide an additional layer of security between the cold and hot wallets. Unlike a hot wallet, the secret key of a warm wallet does not need to be online. Additionally, you can distribute the secret keys for the warm wallet to several different people and implement multi-signing to increase security. For more information about the possible consequences of a compromised warm wallet, see Standby Account Compromise . See also: Issuing and Operational Addresses Creating Accounts Reserves Balance Sheets To custody its customers' XRP, Alpha Exchange must track each customer's XRP balance and its own holdings. To do this, Alpha Exchange must create and maintain an additional balance sheet or accounting system. The following table illustrates what this balance sheet might look like. The new XRP Ledger accounts ( Alpha Hot , Alpha Warm , Alpha Cold ) are in the User column of the XRP Balances on XRP Ledger table. The Alpha Exchange XRP Balances table represents new, additional balance sheet. Alpha Exchange’s software manages their users’ balances of XRP on this accounting system. XRP Balances on XRP Ledger Alpha Exchange XRP Balances User Balance Account # User Balance Dave 25,000 123 Alice 0 Edward 45,000 456 Bob 0 Charlie 50,000 789 Charlie 0 Alpha Hot 0 ... Alpha Warm 0 Alpha Cold 0 ... XRP Amounts Amounts of XRP are represented on the XRP Ledger as an unsigned integer count of drops , where one XRP is 1,000,000 drops. Ripple recommends that software store XRP balances as integer amounts of drops, and perform integer arithmetic on these values. However, user interfaces should present balances in units of XRP. One drop (.000001 XRP) cannot be further subdivided. Keep this in mind when calculating and displaying FX rates between XRP and other assets. For more information, see Specifying Currency Amounts . On-Ledger and Off-Ledger With exchanges like Alpha Exchange , XRP can be "on-ledger" or "off-ledger": On-Ledger XRP : XRP that can be queried through the public XRP Ledger by specifying the public address of the XRP holder. The counterparty to these balances is the XRP Ledger. For more information, see XRP . Off-Ledger XRP : XRP that is held by the accounting system of an exchange and can be queried through the exchange interface. Off-ledger XRP balances are credit-based. The counterparty is the exchange holding the XRP. Off-ledger XRP balances are traded between the participants of an exchange. To support these trades, the exchange must hold a balance of on-ledger XRP equal to the aggregate amount of off-ledger XRP that it makes available for trade. Flow of Funds The remaining sections describe how funds flow through the accounts managed by Alpha Exchange as its users begin to deposit, trade, and redeem XRP balances. To illustrate the flow of funds, this document uses the tables introduced in the "Balance Sheets" section . There are four main steps involved in an exchange's typical flow of funds: Deposit XRP into Exchange Rebalance XRP Holdings Withdraw XRP from Exchange Trade XRP on the Exchange This list does not include the prerequisites required of an exchange. At this point, Alpha Exchange has created hot, warm, and cold wallets on the XRP Ledger and added them to its balance sheet, but has not accepted any deposits from its users. XRP Balances on XRP Ledger Alpha Exchange XRP Balances User Balance Account # User Balance Dave 25,000 123 Alice 0 Edward 45,000 456 Bob 0 Charlie 50,000 789 Charlie 0 Alpha Hot 0 ... Alpha Warm 0 Alpha Cold 0 ... Deposit XRP into Exchange To track off-ledger XRP balances , exchanges need to create new balance sheets (or similar accounting systems). The following table illustrates the balance changes that take place on Alpha Exchange's new balance sheet as users begin to deposit XRP. A user named Charlie wants to deposit 50,000 XRP to Alpha Exchange. Doing this involves the following steps: Charlie submits a payment of 50,000 XRP to Alpha Exchange's cold wallet . a. Charlie adds an identifier (in this case, 789 ) to the payment to associate it with his account at Alpha Exchange. This is called a destination tag . (To use this, Alpha Exchange should have set the asfRequireDest flag on all of its accounts to require all incoming payments to have a destination tag like Charlie's. For more information, see AccountSet Flags ). The software at Alpha Exchange detects the incoming payment, and recognizes 789 as the destination tag for Charlie’s account. When it detects the incoming payment, Alpha Exchange's software updates its balance sheet to indicate that the 50,000 XRP it received is controlled by Charlie. Charlie can now use up to 50,000 XRP on the exchange. For example, he can create offers to trade XRP with BTC or any of the other currencies Alpha Exchange supports. XRP Balances on XRP Ledger Alpha Exchange XRP Balances User Balance Account # User Balance Dave 25,000 123 Alice 0 Edward 45,000 456 Bob 0 Charlie 100,000 50,000 789 Charlie 0 50,000 Alpha Hot 0 ... Alpha Warm 0 Alpha Cold 0 50,000 ... Trade XRP on the Exchange Alpha Exchange users (like Charlie) can trade credit-based balances on Alpha Exchange. Alpha Exchange should keep track of user balances on its new balance sheet as these trades are made. These trades are off-ledger and independent from the XRP Ledger, so the balance changes are not recorded on the XRP Ledger. Customers who hold XRP in their own XRP Ledger accounts can also use the distributed exchange built into the XRP Ledger to trade currencies issued by gateways. For more information about trading on the XRP Ledger, see Lifecycle of an Offer . Rebalance XRP Holdings Exchanges can adjust the balances between their hot and cold wallets at any time. Each balance adjustment consumes a transaction cost , but does not otherwise affect the aggregate balance of all the accounts. The aggregate, on-ledger balance should always exceed the total balance available for trade on the exchange. (The excess should be enough to cover the XRP Ledger's transaction costs.) The following table demonstrates a balance adjustment of 80,000 XRP (via a Payment transaction on the XRP Ledger) between Alpha Exchange's cold wallet and its hot wallet, where the cold wallet was debited and the hot wallet was credited. If the payment were reversed (debiting the hot wallet and crediting the cold wallet), the hot wallet balance would decrease. Balance adjustments like these allow an exchange to limit the risks associated with holding XRP in online hot wallets. Alpha Exchange XRP Off-Ledger Balances Alpha Exchange XRP On-Ledger Balances Account # User Balance XRP Ledger Account Balance 123 Alice 80,000 Hot 0 80,000 456 Bob 50,000 Warm 0 …. …. 789 Charlie 50,000 Cold 180,000 100,000 ... ... Withdraw XRP from Exchange Withdrawals allow an exchange's users to move XRP from the exchange's off-ledger balance sheet to an account on the XRP Ledger. In this example, Charlie withdraws 25,000 XRP from Alpha Exchange. This involves the following steps: Charlie initiates the process on Alpha Exchange’s website. He provides instructions to transfer 25,000 XRP to a specific account on the XRP Ledger (named "Charlie XRP Ledger" in the following table). In response to Charlie’s instructions, Alpha Exchange does the following: a. Debits the amount (25,000 XRP) from Charlie’s account on its off-ledger balance sheet b. Submits a payment on the XRP Ledger for the same amount (25,000 XRP), from Alpha Exchange's hot wallet to Charlie’s XRP Ledger account XRP Ledger On-Ledger XRP Balances Alpha Exchange XRP Off-Ledger Balances Alpha Exchange XRP On-Ledger Balances User Balance Account # User Balance XRP Ledger Account Balance Dave 25,000 123 Alice 80,000 Hot 80,000 55,000 Edward 45,000 456 Bob 50,000 Warm 0 …. …. …. Charlie XRP Ledger 50,000 75,000 789 Charlie 50,000 25,000 Cold 100,000 ... ... ... See Also Concepts: Accounts Direct XRP Payments Partial Payments Source and Destination Tags Tutorials: Install xrpld Send XRP Set Up Secure Signing Monitor Incoming Payments with WebSocket References: Payment transaction account_info method AccountRoot object ## /docs/tutorials/javascript/amm/trade-with-auction-slot Use the AMM Auction Slot for Lower Fees Copy This tutorial shows how to use the auction slot of an Automated Market Maker (AMM) to save the amount of fees you pay when trading against that AMM. For a simpler example of trading currencies in the XRP Ledger's DEX, see Trade in the Decentralized Exchange . Caution This tutorial does not exhaustively cover all possible market conditions and circumstances. Always exercise caution and trade at your own risk. Goals By following this tutorial, you should learn how to: Estimate the fees that would be charged by an AMM for a particular trade. Estimate the cost of winning an AMM's auction slot. Use the AMM's auction slot to pay lower fees. Prerequisites To complete this tutorial, you should: Have a basic understanding of the XRP Ledger. Have an XRP Ledger client library , such as xrpl.js , installed. Know which AMM you want to trade against: that AMM must already exist in the ledger. For purposes of this tutorial, you can use the following AMM instance that has been set up on the XRP Ledger Testnet in advance: Currency Code Issuer Notes XRP N/A Testnet XRP is functionally similar to XRP, but holds no real-world value. You can get it for free from a faucet . TST rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd A test token pegged to XRP at a rate of approximately 10 XRP per 1 TST. The issuer has existing Offers on the XRP Ledger Testnet to buy and sell these tokens. This token has no transfer fee or Tick Size set. For instructions on creating an AMM for a different currency pair, see Create an Automated Market Maker . Source Code See Code Samples: Auction Slot for the full source code for this tutorial. Steps At a high level, the steps involved in using an AMM auction slot to save money on trading are as follows: Step 1: Connect to the ledger so can query the current state. Steps 2-4: Estimate how much your desired trade would cost in AMM trading fees. Step 5: Compare against the cost to win the current auction slot. Steps 6-7: If winning the auction slot is cheaper, use AMMDeposit to acquire some LPTokens and then use AMMBid to spend those tokens on winning the auction slot. Step 8: Make the intended trade using an OfferCreate transaction. For simplicity, this tutorial assumes that you have XRP, you want to
프로젝트로 돌아가기