Transparent Forging

From Nxtwiki
Jump to: navigation, search

Description

"Transparent Forging" allow each user's client to automatically determine who will generate the next block, so that they can then send their transactions to that node. This will also allow additional fees to be realized for immediate/priority transactions.

An equally important feature of Transparent Forging is an outstanding security feature of the protocol to temporarily reduce to zero the forging power of accounts who should generate the next block but don't. This transparent forging feature will prevent against even a 90% majority owner of all NXT branching out and forcing a fork. So if an account has 90% of all Nxt and doesn't generate a block when scheduled, the system will reduce its mining power to zero temporarily to prevent a bad fork from being forced.

Read Come-from-Beyond's description of Transparent Forging on the Bitcointalk.org forum.

Implementing transparent forging in a client, using the Nxt API

(source: Come-from-Beyond)

  1. Do http://localhost:7876/nxt?requestType=getState to get value of "lastBlock"
  2. Do http://localhost:7876/nxt?requestType=getBlock&block=10621696942372068326 (assuming 10621696942372068326 is the value of "lastBlock")
  3. Convert "generationSignature" into binary, and append the public key bytes returned by getAccountPublicKey
  4. Calculate SHA256 (generationSignature, publicKey)
  5. The first 8 bytes of this value, as an unsigned long in little-endian notation, is the "HIT" value
  6. The value of "baseTarget", multiplied by the effective balance of the account, is STATIC_TARGET
  7. Repeat steps 3-6 for each active account, and find the one with lowest HIT/STATIC_TARGET ratio. This account will forge the next block

Release Date

The first foundational elements of this feature were implemented beginning with block 30,000, in client version 0.4.8. As of now, Transparent Forging is not completely implemented.