Stakenet (XSN) Blockchain Architecture Part 2

Hydranet Team
Stakenet
Published in
7 min readJun 18, 2018

This article is the second part of the XSN blockchain architecture. It’s focused on the benefits of SegWit activation.

For the first part of the XSN blockchain architecture: click here. The first article is focused on the stakenet blockchain metrics.

1.3 Benefits of a Bitcoin.core blockchain architecture

Since XSN is based on Bitcoin.core, all the achievements of Bitcoin development, like SegWit and Lightning Network, can be integrated in the Stakenet blockchain architecture without much effort.

1.3.1 SegWit

Segregated Witness, so called SegWit, is the name used for an implemented soft fork change in the transaction format of the Bitcoin.core blockchain architecture, to include a variety of functions. The following paragraphs will summarize the benefits of all these functions for Stakenet ecosystem. It should be noticed that SegWit is much more than just a solution for the scaling problem — it is the smallest common denominator for any cross chain communication. This summary is based on BIP 140, 141, 143 and the current Bitcoin.core.

1.3.1.2 Linear scaling of sighash operations

In some transactions the signature hashing tends to scale more quadratically than linearly, depending on how these are structured. By just doubling the block size of a transactions, you would consequently double the amount of data that needs to be hashed for the verification — which may cause an extremely longer validation time within the block generation process. Segwit solves this problem by adjusting the calculation of the transaction hash for signatures, by removing the quadratic scaling of hashed data for verifying signatures. Due to this change each byte of a transaction wouldn’t need to be hashed more than two times — so the same functionality is achieved more efficiently.

Benefit: By removing the quadratic scaling of hashed data for the verification signatures, also large transactions can be generated in the Stakenet’s meta network without facing the previous difficulties with the signature hashing, even if those transactions are large or generated maliciously.

1.3.1.2 Signing input values

Before SegWit update, a hardware wallet needed a full node copy of all input transactions to verify the total amount being spent and sign the transaction. Thus, it was also necessary to hash all those data to ensure no false data were fed, so executing withdrawals from a hardware device was not particularly cheap. SegWit solves this problem by only hashing the input value explicitly which makes it easier and safer for a wallet to sign the spending transaction, no matter how large or complicated it is.

Benefit: Hardware wallet users need to pay less transaction fees for executing secure and fast withdrawals.

1.3.1.3 Increased security for multi-signature wallets

Without SegWit, multi-sig payments were protected with a pay-to-script-hash (P2SH), which is secured by the 160bit hash (HASH160) algorithm. However, this encryption can be violated by a well-resourced attacker, who tries to find a collision. SegWit prevents this fraudulent act by using HASH160 only for payments, directly to one single public key, while using an improved 256bit hash for the P2SH.

Benefit: This feature of the SegWit implementation will ensure extra security for everyone paying to a multi-sig address or smart contract within the Stakenet network or the cross chain ecosystem.

1.3.1.4 Script versioning

Every change to the Bitcoin.core script was developed to ensure improved security and functionality. However, the script design only enables backwards-compatible changes, caused by soft-forking, to be implemented by replacing one of the ten extra OP_NOP opcodes with a new one. This procedure is sufficient for most changes — but it is slightly hacky (for example, OP_CLTV usually needs to be accompanied by an OP_DROP) and cannot be used to enable such simple features as joining two strings. Therefore, SegWit implements version number for scripts to enable even opcodes that would have required a hard-fork to be used in non-SegWit transactions, just by increasing the script version.

Benefit: Making changes to script opcodes easier, will cause an advanced scripting in all Bitcoin.core based blockchain architectures — so supporting sidechains or creating even smarter contracts by using Merklized Abstract Syntax Trees (MAST) can be achieved much easier by Stakenet.

1.3.1.5 Reducing UTXO growth

The unspent transaction output (UTXO) database is maintained by each fullnode of a blockchain to review whether a new transaction is valid or fraudulent. To ensure a fast and efficient network, this database needs query and modify very quickly. This challenge becomes even harder, as more users are using the blockchain, because every new user needs to have at least one individual UTXO entry. SegWit improves the situation by adjusting the signature data that way, that the UTXO group size is reduced by at least 75%.

Benefit: By reducing the UTXO size, the maintenance and the query of the UTXO database are reduced, which will counteract future limitations or performance problems and improves the current situation for everyone who runs a fullnode within the Stakenet ecosystem.

1.3.1.6 Efficiency gains when not verifying signatures

By default, Bitcoin.core based blockchains do not check signatures regarding transactions prior to the most recent checkpoint. Furthermore, even some SPV clients don’t check signatures themselves at all, because they trust the validation by other nodes. However, the signature data is a big proportion of the entire transaction. With SegWit, nodes that are not interested in signature data, can skip those data and avoid downloading them.

Benefit: Since more transactions are proceeded using SegWit addresses, everyone who is running a pruned or SPV node in the Stakenet network, needs less bandwidth and disk space for operations.

1.3.2 Lightning Network

One of the main objectives of introducing cryptocurrencies was to make payments faster and cheaper. However, as mining operations started to become expensive, Bitcoin transaction fees also started raising. A version of the technology that is meant to make cryptocurrency payments faster and cheaper, called Lightning Network, is a second layer solution to enable off-chain transactions on Bitcoin.core based blockchains and is expected to be a game changer in the evolution of the cryptocurrencies. By solving the transaction malleability problem, SegWit eliminates a major barrier to implement a second layer solution, like Lightning Network, on top of a blockchain. Once it is deployed across all nodes, the network will speed up transaction processing and decrease their associated costs. The Lightning Network allows Bitcoin.core based blockchains to open payment channels directly between two nodes. The parties can then conduct transactions without having to broadcast them to the blockchain, avoiding delays and costs that result from recording those transactions each time. Once the channel is closed, only the final balances are recorded on the blockchain, not the full transaction history of the channel. There is no required time or transaction limit to close a payment channel, so they can potentially remain open for even years.

The major problem is how the side chains within the Lightning Network work. They move the coins to a second-layer system, to not rely on the highly congested blockchain. In previous solutions, all transactions were processed by a trusted third party, without having to broadcast them across the entire network, which saves a lot of resources and time. Stakenet solves this problem, by processing and managing these transactions by a trustless and decentralized masternode network, called watchtowers which provide lightning channels for the Stakenet ecosystem. As we expect to reach ~2000 online masternodes, this will give our network a robust backbone to provide instant private transactions and liquidity on our Lightning Network.

1.3.2.1 Transactions for the future

The advantages of using the Lightning Network to cross-communicate among all blockchains within the Stakenet meta network can be summarized by the following criteria:

Instant payments: Lightning instant payments across the entire blockchain without any limitations caused by the block confirmation times. Due to smart contracts, the security of the transactions is ensured without any need to on-chain transactions, so payment speed of milliseconds to seconds can be achieved.

Scalability: Makes it possible to process millions to billions of transactions per second across the network. This capability outperforms all previous legacy payment rails and a payment per action/click is now possible without custodians or third-party services.

Low cost: Using an off-chain transaction setting, causes exceptionally low fees in the Lightning Network. This enables completely new use cases such as instant micropayments.

Cross-blockchain: Cross-blockchain transactions will be possible, if both chains are connected to a compatible second layer protocol or are supporting the same cryptographic hash function on their own, that would be possible to execute trustless transactions between different blockchains.

1.3.2.2 Powered by blockchain smart contracts

Lightning is a decentralized network among several nodes, which use smart contract functionality in the blockchain to enable instant payments among all participants.

How it works? Using their native smart-contract scripting languages to create a secure network and increasing the network capacity by moving the transactions off chain for quick processing.

Bidirectional payment channels: First, two individuals open a ledger entry on the blockchain which requires both participants for further actions. Then, both parties need to create transactions which refund the ledger entry to their individual allocated space, without broadcasting this to the blockchain. This entry can be closed by each party at any time and completely trustless by just broadcasting the most recent version to the blockchain. If they’ve updated their individual allocations, only the most recent version is valid, which is ensured by a smart contract.

Blockchain as arbiter: Since the blockchain itself is acting as an arbiter, it is even possible to conduct transactions using off-chain solutions, as secure as an on-chain transaction. It’s just like making a legal contract with someone else, without any notary, and the smart contract ensures that no one can cheat.

Disclaimer: As with any crypto-currency, there is an inherent risk, while XSN Core team endeavors to implement to the best of their abilities, they make no representations to the future value of the XSN coin and individuals purchase it at their own risk.

--

--