<p>What will be the script like for a situation like this:</p>

<p>Lets say Alice and Bob are 2 parties. Alice has a password which Bob wants. Alice will only give Bob the password if Bob pays 5BTC to Alice. How can we ensure Alice can consume the money only if she gives the right password to Bob. Else Bob gets the money back.</p>

<p>I was thinking along the lines of Bip199. Please let me know if anything else can be done as BIP199 faces a flaw. I was recommended to use OTP but how to incorporate that in a Locking Script.</p>

CC BY-SA 4.0
2020-03-16T20:07:38.270Z
First of all we need to answer this: how does Bob know he received the right password? And is it possible to test this in a stateless manner (e.g. if Bob knows the hash of the correct password beforehand, it's easy; if he needs to try to log in to a site with it, this is not possible).
Pieter Wuille
CC BY-SA 4.0
2020-03-16T20:31:59.087Z
Yes, so can we make a locking script such that only when BOB gets the right password can Alice consume the UTXO
Anonymous
CC BY-SA 4.0
2020-03-16T20:43:05.600Z
Yes, but how do you define "right" password? Please answer this: when Bob receives a password, how does he verify it's the correct one?
Pieter Wuille
CC BY-SA 4.0
2020-03-16T21:06:00.397Z
So for example password is for a mail- then all BOB can do is try and see, if not valid then not let Alice consume.  I was suggested to think in terms of One time Password(OTP), any suggestions?
Anonymous
CC BY-SA 4.0
2020-03-16T21:11:56.440Z
I don't understand what you're asking. What does "password for a mail" mean? How does Bob verify he has the right password?
Pieter Wuille
CC BY-SA 4.0
2020-03-16T21:13:25.890Z
Lets say Alice has an email account and a password for that account. Bob wants to use that email and for that will have to ask Alice for its password
Anonymous
CC BY-SA 4.0
2020-03-16T21:14:59.877Z
Ah, that's simply not possible. There has to be a stateless way (not "try to login") for Bob to verify he received the right password if you want some form of atomic swap of money for the password.
Pieter Wuille
<blockchain>
Creating a Locking Script
Anonymous
# Creating a Locking Script

(Asked by: username_0 on 2020-03-16)

What will be the script like for a situation like this:

Lets say Alice and Bob are 2 parties. Alice has a password which Bob wants. Alice will only give Bob the password if Bob pays 5BTC to Alice. How can we ensure Alice can consume the money only if she gives the right password to Bob. Else Bob gets the money back.

I was thinking along the lines of Bip199. Please let me know if anything else can be done as BIP199 faces a flaw. I was recommended to use OTP but how to incorporate that in a Locking Script.

**Tags:** blockchain

> **Comments:**
> **username_1**: First of all we need to answer this: how does Bob know he received the right password? And is it possible to test this in a stateless manner (e.g. if Bob knows the hash of the correct password beforehand, it's easy; if he needs to try to log in to a site with it, this is not possible).  
> **username_0**: Yes, so can we make a locking script such that only when BOB gets the right password can Alice consume the UTXO  
> **username_1**: Yes, but how do you define "right" password? Please answer this: when Bob receives a password, how does he verify it's the correct one?  
> **username_0**: So for example password is for a mail- then all BOB can do is try and see, if not valid then not let Alice consume.  I was suggested to think in terms of One time Password(OTP), any suggestions?  
> **username_1**: I don't understand what you're asking. What does "password for a mail" mean? How does Bob verify he has the right password?  
> **username_0**: Lets say Alice has an email account and a password for that account. Bob wants to use that email and for that will have to ask Alice for its password  
> **username_1**: Ah, that's simply not possible. There has to be a stateless way (not "try to login") for Bob to verify he received the right password if you want some form of atomic swap of money for the password.  

---

## 0 answers

