2 月 142019
 


HARVEY MIEI (2018/06/04)
https://developers.ripple.com/checks.html
https://developers.ripple.com/checkcreate.html
https://developers.ripple.com/checkcash.html
https://developers.ripple.com/checkcancel.html

Checks
支票
The Checks feature in the XRP Ledger allows users to create deferred payments that can be canceled or cashed by the intended recipients. Like personal paper checks, XRP Ledger Checks start with the sender of the funds creating a Check that specifies an amount and receiver. The receiver cashes the check to pull the funds from the sender’s account into the receiver’s account. No money moves until the receiver cashes the Check. Because funds are not put on hold when the Check is created, cashing a Check can fail if the sender doesn’t have enough funds when the receiver tries to cash it, just like traditional checks. If there’s a failure cashing the check, the sender can retry until the check expires.
XRP总账网络的Checks支票特性允许用户创建可以被预期接收方取消或兑现的延期付款。与纸质支票一样,XRP总账网络支票由资金发送方创建一张指定额度和接受方的支票。接受方提取支票内的资金,该资金从发送方账户进入接收方账户。在接收方兑现支票之前不会发生任何资金转移。在签发支票时,资金并不会有任何变化。与传统支票一样,发送方账户资金不足会导致接收方支票兑现失败,但在支票过期以前,接收方可以重复兑现操作。

XRP Ledger Checks have expiration times after which they may no longer be cashed. If the receiver doesn’t successfully cash the Check before it expires, the Check object remains in the XRP Ledger until someone cancels it. Anyone may cancel the Check after it expires. Only the sender and receiver can cancel the Check before it expires or is cashed. The Check object is removed from the Ledger when the sender successfully cashes the check or someone cancels it.
XRP总账网络支票在长时间未兑现后则可能会过期。如果接收方在支票过期前未成功兑现,该支票对象将保留在XRP总账网络中直到被人取消。任何人都可以在支票过期后取消支票,只有发送方和接收方可以在支票过期前或兑现前取消支票。支票对象将在接收方成功兑现或有人取消时从总账中移除。

Checks are similar to Escrow and Payment Channels, but there are some important differences between those features and Checks:
You can send issued currency with Checks. With Payment Channels and Escrow, you can only send XRP.
Checks do not tie up any funds. The XRP involved in Payment Channels and Escrow cannot be spent until it is redeemed with a claim provided by the sender (Payment Channels), or released by an expiration or crypto-condition (Escrow).
You can send XRP to yourself through Escrow. You cannot use Checks or Payment Channels to send XRP (or, in the case of Checks, issued currencies) to yourself.

支票与托管和Payment Channels付款渠道相似,但他们之间有一些重要的不同:
用户可以使用支票发送已发行货币,但支付渠道和托管只能发送XRP。
支票不捆绑任何资金。涉及支付渠道和和托管的XRP只有在发送方进行清偿或者托管到期或加密条件释放。
可以以托管方式发送XRP给自己,但不能以支票或付款渠道发送XRP给自己。

Why Checks?

为什么使用支票

Traditional paper checks allow people to transfer balances without immediately exchanging physical currency. XRP Ledger Checks allow people to exchange funds asynchronously using a process that is familiar to and accepted by the banking industry.

传统纸质支票允许用户无需立即兑换实际货币的情况下进行转账付款。XRP总账网络支票允许用户使用近似传统银行支票业务的方式异步处理资金。

XRP Ledger Checks also solve a problem that is unique to the XRP Ledger: they allow users to reject unwanted payments or accept only a portion of a payment. This is useful for institutions that need to be careful about accepting payments for compliance reasons.

XRP总账网络支票也解决了XRP总账网络的唯一问题。允许用户拒绝不想接受的付款或仅接受一部分付款。这对于因合规原因需要小心接受付款的机构很有用。

Checks potentially enable many other use cases. Ripple encourages the community to find new and creative applications for Checks.

Ripple鼓励社区为支票寻找新的和创造性的应用场景。

Use Case: Payment Authorization
案例:付款授权

Problem: To comply with regulations like BSA, KYC, AML, and CFT, financial institutions must provide documentation about the source of funds they receive. Such regulations seek to prevent the illicit transfer of funds by requiring institutions to disclose the source and destination of all payments processed by the institution. Because of the nature of the XRP Ledger, anyone could potentially send XRP (and, under the right circumstances, issued currencies) to an institution’s account on the XRP Ledger. Dealing with such unwanted payments adds significant cost and time delays to these institutions’ compliance departments, including potential fines or penalties.
为遵守像BSA,KYC,AML和CFT这样的规定 ,金融机构必须提供关于他们收到资金来源的文件。 这些法规旨在要求机构披露所有付款的来源和目的地来防止非法转移资金。 由于XRP分类账的性质,任何人都可能将XRP(并且在适当的情况下,已发行货币)发送到XRP分类账的机构账户。 处理这些不必要的支付会给这些机构的合规部门带来巨大的成本和时间延迟,还有可能的罚款或处罚。

Solution: Institutions can enable Deposit Authorization on their XRP Ledger accounts by setting the asfDepositAuth flag in an AccountSet transaction. This makes the account unable to receive Payment transactions. Accounts with Deposit Authorization enabled can only receive funds through Escrow, Payment Channels, or Checks. Checks are the most straightforward, familiar, and flexible way to transfer funds if Deposit Authorization is enabled.

解决方案:机构可以通过其XRP总账网络相关账号发起AccountSet交易并设置asfDepositAuth标志开启付款授权。此后该账号将不能接收付款交易。启用付款授权的账户只能通过托管,付款渠道或者支票接收资金。如果启用付款授权,支票将是最直接,熟悉,灵活的转账方式。

Checks typically have the lifecycle described below.

Step 1: To create a Check, the sender submits a CheckCreate transaction and specifies the receiver (Destination), expiration time (Expiration), and maximum amount that may be debited from the sender’s account (SendMax).

创建支票,发送人提交CheckCreate交易并制定接收人,过期时间,以及可从发送人账户转移的资金额度上限。

Step 2: After the CheckCreate transaction is processed, a Check object is created on the XRP Ledger. This object contains the properties of the Check as defined by the transaction that created it. The object can only be modified by the sender (by canceling it with a CheckCancel transaction) or receiver (by canceling it or cashing it) before the expiration time passes. After the expiration time, anyone may cancel the Check.

当CheckCreate交易处理后,将在XRP总账网络中创建一个Check对象,该对象包含创建交易所定义的支票属性信息。该对象只能被发送人(发起CehckCancel交易取消)或接收人(取消或兑现)在其过期前进行修改。

Step 3: To cash the check, the receiver submits a CheckCash transaction. The receiver has two options for cashing the check:

要兑现支票,接收人提交CheckCash交易,接收人有两个选项兑现支票。

Amount — The receiver can use this option to specify an exact amount to cash. This may be useful for cases where the sender has padded the check to cover possible transfer fees and the receiver can only accept the exact amount on an invoice or other contract.

Amount(额度),

DeliverMin — The receiver can use this option to specify the minimum amount they are willing to receive from the Check. If the receiver uses this option, rippled attempts to deliver as much as possible and will deliver at least this amount. The transaction fails if the amount that can be credited to the receiver is not at least this amount.

DeliverMin(最小兑现)接收方使用该选项指定其期望从支票中兑现的最小额度。如果接收方使用该选项,则最少兑现指定额度。如果发送方账户的可用额度小于该值,则兑现交易失败。

If the sender has enough funds to cover the Check and the expiration time has not passed, the funds are debited from the sender’s account and credited to the receiver’s account, and the Check object is is destroyed.

如果发送方账户有足够金额足以兑现支票,且支票未过期。资金将从发送方账户转移至接收方账户,同时Check对象将被销毁。

Expiration Case

In the case of expirations, Checks have the lifecycle described below.

All Checks start the same way, so Steps 1 and 2 are the same.

Step 3a: If the Check expires before the receiver can cash it, the Check can no longer be cashed but remains in the ledger.

当接收方在兑现支票时支票已过期,则支票不能被兑现,但仍存在于总账网络中。

Step 4a: After a Check expires, anyone may cancel it by submitting a CheckCancel transaction. That transaction removes the Check from the ledger.

支票过期后,任何人都可以通过提交CheckCancel交易取消支票,支票将在总账网络中被移除。

Availability of Checks
支票可用性
Checks require rippled v0.90.0 or later.

2 月 122019
 


https://developers.ripple.com/cross-currency-payments.html

Cross-Currency Payments
跨币种支付
In the XRP Ledger, you can send cross-currency payments that exchange one or more issued currencies, XRP, or both. Like direct XRP payments, these payments use the Payment transaction type. Cross-currency payments within the XRP Ledger are fully atomic, meaning that either the payment fully executes or no part of it executes.

在XRP总账网络中,支付发送与XRP或一种多种已发行货币的付款,与直接进行XRP付款一样,跨货币付款使用Payment交易类型。XRP总账网络中的跨货币付款完全是原子的,也就意味着支付只能完全执行成功而不可能部分执行成功。

By default, cross-currency payments deliver a fixed amount to their destination at a variable cost to their source. Cross-currency payments can also be partial payments, which deliver a variable amount to the destination within a fixed sending limit.

默认情况下,跨货币付款基于可变的交易成本并发送给目的用户的确定的固定额度。当然,跨货币付款也可以是部分付款,在固定付款限额内发送可变的付款金额。

Prerequisites

先决条件

By definition, a cross-currency payment involves at least two currencies, which means that at least one currency involved must be a non-XRP issued currency.

按照定义,跨货币交易至少包括两种货币,且至少包括一种非XRP的已发行货币。

    Typically, this means using one or more currencies issued by an XRP Ledger Gateway. Such currencies are backed by funds outside the XRP Ledger, and can be withdrawn through the gateway.

通常,用户持有的一种或多种XRP总账网络中发行的货币,该货币可以在XRP总账网络以外的网关服务商处进行提现操作。

    You could also use digital tokens that are only issued within the XRP Ledger and has no outside backing, as long as the parties transacting are willing to send or receive those tokens and treat them as something of value.

一种情况是,只要交易双方都愿意在XRP总账网络中发送和接收这些数字资产,并认可其价值(资产数字化),用户也可以不必转出至外部。

There must be at least one Path between the sender and receiver, and the total liquidity across all paths must be enough to facilitate the payment. For cross-currency payments, this usually means consuming Offers to convert from one currency to another.

在付款发送者和接收者之间必须有至少一条交易路径,且交易路径所带来的流动性应当足以促成交易。在跨货币付款中,这通常意味着消耗Offers(报价单)以实现一种货币转换为另一种货币。

Autobridging

自动桥接

Cross-currency payments that exchange two issued currencies automatically use XRP, when it decreases the cost of the payment, by connecting order books to deepen the pool of available liquidity. For example, a payment sending from USD to MXN automatically converts USD to XRP and then XRP to MXN if doing so is cheaper than converting USD to MXN directly.

跨货币支付自动使用XRP来作为两种已发行货币的中间媒介,以降低付款成本,同时使用order book增加已发行货币的流动性。举例来讲,如果使用XRP作为中间媒介转换的成本,比直接进行USD及MXN兑换更低的话,付款自USD兑换成MXN的过程就会首先将USD兑换为XRP,然后再将XRP兑换为MXN。

2 月 102019
 

https://developers.ripple.com/capacity-planning.html
https://developers.ripple.com/history-sharding.html
https://github.com/ripple/rippled/blob/master/cfg/rippled-example.cfg

Node Size参数

The node_size parameter determines the size of database caches. Larger database caches decrease disk I/O requirements at a cost of higher memory requirements. Ripple recommends you always use the largest database cache your available memory can support. See the following table for recommended settings.

配置文件中的node_size参数决定了可用数据库缓存的大小。较大数据库缓存以更多内存开销为代价来降低磁盘IO要求。Ripple建议使用尽可能高的内存配置以提供更多数据库缓存。

Recommendation
Available RAM for rippled node_size value Notes
< 8GB tiny Not recommended
8GB low
16GB medium
32GB huge Recommended for production servers

Node DB Type
节点数据库类型
The type field in the node_db section of the rippled.cfg file sets the type of key-value store that rippled uses to persist the XRP Ledger in the ledger store. You can set the value to either rocksdb or nudb.
配置文件rippled.cfg中node_db区段的type字段,指定了用于rippled总账数据存储的持久化键值存储类型。用户可以设置该值为rocksdb或nudb。

rippled offers a history sharding feature that allows you to store a randomized range of ledgers in a separate shard store. You may want to configure the shard store to use a different type of key-value store than the ledger store. For more information about how to use this feature, see History Sharding.

rippled提供的历史分片特性允许用户在一个独立的分片存储中存储随机范围内的总账数据。用户可能希望配置分片存储使用一个不同类型的键值存储来存储总账数据。更多信息,应参阅“历史分片”部分。

RocksDB vs NuDB
比较
RocksDB requires approximately one-third less disk storage than NuDB and provides a corresponding improvement in I/O latency. However, this comes at a cost of increased memory utilization as storage size grows. NuDB, on the other hand, has nearly constant performance and memory footprint regardless of storage.
RocksDB比NuDB少占用越三分之一的磁盘存储,且相应改善了I/O延迟。但是,随着存储容量的增加,内存开销也变大。相反,NuDB具有几乎恒定的性能和内存占用,而无关存储容量变化。

rippled servers that operate as validators should keep only a few days’ worth of data or less. Ripple recommends using RocksDB for validators. For all other uses, Ripple recommends using NuDB for the ledger store.
作为Validitors的rippled服务器,应仅保留几天或者更少的数据。Ripple建议Validators使用RocksDB,除此之外的场景,Ripple建议使用NuDB用于总账数据存储。

RocksDB has performance-related configuration options you can modify to achieve maximum transaction processing throughput. (NuDB does not have performance-related configuration options.) Here is an example of the recommended configuration for a rippled server using RocksDB:
RocksDB具有性能相关的配置选项,用户可以修改这些参数以达到最大交易处理吞吐量。(NuDB不具有性能相关的配置选项。)以下为有关RocksDB的一个推荐配置示例。

[node_db]

type=rocksdb
open_files=512
file_size_mb=64
file_size_mult=2
filter_bits=12
cache_mb=512
path={path_to_ledger_store}

XRP Ledger Network Data Integrity
XRP总账网络的数据完整性
The history of all ledgers is shared by servers agreeing to keep particular ranges of historical ledgers. This makes it possible for servers to confirm that they have all the data they agreed to maintain, and produce proof trees or ledger deltas. Since rippled servers that are configured with history sharding randomly select the shards that they store, the entire history of all closed ledgers is stored in a normal distribution curve, increasing the probability that the XRP Ledger Network evenly maintains the history.

Shard Store Configuration
分片存储配置
To configure your rippled to store shards of ledger history, add a shard_db section to your rippled.cfg file.
要配置rippled启用历史总账分片存储功能,需要在rppled.cfg中添加shard_db配置段。

Shard Configuration Example
分片配置示例
The following snippet from an example rippled.cfg file shows the configuration fields for adding sharding to a rippled server:

[shard_db]

type=NuDB
path=/var/lib/rippled/db/shards/nudb
max_size_gb=50

Tip:Ripple recommends using NuDB for the shard store (type=NuDB). NuDB uses fewer file handles per shard than RocksDB. RocksDB uses memory that scales with the size of data it stores, which may require excessive memory overhead.

提示:Ripple建议将NuDB用于分片存储(type=NuDB)。NuDB比RocksDB在每个分片上使用更少的文件句柄。RocksDB使用的内存随着数据存储的增长而增长,会导致更多的内存开销。

Tip:While both validator and tracking (or stock) rippled servers can be configured to use history shard stores, Ripple recommends adding history sharding only for non-validator rippled servers to reduce overhead for validators. If you run a validator and want to manage ledger history using sharding, run a separate rippled server with sharding enabled.
提示:虽然Validator和Stock Server都可以配置为开启历史分片存储,但Ripple建议仅在非Validator服务器上开启,以减轻Validator负载和开销。如果用户当前已运行Validator并希望使用分片管理历史总账数据,建议额外运行一个独立的开启分片的rippled服务器。

For more information, reference the [shard_db] example in the rippled.cfg configuration example.
更多信息,请参照rippled.cfg配置文件中的[shard_db] 区段示例。

Sizing the Shard Store
调整分片存储
Determining a suitable size for the shard store involves careful consideration. You should consider the following when deciding what size your shard store should be:

Although redundant, it is possible to hold full ledger history in the ledger store and the history shard store.
An effective configuration might limit the ledger store only to recent history.
The ledger store history size should at minimum be twice the ledgers per shard, due to the fact that the current shard may be chosen to be stored and it would be wasteful to reacquire that data.
The time to acquire, number of file handles, and memory cache usage is directly affected by sizing.
Each shard contains 2^14 ledgers (16384).
A shard occupies approximately 200 MB to 4 GB based on the age of the shard. Older shards are smaller because there was less activity in the XRP Ledger at the time.

2 月 062019
 

Tick Size
Requires the TickSize amendment.
When an Offer is placed into an order book, its exchange rate is truncated based on the TickSize values set by the issuers of the currencies involved in the Offer. When a trader offers to exchange XRP and an issued currency, the TickSize from the issuer of the currency applies. When a trader offers to exchange two issued currencies, the offer uses the smaller TickSize value (that is, the one with fewer significant digits). If neither currency has a TickSize set, the default behavior applies.
当一个报价单放入一个order book时,其汇率将按照货币发行人所设置的TickSize而截断位数(匹配精度)。当交易者在一个报价单中进行XRP和已发行货币见兑换时,适用由该货币发行人设置的TickSize设置。当交易者在一个报价单中进行两种已发行货币的兑换时,报价单使用较小TickSize的值(即具有更少位数的那个)。如果两种货币对应发行人的TickSize设置相同,则默认适用。
The TickSize value truncates the number of significant digits in the exchange rate of an offer when it gets placed in an order book. Issuers can set TickSize to an integer from 3 to 15 using an AccountSet transaction. The exchange rate is represented as significant digits and an exponent; the TickSize does not affect the exponent. This allows the XRP Ledger to represent exchange rates between assets that vary greatly in value (for example, a hyperinflated currency compared to a rare commodity). The lower the TickSize an issuer sets, the larger the increment traders must offer to be considered a higher exchange rate than the existing Offers.
在order book中的报价单,会受TickSize设置而截断交易汇率中的有效位数。发行人可以使用AccountSet交易类型设置3-15位整数长度的TickSize设置值(精度)。汇率表示为有效数字和指数,TickSize设置不影响指数。这允许XRP总账网络在两个差异化资产价值之间提供汇率(例如通涨货币和稀缺商品之间)。发行人设置的TickSize越小, 越多的交易商就会考虑比当前已存在报价单更高的汇率的报价单。

The TickSize does not affect the part of an Offer that can be executed immediately. (For that reason, OfferCreate transactions with tfImmediateOrCancel are unaffected by TickSize values.) If the Offer cannot be fully executed, the transaction processing engine calculates the exchange rate and truncates it based on TickSize. Then, the engine rounds the remaining amount of the Offer from the “less important” side to match the truncated exchange rate. For a default OfferCreate transaction (a “buy” Offer), the TakerPays amount (the amount being bought) gets rounded. If the tfSell flag is enabled (a “sell” Offer) the TakerGets amount (the amount being sold) gets rounded.
TickSize设置不会影响报价单中能够立即执行的部分。(OfferCreate交易中开启tfImmediateOrCancel标志的不受tickSize设置影响。)如果报价单不能被完整执行,交易处理引擎会计算汇率并基于TickSize设置截断位数。然后,引擎将来自“不太重要”一侧的剩余额度进行汇率截断。例如典型交易OfferCreate(买入报价),其中TakerPays额度将被舍入。如果tfSell标志启用(卖出报价),则TakerGets额度将被舍入。
When an issuer enables, disables, or changes the TickSize, Offers that were placed under the previous setting are unaffected.
发行人启用,关闭,修改TickSize设置,以按照先前设置提交的报价单不受此部分行为影响。