找回密码
 立即注册

新浪微博登陆

只需一步, 快速开始

查看: 1695|回复: 0

货币系统---简介

942

主题

1096

帖子

4668

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4668
nxt 发表于 2014-12-29 07:49:54 | 显示全部楼层 |阅读模式



综述
NXT货币系统的基本构件是“货币”实体(对象):货币有一个唯一的名称、代码(code),而且协议保证了唯一性。货币可以被删除,同时在某些情况下上它们的代码名称可以被重新使用。
整个货币供应量被分为货币单位。货币单位像资产一样在客户端支持十进制。发行的货币单位最大值和NXT相同,也就是说10^9 * 10^8。实际最大单位供应量是由货币发行者设定的。货币发行商是一个发行货币和支付发行费用的账户。发行者负
责设定货币特性,同时,在某些配置中能附加控制货币使用情况。类似资产余额,货币单位能在账户之间转移。


货币属性
货币实体支持许多属性。这些属性以不同方式进行混合和匹配来组成币种。之后,币种控制货币的内在运行过程。以下是可用的货币属性列表:


可兑换(EXCHANGEABLE
——
货币可以和NXT兑换。货币持有者能发布一个兑换要约(exchange offer),指定货币的买入和卖出汇率,这几乎和银行或货币兑换机构发布他们的汇率相同。每个账户在任何时候只能发布一个兑换要约。兑换要约在失效后有一个过期区块。买家和卖家可以发布兑换请求来匹配已发布的兑换要约。与资产买入/卖出(asset bid/ask order)不同,兑换请求不能保存,它们要么被立即执行(全部或部分),要么永远不能执行。兑换要约和买入/卖出兑换请求相匹配创建了一个交易实体,它代表着对NXT余额相应的货币单位转移,并进行相关账户的余额更新。发布一个offer会立刻减少NXT和发布offer的账户的余额,直至过期。Offer还指定可能比提供的单位数量要大的兑换单位数量的上限。当一个买入兑换请求和一个offer相匹配时,只要没有达到上限,提供给卖出的单位数量就会减少,提供给买入的单位数量就会增加。一旦达到offer的兑换上限,这个offer就不能使用了。


可控制(CONTROLLABLE
——
需要通过一个外部实体的适合于货币的货币特性。它表明以下关于货币的限制:(1)只有发行账户能转入或转出货币。(2)只有发行账户能发布兑换要约。发行者账户可以提前发布大量(实际上是无限的)货币单位,之后,向账户中转移单位或交换单位,以此反映发生在外部系统中的实际交易。发行者账户中的大量单位可以用来模拟创建突然出现的货币单位造成的影响,从而支持创建新单位和支付利息等特征。


可预设(RESERVABLE
——
货币单位不是立即发行的。相反,货币单位设置了将要发行货币的区块高度及发行每单元货币所需要的NXT的限度。之后,货币“创始人”花费NXT预定货币股份。如果发行每单位货币所需要的NXT数量在达到区块高度前没有预定,那么取消发行,资金返回并减去费用。如果达成预设条件,执行发行,并且根据投资NXT的股份比例在创始人和投资人之间分发货币单位。至于零头会发送给发行者账户。文末可见关于可预定货币的用户方案的讨论。


可索回(CLAIMABLE
——
当预设货币时,可预订货币的货币单位之后会被取回,每单元价格达到相同的NXT。以特定价格认领一个货币的能力表明在某些用户想要兑换的价格上有实际限制。但如果只是出于兑换全部供应货币的目的,可预订货币还是可以兑换的,以便于删除该货币。


可挖矿(MINTABLE
——
和比特币几乎相同,可以使用工作证明(PoW)来挖矿。与比特币挖矿不同,货币挖矿不确保网络安全(这个NXT做到了)。挖矿是唯一途径–用来创建新的货币单位以及作为在货币发行后增加可用的单位数量。


不可混淆(NON_SHUFFLEABLE
——
此特性说明该货币未来不参与混淆(coin shuffling)。默认情况下,货币允许参与混淆(shuffling)。 (译者注:

CoinShuffle 是一种混合多账户货币来增加比特币匿名性的技术,防止比特币公开账本里的交易可被追踪。论文发表于http://crypsys.mmci.uni-saarland.de/projects/CoinShuffle/coinshuffle.pdf

CoinShuffle 算法简图

—— 以上这些属性组合成指定为“货币类型”的整数位掩码。


货币兑换
对于可兑换的货币来说,每个货币持有者的账户可以发布一个兑换要约,指定买入或卖出兑NXT的汇率以及她想要兑换的货币单位数量(不能超过她可用的货币单位和NXT余额)。用户可以看见所有货币兑换要约(在直观上和许可的交易所一样),努力和买入或卖出兑换请求相匹配。一个兑换要约有一个过期高度,同时给可兑换的单位总数量设置上限。当从兑换要约中买入货币单位,卖出的单位数量自动增加,反之亦然。发布者还限制特定兑换要约的货币单位交易总数量。


删除货币
因为可用的货币代码限制至3、4、5个大写字母,货币代码全部可用数量限制在26^3 + 26^4 + 26^5 – 1 = 12355927唯一值(“NXT”代码已被保留),这其中某些代码很可能自己有价值。因此,在特定情况下根据币种删除货币是有可能的。用户可能会用同样的代码、不同的特性来重新发布货币,或者删除货币并发布新货币。为了删除或再发行货币,一个账户必须造出所有货币单位(和基于币种的附加条件应用)。


创建新货币单位
发行货币后创建新货币单位的唯一方式是使用挖矿的工作证明(proof of work minting)。其他创建单位的方法容易受到DoS攻击/或马甲(sock puppets)的影响,因此不被允许。可控制的币种为创建新单位提供部分解决方案,允许货币发行者账户把她的供应作为库存并且只把这个账户之外的单位作为全部货币供应量。这个方法要求用户相信货币发行者能在任何时刻增加货币供应量。


铸币(挖矿)
用户可以发布铸造附加货币单位的铸币请求。每个铸币请求会触发基于提交上去的数据和货币哈希算法的哈希计算。产生的哈希值和 由现有货币难度衍生出的目标值 进行比较。最小、最大货币难度值和铸币算法是指定好的,发行后就不能再更改。铸造第一个单元的预期哈希计算(也就是难度)的数量是2^minDifficulty,而铸造最后一个单元的难度是2^maxDifficulty。难度值 随着 现有单位数量和总供应量之间的比率,从最小到最大线性增长。随着每个货币单位请求铸造的单位数量增加,难度值线性增长,小型铸造者每个请求只能铸造少量单位,而大型铸造者每个请求能铸造非常多的单位。每个铸造请求的单位数量限制在总单位供应量的1/10000。铸币限制在单一铸币交易每区块/账户/货币。货币发行者可以指定最初的单位供应量作为分配给发行者账户的“预铸币”供应量,之后利用货币的可预定性和可兑换性进行众筹。一旦货币被激活,现有供应量(保留供应量)和总供应量之间的差值 就可以被挖矿。NRS提供一个Java基础的参考实例铸币机。实际上,我们期望用户扩大这个铸币机,通过使用Asic或GPU计算出哈希代码,努力达到现有目标。一旦解决一个散列,就能提交一个铸币交易(因而支付费用)。
如果哈希代码确实比目标值小,那么货币单位会分给发送者账户。
点击阅读 铸币参考实例文件


价值储存
可预定性和可索回性的特质的结合可通过冻结NXT给货币分配最初值。一旦货币被激活,被预定的NXT将被冻结(locked,锁定),唯一解冻的方法是通过返回对应的NXT,索回相应的货币单位。这为货币提供了基于冻结NXT余额的价值。
注:冻结的NXT不参与锻造(译者:锻造是NXT的区块增长、同步机制),因此,理论上冻结大量NXT作为价值储存货币是有可能的,但会促使用于确保网络安全的NXT数量减少,我们意识到了这个问题并且将密切监视它。我们不希望这个问题成为今后任何时候的主要问题。


众筹
可预定性和可兑换性的特性的组合能够用于众筹,在这种配置下,被创始人预定的NXT余额不会被冻结。相反,一旦货币被激活,它将被发送至货币发行者账户。发行者可以把这些NXT用作运营,同时,创始人不能要回他们的货币单位,只能在发行兑换要约的基础上进行交易。货币发行者能指定最初供应量作为“预铸币”,而且创始人能得到股份,依据预定供应量(也称“预热”供应量)和最初供应量有所不同。


价格
货币发行费用是基于货币代码长度。
3个字母 – 25000 NXT
4个字母 – 1000 NXT
5个字母 – 40 NXT
不考虑货币代码长度,以不同特性重新发行现有货币需花费40NXT。其它所有货币交易(截至今天)需花费1NXT。
API Documentation
(下面都是API函数名列表,故不翻译)
This section is relevant to API and client developers.
### Transaction APIs ###
(略)
### Query APIs ###
(略)

单位转换
货币是用单位测量的,并且像资产一样有小数点。然而,区块链保持货币余额为整数(QNT)。因此,举例来说,某种情况下,货币有2个小数点,客户预定123.45单位。这个单位值提交在API中应为12345。使用NXT余额的API通常应发送以NQT为测量单位的值。
例如:对于一个有两个小数点位置的货币,当提交一个价格为5.6的12.34单位的买入交易请求时,提交给货币购买交易的数值应为:units=1234。也就是说没有小数点或12.34 * 10^2 NQT价格 = 5600000。价格转换给NQT然后被小数点分割或5.6 * 10^8 / 10^2。
为了防止向服务器提交信息时的整数错误,用户界面(UI)强制执行以下规则:货币是否有D十进制位。单位值不能超过1个D十进制位,价格值不能超过8个十进制位。因此,当发行货币时,我们不推荐指定多于4个十进制数字,以防汇率也被分为至少4个十进制数字。

限制条件
此次版本中不支持以下功能(未来可能会支持):
当对比NXT分叉时,买入资产的货币和用支付交易费用的货币单位替代考虑到投入货币的工作量的NXT两者之间的交易。

免责声明
  • 发行货币前,我们推荐在测试网络上发布具有相同特质和参数的货币,因为除了删除货币这些设置是不能改变的。
  • 此文件显示的是截至今日的实际代码。


转自比特头条

英文:
Overview

The "Currency" entity is the basic building block of the NXT Monetary System, currency has a unique name and code and uniqueness is guaranteed by the protocol, currencies can be deleted and their code can be reused under certain conditions.

The total currency supply is divisible into currency units. Like assets, currency units supports decimal positions implemented as a client side feature. The maximum number of currency units which can be issued per currency is similar to NXT i.e. 10^9 * 10^8. The actual maximum units supply is set by the currency issuer. The currency issuer is the account which issues the currency and pays the issuance fee. The issuer is responsible for setting the currency properties and in some configurations has additional control over the currency usage. Like asset balance, currency units can be transferred between accounts.

Currency Properties

The currency entity supports several properties. Properties can be mixed and matched in various ways to compose the currency type. The currency type then controls the inner workings of the currency. The list of available currency properties is as follows:

EXCHANGEABLE - the currency can be exchanged with NXT. Holders of the currency can publish an exchange offer specifying the buy and sell rate of the currency much the same as banks or currency exchanges publish their exchange rates . Each account can publish only a single exchange offer at any given time. Exchange offers has an expiry block after which they are no longer in effect. Buyers and sellers can issue exchange requests to match published exchange offers. Unlike asset bid/ask orders, exchange requests are not saved, they are either executed immediately (fully or partially) or not executed at all. A match of exchange offer with a buy or sell exchange request creates an exchange entity which represents the transfer of currency units in return to NXT balance and causes the relevant account balances to update. Issuing an exchange offer reduces the NXT and currency balance of the offering account temporarily until the offer expires. Exchange offers also specifies a limit on the number of exchanged units which can be larger than the number of units offered. When a buy exchange request matches an exchange offer the number of units offered for sell is reduced and the number of units offered for buy is increased as long as the limit has not been reached. Once the exchange limit of an exchange offer has been reached, This exchange offer can no longer be used.

CONTROLLABLE - currency property suitable for currencies which need to track an external entity. It imposes the following limitations on the currency (1) Currency can be transferred only to/from the issuer account (2) only the issuer account can publish exchange offers. The issuer account can issue a large (practically infinite) supply of units in advance, then transfer units to accounts, or offer to exchange units, to reflect actual transactions which take place in an external system. The large supply of units in the issuer account can be used to mimic the effect of creating units out of nowhere to support features such as creating new units and interest payments.

RESERVABLE - currency units are not issued immediately. Instead the currency issuer sets a block height by which the currency is to be issued and a limit of NXT per unit needed in order to issue the currency. Currency "founders" then spend their NXT to reserve their currency stake. If the amount of NXT per unit needed in order to issue the currency is not reserved before reaching the block height the issuance is cancelled and funds are returned minus fees. If the required reserve is allocated, the currency is issued and units are split between founders according to their proportional stake of invested NXT. In case of rounding, leftovers are sent to the issuer account. See below discussion of usage scenarios for Reservable currency.

CLAIMABLE - currency units of resereable currency can later be claimed at the same NXT per unit rate reached when reserving the currency. The ability to claim a currency at a certain rate imposes some practical limits on the rates in which users would want to exchange it. However claimable currency can also be exchanged if only for the purpose of exchanging the whole currency supply, so that the currency can be deleted.

MINTABLE - currency can be minted using proof of work algorithms much the same as Bitcoin. Unlike Bitcoin mining, minting currency does not secure the network (this is done by NXT). Minting is used solely for creating new currency units and serve as the only mechanism to increase the number of available units after the currency issuance.

NON_SHUFFLEABLE - this property indicates that in the future this currency cannot participate in coin shuffling. By default currencies are allowed to participate in shuffling.

Properties are combined into an Integer bit mask designated as the Currency type.

Currency Exchange

For exchangeable currency, each currency holder account, can publish a single exchange offer specifying the buy rate and sell rate vs NXT and the number of units she is willing to exchange (which cannot exceed her available currency units and NXT balance). Users can observe all currency exchange offers (intuitively similar to fiat exchange offices) and try to match them with buy/sell exchange requests. An exchange offer has an expiration height, as well as a limit on the total number of units which can be exchanged. When units are bought from an exchange offer the number of units to sell increases automatically and vise versa. The publisher can also limit the total transaction volume of currency units traded for a specific exchange offer.

Deleting a Currency

Since the available currency codes are limited to 3, 4 or 5 uppercase letters, the total number of codes is limited to 26^3 + 26^4 + 26^5 - 1 = 12355927 unique values (The code "NXT" is reserved), it is likely that some of these codes will have value by themselves. Therefore deleting a currency is possible under certain conditions depending on the currency type. Users may re-issue a currency, or delete a currency and then issue a new currency, with the same code but with different properties. In order to delete or re-issue a currency an account must poses all the currency units (and additional conditions apply based on the currency type)

Creating new Currency Units

The only way to create new currency units after issuing a currency is using proof of work minting. Other methods of creating units are susceptible to denial of service attacks and/or sock puppets and are therefore not allowed. The controlable currency type provides a partial solution for creating new units, by allowing the currency issuer account to treat her supply as a treasury and only consider units outside of this account as the total currency supply. This approach requires users to trust the currency issuer which can increase the currency supply at any time.

Minting

Users can issue minting requests in order to mint additional currency units. Each minting request triggers a hash calculation based on the submitted data and the currency hash algorithm. The resulting hash code is compared to the target value derived from the current currency difficulty. Minimal and maximal currency difficulty values and minting algorithm are specified when issuing the currency and cannot be changed later. The expected number of hash calculations (i.e. difficulty) of minting the first unit is 2^minDifficulty while the difficulty of minting the last unit is 2^maxDifficulty. Difficulty increases linearly from min to max based on the ratio between the current number of units and the total supply. Difficulty increases linearly with the number of units minted per CurrencyMint request, small minters can mint only a few units per request while large minters can mint large number of units per request. The number of units per minting request is limited to 1/10000 of the total unit supply. Minting is limited to a single minting transaction per block/account/currency. Currency issuers can specify initial supply of units as a "pre-mint" supply assigned to the issuer account then use crowd funding by making the currency RESERVABLE and EXCHANGEABLE. Once the currency becomes active the delta between the current supply (reserved supply) and total supply can be minted. The NRS provides a Java based, reference implementation mInter, which can be used for minting. In practice we expect users to enhance this minter to calculate hash codes using their Asics or GPUs, trying to match the current target, and once solving a hash, submit a currency mint transaction (thus paying a fee).
If indeed the hash code is smaller than the target the currency units are credited to the sender account.

See documentation of the reference implementation "Mint Worker" utility here #207

Store of Value

The combination of RESERVABLE and CLAIMABLE properties can be used to allocate initial value for a currency by locking NXT. Once the currency is activated the reserved NXT are locked and the only way to release them is to claim back the currency units in return to NXT. This provides the currency a value based on the locked NXT balance. Note: locked NXT do not participate in forging, therefore, in theory its possible that large amount of NXT becomes locked as currency store of value thus reducing the amount of NXT used for securing the network, we are aware of this problem and we'll monitor it closely. We do not expect this to become a major problem any time soon.

Crowd Funding

The combination of RESERVABLE and EXCHANGEABLE properties can be used for crowd funding, in this configuration the NXT balance reserved by founders, is not locked, instead it is sent to the currency issuer account once the currency becomes active. The issuer can use these NXT for its operations and the founders cannot claim back their currency units, only exchange it based on the published exchange offers. Currency issuers can specify the initial supply as "pre mine" and founders get share the difference between the reserve supply (also named "pre-activation" supply) and the initial supply.

Fees

Currency issuance fee is based on the length of the currency code.

3 Letters - 25000 NXT

4 Letters - 1000 NXT

5 Letters - 40 NXT

Re-issuing an existing currency with different properties costs 40 NXT regardless of the number of the currency code length. All other currency transactions (as of today) has a fee of 1 NXT.

API Documentation

This section is relevant to API and client developers.

### Transaction APIs ###

issueCurrency

issue a new currency or re-issue an existing currency with different properties. The currency unique id is the transaction id of the issueCurrency request.

currencyReserveIncrease

reserve NXT to become a founder

currencyReserveClaim

claim currency units back to NXT based on the currentReservePerUnitNQT rate

publishExchangeOffer

publish an offer for currency exchange by specifying the buy and sell rates you are willing to pay

currencyBuy

buy currency units for NXT by matching one or more exchange offers for selling currency for NXT

currencySell

sell currency units for NXT by matching one or more exchange offers for buying currency for NXT

currencyMint

issue a request to mint additional currency units

transferCurrency

transfer currency units between accounts

deleteCurrency

delete a currency

### Query APIs ###

getAccountCurrencies

getAccountCurrencyCount

getAllCurrencies

getCurrency

getCurrencies

getCurrencyFounders

getCurrencyIds

getCurrenciesByIssuer

getCurrencyAccounts

getCurrencyAccountCount

getExchanges

getExchangesByExchangeRequest

getAllExchanges

getCurrencyTransfers

getBuyOffers

getSellOffers

getOffer

getAccountExchangeRequests

getMintingTarget

transferCurrency

deleteCurrency

searchCurrencies

Unit conversion

Currency is measured in units and like assets has decimal positions, however the blockchain maintains currency balances as a whole number (QNT). Therefore, for example, in case a currency has 2 decimal positions and the client has reserved 123.45 units. The "units" value submitted in the API call should be 12345. APIs using NXT balances should send the value measured in NQT as usual. When specifying "rate" in the API calculates the ratio between NXT balance in NQT and currency balance in QNT.

Example: For a currency with 2 decimal positions. When submitting a buy exchange request for 12.34 units at a rate of 5.6 [NXT/Unit] the values submitted to the currencyBuy transaction should be: units = 1234 i.e. units without decimal position or 12.34 * 10^2 rateNQT = 5600000 i.e. rate converted to NQT then divided by decimal position or 5.6 * 10^8 / 10^2

In order to prevent rounding problems when submitting information to the server, the UI enforces the following rule: If a currency has D decimal positions. Unit values cannot have more than D decimal positions and rate values cannot have more than (8-D) decimal positions. Therefore when issuing a currency, we do not recommend specifying more than 4 decimal digits so that conversion rates are also divisible to at least 4 decimal digits.

Limitations

The following functions are not supported in this release but may become supported in the future: Direct exchange between currencies Buying assets and aliases using currency units Paying transactions fees as currency units instead of NXT Considering the proof of work invested in currencies when comparing an NXT fork

Disclaimer
  • Before issuing a currency we recommend issuing a currency with the same properties on the testnet and experimenting with all parameters since these cannot be changed without deleting the currency.
  • This documentation reflects the actual code implemented as of this date.


原文:bitbucket

Total number of coins in Nxt is exactly 0.
In the very beginning,BCNext created coins and anti-coins out of the void just like vacuum creates particles and anti-particles.
In the very end,all coins will come back to genesis account and annihilate with their opposites...

NxtChina.org | 微博 | 关于我们
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

快速回复 返回顶部 返回列表