archethic-foundation / archethic-node

Official Archethic Blockchain node, written in Elixir
GNU Affero General Public License v3.0
75 stars 22 forks source link

Implement hybrid root of trust #241

Closed ghost closed 2 years ago

ghost commented 2 years ago

To avoid any scalability issue and throughput improvements, we have to implement a new scheme for node cryptography where hardware keys are use for the node transaction chain but still using software keys to support fast signing and decryption.

So a node transaction will be build with:

previous_public_key: software key
previous_signature: software key
origin_signature: hardware key if possible
transaction's content: origin public key + certificate of the origin public key

Then we should:

internet-zero commented 2 years ago

Hey team! Please add your planning poker estimate with ZenHub @apoorv-2204 @blackode @imnik11 @roychowdhuryrohit-dev @samuel-uniris

ghost commented 2 years ago

example of stress test done with benchee:

Archethic.Crypto.NodeKeystore.Origin.TPMImpl.start_link()
Archethic.Crypto.NodeKeystore.SoftwareImpl.start_link()

# Benchmarks with sequential calls for both software and hardware keys
Benchee.run(%{
  "sign with origin key" => fn data ->
    Archethic.Crypto.NodeKeystore.Origin.TPMImpl.sign_with_origin_key(data)
  end,
  "sign with software key" => fn data ->
    Archethic.Crypto.NodeKeystore.SoftwareImpl.sign_with_last_key(data)
  end
}, inputs: %{
  "with hash of 256bits" => :crypto.strong_rand_bytes(32)
})

# Benchmarks with parallel calls for both software and hardware keys
Benchee.run(%{
  "sign with origin key" => fn data ->
    Archethic.Crypto.NodeKeystore.Origin.TPMImpl.sign_with_origin_key(data)
  end,
  "sign with software key" => fn data ->
    Archethic.Crypto.NodeKeystore.SoftwareImpl.sign_with_last_key(data)
  end
}, inputs: %{
  "with hash of 256bits" => :crypto.strong_rand_bytes(32)
}, parallel: System.schedulers_online())

# Benchmarks with high parallelism for software keys
Benchee.run(%{
  "sign with software key" => fn data ->
     Archethic.Crypto.NodeKeystore.SoftwareImpl.sign_with_last_key(data)
  end
}, inputs: %{
  "with hash of 256bits" => :crypto.strong_rand_bytes(32)
}, parallel: System.schedulers_online() * 4)