create account

Background level-key allocation in WEn3 for consistent transaction signing latency in coinZdense. by pibara

View this thread on: hive.blogpeakd.comecency.com
· @pibara ·
$1.59
Background level-key allocation in WEn3 for consistent transaction signing latency in coinZdense.
In this post Iḿ going to discuss a yet only partialy resolved subject that came up with the separation of the Web 3.0 entropy into its own [WEn3](https://hive.blog/hive-169321/@pibara/progress-on-the-the-coinzdense-project-web-30-entropy-layer) layer for the [coinZdense](https://coin.z-den.se/) project.

The subject at hand has a rather big impact on the design and implementation of **coinZdense** project. 


Discussing this subject is probably easiest with a sample application RC.

```yaml
---
appname: DEMO1
hashlen: 32
otsbits: 5
heights:
- 8
- 6
- 8
- 7
```

In this sample RC, we have a four level signing key. That is, a signing key consisting of four level key:

* A level-0 key with a merkle-tree height of 8, for signing up to 256 level-1 keys.
* A level-1 key with a merkle-tree height of 6, for signing up to 64 level-2 keys.
* A level-2 key with a merkle-tree height of 8, for signing up to 256 level-3 keys.
* A level-3 key with a merkle-tree height of 7, for signing up to 128 transactions or WEn3 subkeys

The level-0 key is generated once and can't be replaced. The level-1, level-2 and level-3 keys though will need replacement when exausted and exaustion is part of normal operations.
Alocating a replacement level-key takes up CPU resources and time. This creates a rather anoying user experience that once in a while an operation that normally takes mili seconds ends up taking many seconds or even minutes.

It roughly takes the same time per *potential* signature that a level key can make, as it takes to actually make the signature, that means that for example if a single signature takes 50 mili second, and a level-3 key can sign 128 transactions, the replacement of a level-3 key will take up roughly 6.4 seconds. 

If a higher level key gets replaced, so do the lower levels, though replacement of higher level keys will be more rare, when they happen the impact on user experience will be higher.

| level | replace levels | once every N transactions | transaction equivalent | time |
| - | - | - | - | - |
| 3 | 3 | 128 | 128 | 6.4 sec |
| 2 | 2,3 | 32768 | 384 | 19.2 sec |
| 1 | 1,2,3 | 2097152  | 448 | 22.4 sec | 

A signing latency of many seconds or more isn't acceptable from a user experience perspective. We need to try and pre-calculate level keys and attempt to avoid these latencies. We will want to do this in a measured and parameterized way.

We define an allocation factor **af** where at an af of 1,0 we schedule all level keys that are going to schedule the creation of all level keys that are going to be needed within a number of transactions equal to the level-1 transaction equivalences in order of which ones are needed first.

In our example config this would be 448. We look 448 transacion into the future and see what level keys we are going to need. Those keys get scheduled for creation in paralel operations.

It might be optimal to have an **af** that is larger or smaller than 1.0, something that remains to be studied. At this point in time, figuring out the API and algoritms for allocation in WEn3 and calculation in the hash-based-signing layer is the next milestone in the coinZdense project that we need to achieve, It is something that adds nothing, functionaly, but is still an aspect of the project that is esential to the projects real world usability.

👍  , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorpibara
permlinkbackground-level-key-allocation-in-wen3-for-consistent-transaction-signing-latency-in-coinzdense
categoryhive-169321
json_metadata"{"app":"peakd/2022.07.1","format":"markdown","description":"A short discussion of what will be needed for background level-key allocation in WEn3 for consistent transaction signing latency in coinZdense.","tags":["coinzdense","postquantum","web3","development","programming"],"users":["pibara"],"image":[]}"
created2022-07-31 20:51:30
last_update2022-07-31 20:51:30
depth0
children2
last_payout2022-08-07 20:51:30
cashout_time1969-12-31 23:59:59
total_payout_value0.788 HBD
curator_payout_value0.797 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,330
author_reputation50,403,649,985,436
root_title"Background level-key allocation in WEn3 for consistent transaction signing latency in coinZdense."
beneficiaries
0.
accounthive-169321
weight200
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,319,039
net_rshares2,119,545,344,114
author_curate_reward""
vote details (22)
@hivebuzz ·
Congratulations @pibara! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@pibara/upvotes.png?202208310449"></td><td>You distributed more than 14000 upvotes.<br>Your next target is to reach 15000 upvotes.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@pibara) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out the last post from @hivebuzz:**
<table><tr><td><a href="/hive-122221/@hivebuzz/pud-202209"><img src="https://images.hive.blog/64x128/https://i.imgur.com/805FIIt.jpg"></a></td><td><a href="/hive-122221/@hivebuzz/pud-202209">Hive Power Up Day - September 1st 2022</a></td></tr></table>
properties (22)
authorhivebuzz
permlinknotify-pibara-20220831t045250
categoryhive-169321
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2022-08-31 04:52:51
last_update2022-08-31 04:52:51
depth1
children0
last_payout2022-09-07 04:52:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length924
author_reputation367,971,175,695,058
root_title"Background level-key allocation in WEn3 for consistent transaction signing latency in coinZdense."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id116,187,427
net_rshares0
@shohana1 ·
Thank you sir for your kind attention to my hive blogs,  keep supporting!  Have a nice day!
properties (22)
authorshohana1
permlinkre-pibara-202293t141343736z
categoryhive-169321
json_metadata{"tags":["hive-169321","coinzdense","postquantum","web3","development","programming"],"app":"ecency/3.0.33-mobile","format":"markdown+html"}
created2022-09-03 08:13:45
last_update2022-09-03 08:13:45
depth1
children0
last_payout2022-09-10 08:13:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length91
author_reputation75,357,217,090,889
root_title"Background level-key allocation in WEn3 for consistent transaction signing latency in coinZdense."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id116,276,209
net_rshares0