While developing the Artery Blockchain, we tried to implement the model described in the Concept Unit in an optimal way in terms of timing and quality. Therefore, the final product combines ready-made solutions (Tendermint Core, Cosmos SDK), taken as a basis, and our own developments (Artery VPN, Artery Storage).
In this document, we will describe the structure of the entire Artery project, divided into functional blocks, and also briefly describe the modules we developed for the Cosmos SDK.
The key features of the blockchain are:
1. Combined consensus of Delegated Proof of Stake and Proof of Authority (more details in the blockchain ConceptUnit).
2. Support of the structure of account relationships within the blockchain (affiliate program).
3. Verification that an account was created and posted on the blockchain prior to any transaction affecting it.Thus, the impossibility of sending funds “to nowhere” is guaranteed, the structure is recorded in the MLM structure, protection from DoS attacks and spam is provided (since in most cases the operation of creating an account is a paid service).
4. Triple system of account addressing. In addition to the main addresses (using the BIP32 key structure), simplified 16-character addresses of the ARTR-XXXX-XXXX-XXXX format and a nickname system (arbitrary account names) are used.
5. Resource accounting when using Artery VPN and Artery Storage external services.
6. Voting for changing parameters (level of reward, commissions for validators, etc. For more details see 3.3.7).
The payment instrument in the system is ARTR coins, while in the blockchain they are stored and processed with an accuracy of up to 6 decimal places in the uARTR denomination (1 ARTR = 1,000,000 uARTR).
2. General Structure
The Artery network can be divided into two large blocks. On-chain block is transaction processing, storage of critical data. The second one (off-chain) is the direct processing of passing traffic from Artery VPN, data storage within Artery Storage, a table of active nodes, etc.
The on-chain block is built on the basis of the Cosmos SDK and Tendermint Core and includes both standard Cosmos SDK modules and modules developed specifically for the Artery blockchain:
Mentioned modules will be described in more detail in the following sections of this document.
Main functionality of the block includes:
● storage of information about wallets;
● storing of information about the profiles of users (linked to wallets);
● storage of a list of validators and charging them with rewards for signing blocks;
● storage of MLM structure;
● storage of information on the use of Artery VPN and Artery Storage services;
● processing of transactions (funds transfers, distribution of rewards, changing profile parameters, posting information about files in Artery Storage, changing the remains of Artery VPN traffic, etc.).
The off-chain block includes the Artery Network app, as well as Artery Storage and Artery VPN. Main functionality includes:
● providing an interface for managing accounts and profiles in the blockchain;
● management of a node, enabling and disabling block validation;
● provision of services for data transfer Artery VPN;
● management of distributed protected storage Artery Storage.
3. Artery Blockchain
The main code of the Artery Blockchain node is built on the basis of the Cosmos SDK using the Go programming language. The maximum block size is 21MB, blocks are generated every 30 seconds. The block fee depends on the transactions included in it (the fees are described in the Concept Unit, in the Blockchain section).
3.1 Wallet Addressing
As a basis, Artery Blockchain uses the built-in Cosmos SDK wallet addressing system (for more details see the link https://docs.cosmos.network/master/basics/accounts.html), based on the BIP32, BIP43 and BIP44 recommendations.
To create private and public keys and wallet addresses, a mnemonic (seed phrase) with a length of 24 words is used.
Additionally, to improve brevity and usability, the ability to translate addresses into human-friendly forms was introduced.
The first possibility is to use simplified 16-character addresses, like ARTR-XXXX-XXXX-XXXX, where X is numbers from 0 to 9. This format allows you to address 10 ^ 12 (about 1 trillion) accounts. At the time of this document creation, about 43 million Bitcoin wallets were registered.
The second possibility is the use of nicknames (short names) to determine the addresses of users. Nicknames are allowed to use Latin characters, underscore, period and numbers from 0 to 9. The minimum length of a nickname is 3 characters, the maximum is 250. Changing a nickname after creating an account is a paid service to reduce the possibility of spam transactions.
All information about the addresses translation is stored in the blockchain, which ensures the uniqueness of the used nicknames and simplified addresses and uniquely determines their correspondence. At the same time, when sending a transaction, the main wallet address is used, which is automatically located by a nickname or a simplified address.
3.2 General information about how Blockchain operates
There are two sources of changes in the internal state of the blockchain: transactions, each is created by the user and signed by his private key, and events that occur automatically in accordance with the blockchain algorithm (for example, reward charging).
The generation of each block consists of 3 stages:
● begin blocker;
● transaction processing;
● end blocker.
At the beginning of the block, the following actions are performed:
● a reward is charged for signing the previous block (the validator who offered it receives a commission from all transactions included in it);
● penalties are applied to validators who missed signing the previous block;
● reward for delegation is charged;
● (once a week) users with the Businessman status and higher are charged a percentage of the company turnover;
● scheduled tasks are performed (see 3.3.11):
— actual withdrawal of funds from delegation;
— reward for storage and VPN is charged;
— actual downgrade of status (in case of prolonged non-fulfillment of the current status conditions;
— rate payment verification and auto payment;
— summing up the results of the current voting.
After that, user transactions are processed. The commission for transfers between wallets and funds delegation goes to a special service wallet (FeeCollector), from which, after the block is released, it will be transferred to the validator. Distribution of rewards across the referral structure and recalculation of statuses occur immediately after each transaction.
At the end of the block, updates to the list of validators are applied.
3.3. Artery Blockchain Modules
In this section, we will briefly describe the Cosmos SDK modules developed for the Artery Blockchain.
It is a modified version of the standard Cosmos SDK module, responsible for transferring coins between accounts and storing information about coins.
Three possible states of coins (liquid/delegated/in the process of withdrawal from delegation) are implemented at the blockchain level in the form of three different denominations: uartr, uartrd and uartrr. Unlike the standard implementation, this module allows you to transfer only liquid (uartr) coins, prohibits transfers to non-existent wallets and charges a flat fee on all transfers.
Responsible for storing information about user profiles, namely:
● ARTR card number;
● auto payment status (on/off);
● VPN Node condition (on/off);
● Storage Node condition (on/off).
All data, except for the card number, can be changed by a transaction from the user’s side. The card number is set when creating an account. The module also allows you to create new accounts using a special transaction sent on behalf of an existing one.
Responsible for storing the following data set for each account: status, activity sign, referrer (inviter) and list of referrals (guests). Also, for optimization purposes, the module stores and maintains the following aggregated data: the number of delegated coins, the total number of coins in the structure and the number of active referrals, broken down by levels. They are used when checking an account for compliance with status criteria and in the algorithm compression.
If the account doesn’t meet the criteria of the current status, the module plans to downgrade the status after 86400 blocks (~ 1 month) and makes an appropriate note in the data block indicating the block number. If the user later restores compliance according with status criteria, the mark is removed and the status is not downgraded.
Compression — it is a process of “compression” of the structure of invited users because the user who invited them doesn’t pay a rate for 2 months. In this case, the entire structure is transferred one level up, and rewards are redistributed to higher-level accounts.
In addition, every 20160 blocks (~ 1 week) this module calculates leadership bonuses: 1% of the company turnover is divided between all accounts with the Businessman level and above, another 1% — between all accounts with the Professional level and above, and so on.
Responsible for the funds delegation and their withdrawal from the delegation, as well as the calculation and payment of reward to delegates.
At the beginning of each block, a reward is paid to those accounts which time since the last change in the stake is equal to 2880 blocks (~ 24 hours). The reward is credited to the balance of the main wallet. If a user delegates funds or withdraws them from the delegation, he immediately receives a reward for the past part of the day (proportionally), and the countdown of 2880 blocks for him starts over — this makes it easy and accurate to consider any changes in the balance of the delegation wallet.
If the user withdraws funds from the delegation, they are credited to the balance of the main wallet after 40320 blocks (~ 2 weeks). During this time, they are not considered to be delegated, and no reward is charged for them.
The module is responsible for storing the current VPN traffic limit and the current consumed traffic. Direct accounting of traffic is carried out by the off-chain part, and its recording into the blockchain is carried out by special transactions from the service account.
The module is responsible for storing the currently available and already used storage space. Direct accounting of the amount of data is carried out by the off-chain part, and its recording into the blockchain is carried out by special transactions from the service account.
The module is responsible for changing the parameters of the blockchain. The decision to change must be taken by the governing body in accordance with the following procedure:
1. Any member of the voting council makes a proposal to change the blockchain parameter. Only one vote can be taken at a time.
2. The rest of the participants must accept or reject the offer within 2160 blocks (~ 1 day).
3. Voting ends when all participants have voted, or when the allocated time has run out. The proposal is considered accepted if at least 2/3 of the council members voted “in favour”. The initiator of the vote is considered to have voted “in favour”.
The following changes can be submitted to a voting:
● rate cost;
● amount of reward for delegation;
● the size of the referral reward for the delegation of coins by an invited participant;
● the size of the referral reward for paying the tariff by an invited participant;
● cost of 1 GB VPN rate beyond of what is already included in the rate;
● cost of 1 GB of storage beyond of what is already included in the rate;
● changes in the membership of the governing council;
● changes in the list of trusted validators (i.e. accounts that have the right to validate blocks regardless of the status and volume of delegated coins);
● changes in the list of service accounts:
— an account with rights to create new accounts for free;
— an account with rights to keep track of the traffic consumed by VPN users;
— an account with rights to keep track of the amount of storage consumed by users;
— an account with rights pay reward for providing resources for Artery VPN and Artery Storage;
— an account with rights to enter the current coin rate into the blockchain;
— transition to a new version of the blockchain (updating the program code).
Thus, by changing the amount of reward for delegation, the governing council can carry out “halving” and control the issuance of coins.
Responsible for storing the current cost of the base rate, the cost of Artery VPN rate and data in Artery Storage. Stores information about the activity of the base rate, ensures the payment of the rate, updates the rates and data limits every 86400 blocks (~ 30 days).
After 86400 blocks have passed since the last payment of the rate, the module checks the autopayment mark (see 3.3.2) and, if it is set, automatically tries to pay the tariff using the funds on the user’s main wallet. In case of failure (insufficient funds), the module does not make repeated attempts, the user will have to pay by himself.
Part of these funds goes to pay validators rewards, affiliate program rewards, leadership bonuses, etc. The rest are sent to special wallets, from which rewards are then paid for providing resources for Artery VPN and Artery Storage (see 3.3.9) : ⅓ to the Artery VPN wallet and ⅔ to the Artery Storage wallet.
If the user hasn’t paid for the rate longer then 86400 blocks (~ 1 month), the addition of new referrals is blocked until the payment is made
Responsible for paying reward for providing resources to ensure the operation of Artery VPN and Artery Storage services.
Payments are made from service wallets, to which only this module has access. Each of the services has its own wallet. Wallets are replenished with each payment of the rate (see 3.3.8), as well as when the user buys additional traffic or additional storage (in this case, the entire amount minus the validator’s commission is transferred to the corresponding wallet).
The payout process is launched by the off-chain block, which considers the amount of resources provided and distributes the reward between the participants accordingly, through a special transaction from the service account. Resources are accounted for for each service separately.
The payment is made every week, while ¼ of the balance of the Artery VPN and Artery Storage wallets is transferred to the users’ wallets in proportion to their contribution. ¾ remain on the balance sheet and are distributed next time. This model makes it possible to smooth out fluctuations caused by the fact that payments for access to services come from users unevenly in time.
Responsible for updating the list of validators, enabling and disabling user validation, collecting statistics on signed and skipped blocks.
188.8.131.52. Forming and updating the list of validators
At the stage of transaction processing (for more details about the stages of block generation, see 3.2), the module accumulates updates to the list of validators and then transfers them to Tendermint Core at the end of the block.
To validate blocks, you must have the Leader status or higher and keep at least 10,000 ARTR frozen on delegation (we consider both the user’s personal funds and funds delegated by his team). If a valid validator no longer meets these requirements, it is automatically removed from the list. Also, the user can be temporarily or permanently removed from the list due to the received fines (see .3.10.3). Of course, the user can independently enable and disable validation through special transactions.
The maximum number of simultaneously voting validators for a block is limited to 100 nodes, since too many simultaneous signatures complicate consensus and can significantly slow down block output. If the number of applicants exceeds this figure, validators are selected on a competitive basis according to the following criteria (in decreasing order of importance):
1. The number of skipped blocks (see 184.108.40.206) (the less, the better).
2. Weight (see 220.127.116.11) (the more the better).
3. The number of successfully signed blocks in a row (see 18.104.22.168) (the more, the better).
22.214.171.124. Weight (voting power)
When the validators vote for a new block, those of them whose teams have delegated 100,000 ARTR or more have 15 votes each, and the rest validators have only 10. Besides consensus, this also affects how often the validator will be able to propose new blocks (and receive a reward for them) — the dependence is directly proportional, the more votes, the more often blocks can be proposed.
126.96.36.199. Statistics and fines
The validator status imposes a great responsibility on the participant: the more stable the validating nodes work, the more stable the blockchain as a whole. The following parameters are used to determine the most stable nodes:
● number of skipped blocks;
● number of blocks successfully signed in a row.
Data on which of the validators participated in signing the block and who missed it. The module at the beginning of the next block (for more details about the stages of block generation, see 3.2) is received from Tendermint Core. If a block is skipped (due to poor Internet connection, insufficient power of the validating node, its unexpected disconnection, or for any other reason), the number of skipped blocks increases by 1, and the number of successfully signed blocks in a row is reset to zero. This worsens the validator’s rating and can lead to the fact that at the end of the block it will be removed from the list and another validator will take its place (see 188.8.131.52).
If a validator misses 2 blocks in a row, a jail is imposed on it — it is immediately removed from the list of validators and cannot return there for an hour. This measure is provided so that reliable nodes that unexpectedly encounter technical problems (power outages, etc.) can solve the problem before their rating is irreversibly damaged.
If Tendermint Core detects a double signing attempt for the first time (see https://docs.tendermint.com/master/spec/consensus/signing.html#double-signing), the validator receives a warning, and the second time he is removed from the list of validators for life.
184.108.40.206. Validators’ reward
At the beginning of each block, the module transfers the entire amount accumulated on the FeeCollector service wallet (on which the commission for all transfers and other operations is added) to the balance of the main wallet of the validator that offered the previous block.
Responsible for scheduling pending tasks. It doesn’t have its own user interface and is used exclusively by other modules. With its help, any module can schedule any action for a block with a certain height in the future. All scheduled tasks are performed at the beginning of the block (see section 3.2).
3.4. Blockchain Software Update
Artery Blockchain provides the ability to update your code. For this, the Cosmos SDK upgrade module is used.(see https://docs.cosmos.network/v0.39/modules/upgrade/).
When the update is complete, its source code is posted on GitHub in the repository https://github.com/arterynetwork/artr/. Executable files for various platforms are collected from this code and uploaded to https://artery.network. Links to these files and their checksums are written into a JSON file of a special format, which is also uploaded there. After that, a vote is initiated to upgrade to this version (see 3.3.7). The change proposal includes a link to this JSON file and its checksum, as well as the block height at which this update is proposed to be made; all this information is entered into the blockchain. In case of a positive decision of the governing council, upon reaching the specified height, all nodes stop and display a message like “UPGRADE“ <version> ”NEEDED at <height>: <JSON link and checksum>” in accordance with the cosmosd Upgradeable Binary Specification (see https://github.com/regen-network/cosmosd#upgradeable-binary-specification).
To continue the work of the node, run a newer version of artrd, downloaded from the link from the specified file or compiled from sources. The Artery Node application downloads executable files, replaces them at the right time and launches a new version automatically. You can also use the Cosmos Upgrade Manager for these purposes. (see https://github.com/regen-network/cosmosd). Validators are advised to download executable files in advance in order to get back to work as soon as possible after the update and not to skip blocks.
4. Off-chain services
4.1. Artery VPN
The main purpose is to hide the source and destination of data when transmitted over public Internet networks. For this, encryption and forwarding of traffic between different network participants is used. In this case, the transmission route changes regularly. Due to the location of the project audience in different countries, tracking information is further complicated.
For Artery VPN to work, all nodes with an active service are entered into a special distributed table. Next, onion routing is used, similar to the TOR network: when establishing a connection, the sender selects a random number of intermediate nodes from this table and generates a message for each, encrypting them with a key and indicating for each node which will be next on the way. As a result, messages transmitted along the chain have a “layered” structure in which it is necessary to decrypt the outer layers in order to gain access to the original message. The established chain of nodes is used for two-way data transmission for some time, then it is rebuilt. The recipient of the request can send a response along the same chain without compromising the anonymity of each of the parties.
4.2. Artery Storage
It is a distributed file storage. The files are not stored as a whole, but as separate blocks.
Briefly, the storage operation algorithm can be described as follows:
When placing data:
1. the file breaks into pieces of different sizes;
2. for each part, several nodes are selected from the list of available ones;
3. each node receives a part of the file, supplemented with a random data set to complicate the selection of the key;
4. information about who the parts of the file are transferred to is stored in the blockchain in encrypted form;
5. each node also stores information about the stored part on its side (hash, size, retention period);
6. until the part is removed from the node, it is regularly rewarded for storage.
Upon their receipt:
1. information about stored files and their parts is obtained from the blockchain upon request;
2. information is decrypted;
3. the application communicates with random nodes that store the file and are online;
4. the parts are decrypted and assembled into a whole file.
4.3. Block Observer
The main goal at the initial stage is to provide blockchain participants with convenient access to information about current blocks, transactions and the state of wallets.
4.4. Wallet (Artery Network Application)
A mobile, desktop and web application designed to easily manage transactions within the blockchain, view the network structure, manage the user’s profile, access Artery VPN, Artery Storage and Artery Node.
Due to the fact that the information on Artery Blockchain and its API is publicly available, anyone can develop their own wallet application.