A question about transaction broadcasting and block creation

0

Let's say we have transaction X and transaction Y. The timestamp of X is chronologically earlier than that of Y. X's spender broadcasts X to the network and the same goes for Y's spender.

Let's say that miners receive Y first and they add it to the next block, which reaches the max number of stored transactions. Will X be included to the block after this one? Will it be discarded?

If X will be included to the block after this one, isn't it a problem that it happened before Y?

Thanks in advance for your answers!

evannemo

Posted 2019-08-23T12:18:49.603

Reputation: 15

Answers

0

If I undestend the your question, you referer to the lockTime inside the transaction and not the block timestamp.

The lockTime is a int value, and this value rappresent "When the transaction can be unlockd to an inputs" and not "When the transaction was published"

Lock time: Defines the first instant in which the transaction is considered valid and can be transmitted on the Bitcoin network, represented by an integer value between 0 and 500 million, assuming different meanings based on the value assigned, that is:

  • Lock time = 0: the transaction is propagated and executed at the instant of creation.
  • 0 < LockTime <= 500: the value is interpreted as a block height, ie the transaction will be valid only after the block with height equal to the lock time value has been published.
  • Lock time> 500 million: the value is interpreted as a unix timestamp and therefore the transaction will be valid only after the date represented by the lock time value.

If you mean if the transaction has a timestamp, the answer is two:

  • Within the structure the transaction does not have a timestamp, but rather a lock time.

  • The transaction could have an insertion moment in the block, which depends on the block, because it is he who holds the timestamp as a value.

A real use case:   My transaction has a block timestamp equal to 8/23/2019, 2:08:43 PM GMT + 2, this represents the time in which the miner started the cryptographic challenge, and it is the instant in which the miner has also taken into consideration my transaction including it in the block. My transaction has a lockTime of 0 because it is an immediate execution transaction.

No one excuses that my transaction before the block was published was ALSO inside some other block with a slightly different timestamp

If you want have turn a detailed explanation of what and how a transaction works, I recommend this reading on bitcoin book

vincenzopalazzo

Posted 2019-08-23T12:18:49.603

Reputation: 572

So transactions don't have a timestamp?evannemo 2019-08-23T12:45:39.900

No, the block has the timestamp and it defines when the miner starts the cryptographic challengevincenzopalazzo 2019-08-23T12:46:53.063

I thought the cryptographic challenge happened before the block was added and once it is done, the block is actually added.evannemo 2019-08-23T12:47:58.400

The transactions are published in the block timestamp because all the data structure exists from the moment of publication and in the centuries to come :)vincenzopalazzo 2019-08-23T12:48:24.450

You got me confused. ( :P )evannemo 2019-08-23T12:49:24.810

So a block can store a "future" transaction? that is mined but not actually calculated?evannemo 2019-08-23T12:50:59.677

The block stores a "future" transaction, because neither the block nor the transaction are actually verified and published, that is the work of the miner, who creates a block with the new transactions inside, solves the cryptographic challenge and publishes the block, I have added a real example to my answervincenzopalazzo 2019-08-23T12:58:52.830

is this a kind of a state? the blockchain saves the locktime block after block and reduces it to 0 and then executes it?evannemo 2019-08-23T13:01:01.043

I don't understand, this "the blockchain saves the locktime block after block and reduces it to 0 and then "vincenzopalazzo 2019-08-23T13:10:41.757

I mean if the transaction is programmed to happen in 1/1/2030, will then every block include it until 1/1/2030?evannemo 2019-08-23T13:12:58.373

The lock time can be seen as a state, yes, the status of the transaction in my example is immediate, ie "as soon as possible". but do not confuse the timestamp with the locktime, the timestamp only indicates the age of the block, like a date of birth.vincenzopalazzo 2019-08-23T13:15:07.460

@evannemo No, the transaction will only be published in the first available block, but can only be spent after 1/1/2030vincenzopalazzo 2019-08-23T13:16:30.543

All right! My question is, if two transactions are about to spent once they are published (locktime = 0), but Y is included on the current block and X on the next, even though X was broadcasted first to the network, doesn't this create problems?evannemo 2019-08-23T13:20:39.363

What problems are you talking about? before answering, I would like to have an example of a complete use casevincenzopalazzo 2019-08-23T13:35:25.700

For example, The transaction Y could be spent before X, even though X was broadcasted first.evannemo 2019-08-23T13:36:36.230

Absolutly yes, A transaction is not spent at the time of publication, but the newly published transaction spends a transaction already present on the blockchain called the comunemenete UTXO, I added an excellent reading to my answer, you will have answers to all your doubtsvincenzopalazzo 2019-08-23T13:38:53.363