Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fidelity bonds and their present value #1001

Closed
drufat opened this issue Sep 4, 2021 · 3 comments
Closed

Fidelity bonds and their present value #1001

drufat opened this issue Sep 4, 2021 · 3 comments

Comments

@drufat
Copy link

drufat commented Sep 4, 2021

From obwatcher I see that the value of each fidelity bond remains constant over its lifetime, and is computed based on the difference between the time of first confirmation and its expiration date. However, wouldn't it make more sense for the bond value to be variable, and decrease as the expiration date approaches?
Intuitively the present value of the bond should be a function of time left to expiration rather than time from issuance to expiration.

@AdamISZ
Copy link
Member

AdamISZ commented Sep 4, 2021

The fidelity bond value calculated by the Taker is indeed a function of current time, see the variable mediantime here:

def calculate_fidelity_bond_values(fidelity_bonds_info):
if len(fidelity_bonds_info) == 0:
return {}
interest_rate = get_interest_rate()
blocks = jm_single().bc_interface.get_current_block_height()
mediantime = jm_single().bc_interface.get_best_block_median_time()

and the call that uses that variable:

FidelityBondMixin.calculate_timelocked_fidelity_bond_value(
utxo_data["value"],
jm_single().bc_interface.get_block_time(
jm_single().bc_interface.get_block_hash(
blocks - utxo_data["confirms"] + 1
)
),
bond_data.locktime,
mediantime,
interest_rate)

@drufat
Copy link
Author

drufat commented Sep 4, 2021

Thanks for the clarification. Closed.

@drufat drufat closed this as completed Sep 4, 2021
@chris-belcher
Copy link
Contributor

chris-belcher commented Sep 8, 2021

If the fidelity bond value slowly dropped while the coins were still timelocked, it might create an incentive for people to create a second fidelity bond and switch to it as the first one's value slowly drops. It seems to be a less efficient use of capital, because the first fidelity bond would still have timelocked coins that cant move but arent being used (or worse, do get used by the person running a second maker bot)

The reason the fidelity bond value slowly drops after the timelock is passed rather than just becoming zero immediately is to give a lot of time to makers to respend the coin to another timelocked address. Otherwise makers might have to pay a huge miner fee to get it confirmed quickly, which is also a waste.

In case you're not aware, theres a document here which aims to explain every aspect of valuing fidelity bonds: https://gist.github.com/chris-belcher/87ebbcbb639686057a389acb9ab3e25b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants