I have some questions about the time that transactions are received as recorded by the official satoshi client.
1) Why is the time recorded for a received transaction only stored to an accuracy of one second instead of a greater accuracy such as one millisecond or microsecond? It would seem that for automated services which need to know the order in which transactions have arrived, this would not provide enough accuracy.
I ran a quick test using the following script to send alternating amounts rapidly in a row, which produced the following sent and received transaction list from calling listtransactions (see end of post, trimmed for clarity)
It may be expected that transactions announced in the order 0.1, 0.2, 0.3, 0.4 etc should arrive in the order 0.1, 0.2, 0.3, 0.4 etc however if the time between announcing them is small enough, they do not.
I have justified this discrepancy by telling myself 'the network is complex and transaction propagation is complex', however my second question is
2) If two received transactions have the same timestamp (accurate to one second), how can I be certain which transaction was received first? Is it fair to assume that the transaction list from calling bitcoind listtransactions is in the same order as the client received them? It seems like a fair assumption, but I just want to be sure. From the transaction list I have on the 'send' client it seems this is not the case, and the order for transactions with the same timestamp is arbitrary. For example, when querying a normal sql database for several rows without any 'order by' clause, there should be no expectation about the order of those rows - does this also apply here?
Also
3) What sort of error should I expect on this? For example, how much time between transactions should I leave to be 99% certain that they will appear in the receive client in the correct order? Can this question even be reasonably answered or does it depend too much on unknown factors?
4) Does the bash script below definitely send the coins in the order described or am I experiencing some kind of threading complexity which means that the transactions are actually being sent in a different order to what I would expect? (Just a sanity check here)
#!/bin/bash
bitcoind sendtoaddress mk563JtWmGCsEng4EpaTH2o6eZYZgCrSLR 0.001
bitcoind sendtoaddress mvTH5BorrGoFicGd9KMwAEiLnjscY55WJr 0.002
bitcoind sendtoaddress mk563JtWmGCsEng4EpaTH2o6eZYZgCrSLR 0.001
bitcoind sendtoaddress mvTH5BorrGoFicGd9KMwAEiLnjscY55WJr 0.002
bitcoind sendtoaddress mk563JtWmGCsEng4EpaTH2o6eZYZgCrSLR 0.001
bitcoind sendtoaddress mvTH5BorrGoFicGd9KMwAEiLnjscY55WJr 0.002
bitcoind sendtoaddress mk563JtWmGCsEng4EpaTH2o6eZYZgCrSLR 0.001
bitcoind sendtoaddress mvTH5BorrGoFicGd9KMwAEiLnjscY55WJr 0.002
SENDER listtransactions
[
{
"amount" : -0.00100000,
"txid" : "124caf3ca1e1f63a70dcd0253e44b33dec20444ff4c67e9c5715be0ab211e0c8",
"time" : 1345863327
},
{
"amount" : -0.00200000,
"txid" : "26b37a2a38fc195e55fa2a395e4818bcb4c97e23b1c200677ab0d6b45f87beeb",
"time" : 1345863327
},
{
"amount" : -0.00100000,
"txid" : "d992aecf3b0637e9eac118196c99eaeae1317c296e191246fecfb67c88afb17e",
"time" : 1345863327
},
{
"amount" : -0.00100000,
"txid" : "1eebb55f17c2182942ad8599d21e67182d3ebcbd2f6b115ff2e7a94de7ac8a7b",
"time" : 1345863328
},
{
"amount" : -0.00100000,
"txid" : "26233a249d6b2491400b4897d8d97478c8dbcb76a677c192edf3b26b9e8d5387",
"time" : 1345863328
},
{
"amount" : -0.00200000,
"txid" : "5bb45618fcb27334698047f395018fe619651419870f052455eb9910d519a168",
"time" : 1345863328
},
{
"amount" : -0.00200000,
"txid" : "c100372b6840203229556bf159adc84af7289d7acb3ce0413685d86c69b0252c",
"time" : 1345863328
},
{
"amount" : -0.00200000,
"txid" : "d71734f47c652afd3306dfa350147801d0a934b8785aafce1153561edeb6e095",
"time" : 1345863328
}
]
RECEIVED listtransactions
[
{
"amount" : 0.00100000,
"txid" : "1eebb55f17c2182942ad8599d21e67182d3ebcbd2f6b115ff2e7a94de7ac8a7b",
"time" : 1345863331
},
{
"amount" : 0.00100000,
"txid" : "26233a249d6b2491400b4897d8d97478c8dbcb76a677c192edf3b26b9e8d5387",
"time" : 1345863331
},
{
"amount" : 0.00200000,
"txid" : "26b37a2a38fc195e55fa2a395e4818bcb4c97e23b1c200677ab0d6b45f87beeb",
"time" : 1345863331
},
{
"amount" : 0.00100000,
"txid" : "d992aecf3b0637e9eac118196c99eaeae1317c296e191246fecfb67c88afb17e",
"time" : 1345863331
},
{
"amount" : 0.00200000,
"txid" : "5bb45618fcb27334698047f395018fe619651419870f052455eb9910d519a168",
"time" : 1345863332
},
{
"amount" : 0.00200000,
"txid" : "c100372b6840203229556bf159adc84af7289d7acb3ce0413685d86c69b0252c",
"time" : 1345863332
},
{
"amount" : 0.00100000,
"txid" : "124caf3ca1e1f63a70dcd0253e44b33dec20444ff4c67e9c5715be0ab211e0c8",
"time" : 1345863333
},
{
"amount" : 0.00200000,
"txid" : "d71734f47c652afd3306dfa350147801d0a934b8785aafce1153561edeb6e095",
"time" : 1345863333
}
]
edit:
and this is the output from the bash script
124caf3ca1e1f63a70dcd0253e44b33dec20444ff4c67e9c5715be0ab211e0c8
26b37a2a38fc195e55fa2a395e4818bcb4c97e23b1c200677ab0d6b45f87beeb
d992aecf3b0637e9eac118196c99eaeae1317c296e191246fecfb67c88afb17e
5bb45618fcb27334698047f395018fe619651419870f052455eb9910d519a168
26233a249d6b2491400b4897d8d97478c8dbcb76a677c192edf3b26b9e8d5387
d71734f47c652afd3306dfa350147801d0a934b8785aafce1153561edeb6e095
1eebb55f17c2182942ad8599d21e67182d3ebcbd2f6b115ff2e7a94de7ac8a7b
c100372b6840203229556bf159adc84af7289d7acb3ce0413685d86c69b0252c