This copy is an interesting dev's slack conversation on bundles, transactions, hashing of PoW and signature in IOTA. It can help us to know more about the IOTA data structure.
Dominic Wörner:
Could someone provide me with structure of a tx? What fields are there? Can I see a JSON strucutre of a full tx?
and with some explanations. Don’t know what Tag, Bundle, Trunk, Branch, and Essence mean :slightly_smiling_face:
Dominik Schiener:
GitHub
iotaledger/wiki
wiki - IOTA Wiki of most relevant and important topics
Dominic Wörner:
Thx
Dominik Schiener:
trunk / brunch = two tips that you reference
Dominic Wörner:
public final long value; // <0 spending transaction, >=0 deposit transaction / message
I thought it was like UTXO ?
Dominik Schiener:
@come-from-beyond always says "it's 60% account-based, 40% UTXO"
Dominic Wörner:
is trytes to bytes length justs *2/3 or more complicated?
Dominik Schiener:
more complicated
2187 trytes is roughly 1312 bytes.
2187 trytes is 1 chunk of a signature (i.e. signatureMessageFragment
)
Dominic Wörner:
Is there a post somewhere really explaining the bundles?
Come-from-Beyond:
8 bits store 5 trits
Dominic Wörner:
ah, cool thx
and 8 trits = 1 tryte or different again?
Come-from-Beyond:
https://iota.readme.io/docs maybe (edited)
1 tryte = 3 trits (edited)
bundle = chain of txs which reference each other via "trunkTransaction"
there is a tail with "currentIndex" = 0
bundle is atomic
we go along the chain of trunkTxs while incrementing currentIndex is not equal to "lastIndex"
this is basics of bundles
Dominic Wörner:
I’m still a bit confused. Does trunk mean the transaction which output you want to spend?
Come-from-Beyond:
no
a typical payment with 256-bit security looks like this:
tx #0 // spending from Alice address // value = -100
tx #1 // complementary spending from Alice address (because each increase of +128 bits security adds an extra complementary tx) // value = 0
tx #2 // depositing to Bob address // value = +70
tx #3 // depositing to Alice change address // value = +30
this is a complete bundle
it's atomic because all or none txs will be approved by others
Dominic Wörner:
and the bundle can be arbitrary large?
Come-from-Beyond:
virtually yes, it's limited to roughly 2 trillion elements (edited)
3^27
it's 7.6 trillion
not 2
whole country can spend their state budget with M-of-N multisig
Dominic Wörner:
but how do I include the signatures for each spending?
Come-from-Beyond:
first you construct "raw" bundle
then you calculate bundle hash
then you sign that hash
and copy signatures into corresponding txs with correct offset
Dominic Wörner:
Ok, but what’s the signature field then in the main transaction for (structure that references the bundle) ?
Come-from-Beyond:
it stores signatures if value < 0 and messages if value > 0 (edited)
for value == 0 there are nuances
@dom https://github.com/iotaledger/wiki/blob/master/hackathon-guide.md#make-a-transfer anchor doesn't work (edited)
Dominic Wörner:
does the bundle consists of tx ids?
would make more sense
Come-from-Beyond:
there is no such structure as bundle, it's manifested only on meta-level
bundle is set of txs
so we can't say that bundle consists of tx ids, it consists of txs
which have ids/hashes (edited)
do you know Bitcoin transaction structure?
if you do - in IOTA it's different
while we can think of IOTA txs as of inputs/outputs in Bitcoin we should remember that IOTA txs are separate objects
in Bitcoin you get a whole tx because they are indivisible, in IOTA its equivalent, i.e. bundle, is divisible
there are plenty of incomplete bundles in tangle now, and some txs are lost forever
because we use UDP
Dominic Wörner:
I thougt a bundle was atomic
Come-from-Beyond:
it's atomic when processed
we collect txs but don't start processing (validation, approval) until we collect all txs
Dominic Wörner:
sure
Come-from-Beyond:
in Bitcoin we have to think how to share large txs with others
in IOTA basic unit of interaction is a tx and it has fixed size
this matters when we are in IoT
with constrained bandwidth and constrained processing power
Dominic Wörner:
alothough a typical bitcoin tx is much smaller than one IOTA transaction :slightly_smiling_face:
Come-from-Beyond:
yes, but if you add quantum resistance it will change drastically
80% is occupied by signature
Dominic Wörner:
But Bitcoin has in principle the same quantum resistance because you use hashes of pub keys
Come-from-Beyond:
it's an urban legend
while you are waiting for your tx to be included into a block a quantum adversary will doublespend 100 times
dare to race against him (whose tx is included by miners who will prefer higher fee)?
in other words it's safe only if you don't want to spend your coins
Dominic Wörner:
potentially. It still takes time to crack private key
Come-from-Beyond:
it's believed to be as fast as generating a signature
i.e. milliseconds
Dominic Wörner:
if you have a quantum computer of the size of today’s computers..
Come-from-Beyond:
yes
if quantum computers don't appear then bitcoin sigs will be much shorter with the same level of security (edited)
Dominic Wörner:
until quantum computers are competitive, Lightning network variants thereof will be there such that you typically only have to send signatures between a few parties
and Bitcoin can switch to quantum proof signatures
Come-from-Beyond:
Yes
Dominic Wörner:
and then the load of the network is much smaller
Come-from-Beyond:
there are some nuances:
@come-from-beyond always says "it's 60% account-based, 40% UTXO"
in IOTA 100 inputs will be grouped into 1 output
we target IoT where a lot of small transfers are met much more often than few big ones
Bitcoin will require higher bandwidth consumption even without quantum computers threat
and I don't mention very computing intensive tx validation of Bitcoin yet (edited)
in IOTA it's plain summing without necessity to order
not many ppl know that except block size limit there is op limit in Bitcoin
it's not hard to make IoT devices to spend eternity for tx validation
so Bitcoin has its niche and IOTA has its niche and they will barely intersect
if a miracle happens and today IoT devices adopt Bitcoin then once Bitcoin migrates to quantum-proof sigs 100s millions if not billions IoT devices will be thrown away because it's easier to replace them instead of upgrading
Dominic Wörner:
if they adopt IOTA you’ll have to throw them away next week because there will be changes :slightly_smiling_face:
Come-from-Beyond:
IOTA protocol is set in stone, we don't even have "version" field anywhere :slightly_smiling_face: (edited)
Dominic Wörner:
I mean, it will take quite some time till real tiny embedded IOT devices will support any of this
Come-from-Beyond:
yes, it won't happen today
_Dominic Wörner: _
besides PoCs of course
Come-from-Beyond:
we are working on hardware support for IOTA :jinn: (edited)
Dominic Wörner:
that means hashing for PoW and Signatures will be optimized?
Come-from-Beyond:
Yes, with Curl ASIC
Dominic Wörner:
hey, thanks for the discussion. I’ll have to do some other work but I’ll try to wrap my head around your structure late. But I think It’ll be helpful if there would be a document explaining this better. The whitepaper doesn’t really touch that.
Come-from-Beyond:
aye, more documentation would be helpful
David Sønstebø:
@domwoe You need to consider the fact that 'Distributed Ledgers' has not been in the mind of chip designers before outside of gaining profits through mining. Once a DLT is established as standard every chip will of course come with this component (its free of charge)
Once a Machine Economy, Data Integrity and ID of Things become standard part of the ecosystem on the software side, of course the hardware adapts. This is how all technological progress happens, and it's non-controversial.
This is not like the insane idea of 21 Inc of putting powerhungry asics in your fridge, this is a collection of thousands of logic gates that already fit on the processor die, it literally consumes no energy for all practical purposes
Dominic Wörner:
I agree on most but if it is literally consuming no energy for all practical purposes it’s a bad mechanism against spam
David Sønstebø:
Not when you take into consideration the quantity of devices involved