## FANDOM

7 Pages

This page contains detailed technical information, for those who would like to know more about how Nxt works.

## The Proof-of-Stake mechanismEdit

Proof of Stake is a proposed alternative to Proof of Work. Like proof of work, proof of stake provides a mechanism for determining who signs transactions.

With Proof of Work, the probability of mining a block depends on the work done by the miner (e.g. CPU/GPU cycles spent checking hashes). With Proof of Stake, the resource that's compared is the amount of NXTcoin a forger holds. For example, someone holding 1% of all available NXTcoin can forge 1% of the "Proof of Stake blocks".

Some argue that methods based on Proof of Work alone might lead to low network security due to Tragedy of the Commons, and Proof of Stake is one way of changing the miner's incentives in favor of higher network security.

### Motivation For Proof of StakeEdit

A proof-of-stake system can provide increased protection from a malicious attack on the network.

This additional protection comes from two sources:

1. Executing an attack would be much more expensive.
2. Reduced incentive: In order to carry out an attack, the attacker would need to own a near majority of all available Nxt coins.

When block rewards are produced through transaction fees, a proof of stake system would result in lower equilibrium transaction fees. Lower long-run fees would increase the competetiveness of Nxt relative to alternative payments systems. Intuitively reduced fees are due to vast reductions in the scale of resource wastage.

==

## The Nxt encryption algorithmEdit

The core of Nxt cryptography is based on Curve25519.

When Alice sends an encrypted plaintext to Bob, she:

1. Calculates a shared secret:
• shared_secret = Curve25519(Alice_private_key, Bob_public_key)
2. Calculates N seeds:
• seedn = SHA256(seedn-1), where seed0 = SHA256(shared_secret)
3. Calculates N keys:
• keyn = SHA256(Inv(seedn)), where Inv(X) is inversion of all bits of X
4. Encrypts the plaintext:
• ciphertext[n] = plaintext[n] XOR keyn

Upon receipt Bob decrypts the ciphertext:

1. Calculates a shared secret:
• shared_secret = Curve25519(Bob_private_key, Alice_public_key)
2. Calculates N seeds (identical to Alice step):
• seedn = SHA256(seedn-1), where seed0 = SHA256(shared_secret)
3. Calculates N keys (identical to Alice step):
• keyn = SHA256(Inv(seedn)), where Inv(X) is inversion of all bits of X
4. Decrypts the ciphertext:
• plaintext[n] = ciphertext[n] XOR keyn

Please note: If someone guesses part of the plaintext, he can decode part of the subsequent messages between Alice and Bob if they use the same key pairs, so it's advised to generate new pair of private/public keys for each communication.