Today, on 8 July 2018 we finished work on the crypto-contract of the Redenom project. The contract is written for the virtual machine Ethereum, in the Solidity language. This ERC-20 compatible crypto-contract summarizes the business logic of the Redenom project.
Crypto-contract
The crypto-contract supports all standard ERC-20 functions and is primarily a NOM-token controller. It is fully compatible with all standard Ethereum wallets and basic functions such as transactions, and can be used directly from Mist, Ethereum Wallet and others wallets. The smart contract implements the main business logic of the Redenom project associated with the redenomination process, the distribution of the long-tailed fund of balances on the basis of the zero-sum game theory, DAO fund formation and blockchain voting for the future investment projects within the system.
Friendly design
The connections between the redenom.com website and the Redenom crypto-contract uploaded into the blockchain are a full distributed application. The website’s administrative area provides a simple interface for interacting with the contract, but all its key functions can be used directly from the Ethereum Wallet ensuring the user complete autonomy.
All tools are presented in a friendly form in the personal account of the website – https://redenom.com.
Any user who doesn’t understand:
- the structure of crypto-contracts
- the details of the blockchain system
- wallets creation
- crypto-contracts’ use and security
Can participate in the Redenom project.
Advanced users
More advanced users will be able to export their wallet or even use NOM tokens without registration on the site, by simply connecting the contract to their wallet. However, non-registered users who have not passed the KYC procedure will not be able to enter their projects in the voting for DAO funding, or to vote for projects. Such users will have to pay for the function call itself, which is responsible for paying dividends when a new round begins, while registered users will receive dividends automatically at Redinom project’s expense. In this case, the “dividend” is the sum of the accumulated long-term long-tailed decimals on the significances of the value of the previous rank values.
The crypto-contracts for the Ethereum virtual machine are coded in Solidity language, which, although Turing complete, still has serious limitations as the contract code is executed independently on each network machine and, therefore, should not perform operations that heavily load the processor. To limit the number of transactions performed by the contract code, the creators of the Ethereum network introduced the concept of “gas” that is charged for each such operation. For these reason, not only is the complex logic expensive in performance, but it also has a certain gas limit.
Limitations
One of the limitations of the Solidity language is that large amounts of data of arbitrary length, for example user balances, have to be stored in a mapping that cannot be iterated as an array, for processing each element in turn.
As part of the Redenom contract, the distribution of burned-out orders within the denomination was raised according to the amount in the next order. The usual method of mapping all users and making necessary calculations was not possible. Even if it were possible, the counting operation for a large number of participants would fail due to gas limit and, thus, could not be implemented.
Solution
For this purpose, the service array “decimals” was invented. It consists of eight numbers, each representing the sum of the numbers that are on the corresponding orders of all user balances. This array is always up to date because it is recalculated each time the user’s balance changes as a result of a transaction or a charging of funds. This consumes a little extra gas in transactions, but it facilitates easy calculation of dividends and the amount distributed in the process of redenomination.
So, at the first redenomination, when the last order is burned, the need to count the sum of all burned-down orders of all users is not necessary anymore, because it is in the finished form in the “decimals” array.