You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
11 Hrs
3 Min
2 Seg
Curso de Bitcoin para Developers

Curso de Bitcoin para Developers

Juan Sebastián Marulanda

Juan Sebastián Marulanda

Transaction fees en Bitcoin

11/16
Resources

Every transaction on a Blockchain has a commission, or fee, incentive to the miner to be prioritized, processed and confirmed.

What is the cost of commissions?

Miners are rewarded for mining and for keeping a Blockchain's network secure.

They receive commissions from each transaction of a block that have previously been prioritized and taken from the Bitcoin mempool for further validation.

Bitcoin Mempool
Recall that the Mempool is that memory space that the Bitcoin Blockchain uses to store unconfirmed transactions. Nodes take transactions with priority to validate and insert into a new block.

The prioritization of a transaction depends on its commission. If it is too low, the transaction may never be confirmed. If its cost is above average, it will be more tempting for miners.

The cost of a commission is manipulable, i.e. we can set how many Satoshis it will be for the miner. It is complex to determine how much money a commission should be, as it depends on the usage of the network at a certain time and the number of transactions waiting in the mempool.

Calculating the cost of a transaction

It might be believed that transferring 1000 BTC is much more expensive than transferring 1 BTC. This is false. Bitcoin fees do not depend on the amount of BTC we transfer or a percentage of them.

Commissions in the Bitcoin network depend on the amount of inputs and outputs used in the transaction. So a transaction of 1000 BTC could be cheaper than transferring 1 BTC.

When transferring value in BTC, the commission depends on the amount of outputs with which the amount to be sent is built. If we have 100 outputs that make up 1 BTC, the commission is more expensive than transferring 1000 BTC made up of a single output.

This is due to the amount of logical processing and the amount of memory the nodes will need to commit a transaction. If nodes need to process 100 outputs, it will be more expensive than processing just one and this determines the commission cost. The complexity and size and not on the value to be transferred.

Bitcoin does not understand about dollars
As people, we usually use the US dollar or the euro to establish the value of a digital asset such as bitcoin. Bitcoin does not understand, and does not care, how much its value is in dollars. That is a value established by exchanges through supply and demand. The Bitcoin Blockchain only understands units of BTC or Satoshis.

The fee for a transaction is implicit in the transaction. There is no field within the transaction that indicates the fee for the miner. This is calculated with the formula Fees = Sum(inputs) - Sum(outputs).

If we want to transfer 2 BTC using outputs that make up 5 BTC, we would get 3 BTC back. These 3 BTC must be set as exchange or return output to their source address explicitly. If this is not done, the 3 BTC will be the miner's commission so be very careful.

Conclusion

The mechanism behind Bitcoin to establish the cost of commissions is complex and with many variables to take into account in order not to make a mistake when transferring money.

Many of the concepts seen here, such as the calculation of commissions depending on the state of the network or the return value, should not worry us if we use wallets such as Metamask, since they perform all the calculations for us and even allow us to customize the cost of transactions.

These are all concepts to keep in mind if we want to work with Bitcoin and develop our own programs for value transfer.


Contributed by: Kevin Fiorentino (Platzi Contributor).

Contributions 11

Questions 4

Sort by:

Want to see more contributions, questions and answers from the community?

Si no estoy entendiendo mal, yo puedo tener 1 BTC proveniente de una transacción (una salida). O también puedo tener 1 BTC proveniente de 100 transacciones (100 salidas). El valor económico es el mismo, un Bitcoin.
Sin embargo, la cantidad de transacciones que necesité para tener ese bitcoin es lo que determinará la comisión para gastarlo (generar una entrada). Por lo tanto, con 100 salidas será mucho más costosa la comisión que solo una.

💡 Las transacciones no tienen un campo para el fee, el fee esta implícito como la diferencia entre la sumatoria de inputs y la sumatoria de outputs
Fees = Sum(inputs) - Sum(outputs)

Ejemplo:

Si quiero pagar un articulo de amazon que cuesta 0.20 BTC entonces:

  1. Se calcula mi entrada, la suma de todos los BTC que he recibido y tengo disponibles
    2 BTC
  2. Mi salida sera de 0.20 BTC
    1. Si no se especifica el UTXO (la segunda salida que sera hacia mi wallet o el “cambio”) entonces el fee se calcularía:
      fee = 2 - 0.20
      El fee quedaría como 1.80 BTC y el balance de nuestra wallet sería de 0 BTC
    2. Si especificamos cuanto queremos de UTXO, entonces lo demás se convertirá en el fee
      fee = 2 - (0.20 + 1.50)
      El fee quedaría como 0.30 BTC y el balance de nuestra wallet sería de 1.50 BTC

Transaction fees.

  • Es la compensación a los mineros por asegurar la red.
  • Son calculadas basadas en el tamaño de la transacción, no su valor.
  • Priorización.

.
Añadiendo fees a las transacciones.

  • Las transacciones no tienen un campo para fees.
  • Las fees están implícitas como la diferencia entre la sumatoria de inputs y la sumatoria de outputs.
  • Fees = Sum(inputs) - Sum(outputs).

Comparación Fee Bitcoin vs Ethereum

¿Qué es la tarifa de transacción y cómo se calcula?

transacciones no tienen un campo para fees.
fees= sum(inputs) - Sum (outputs)

Las tarifas se basan en la complejidad de la transacción

RESUMEN CLASE 11:
TRANSACTION FEES

I.- FEES

  • Compensación a los mineros por asegurar la red.

  • Calculadas basadas en el tamaño de la transacción, no su valor.

  • Priorización.

II.- AÑADIENDO FEES A LAS TRANSACCIONES

  • Transacciones no tienen un campo para fees

  • Fees están implícitas como la diferencia entre la sumatoria de inputs y la sumatoria de outputs

  • Fees = Sum(inputs) - Sum(outputs)

La cantidad y complejidad de las transacciones es lo que define el costo de tarifa, no importa el valor económico que se mueva

Tarifa Alta = Muchas Entradas/Salidas

mempool chart <https://bitcoinvisuals.com/bitcoind-mempool>

Las tarifas se basan en la complejidad de la transacción.

No soy un desarrollador llegue por el curso de Gestión de Criptoactivos… pero se entiende plenamente. Gracias!