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

[#79] Update documentation after lots of changes #89

Merged
merged 6 commits into from
Mar 2, 2018

Conversation

szerepak
Copy link

@szerepak szerepak commented Feb 27, 2018

This is happy path usage only.

Real MONA and DOGE were swapped 👍

@karolciejka:
image 2

@@ -5,7 +5,7 @@
from pprint import pprint
import sys

from script_utils import (
from bin.script_utils import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other scripts are working without that bin. because bin is going to be added to the sys path.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah right, I just added it for my own purposes, cause pycharm was confused and "go to" feature did not work. Bu it defo should be in a separate PR. 😄

## 5. Contract creation

[**Bob**] needs to create contract in network of coins he wants to receive (i.e. Alice's network), in our case in Bitecoin network.
As Bob has transaction hash from Alice, he can get full serialized transaction. But for testing purposes we can get it from `initial_transaction` object.
Copy link
Contributor

@trojkat trojkat Feb 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should describe a real-life example so Bob should get a full transaction from some block explorer and pass that hex form.

alice_transaction = '0100000001b88ae2db0538ea2470b9b8f9cf80dbc5de9e90f1beeb70de6c971a8bd866cd6e010000006b483045022100803d409feeb1e1973fa95cfff7c52fa3dc1dd0017be2a13a0a5a6d28d012e26602203ce867a442a004a71571e6fa34a3151f1cb453ecc233c881592deec14cc3dcf6012103142762372a0f6f2b4718cdee32fa1a3cc2465d3379312e8875ee5f9193158177ffffffff0200c2eb0b000000006363a820260ab6c77d0f6e3108553b833712ab64e58368210dbe9914ce912dc9a82c8fc08876a9143f8870a5633e4fdac612fba47525fef082bbe961670a31353138313738363830b17576a914812ff3e5afea281eb3dd7fce9b077e4ec6fba08b6888ac7ab4b304000000001976a914812ff3e5afea281eb3dd7fce9b077e4ec6fba08b88ac00000000'
alice_contract = btc_network.audit_contract(alice_transaction)

[**Alice**] sends hers transaction hash `bfad3cf3b16c8fb1b71ce88b1a48cb951d339abbb5720a94fbd4d6345ee6e64f` to Bob.


## 5. Contract creation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say Contract audit


## 10. Secret passing

[**Alice**] should pass the secret of `initial_transaction` to Bob.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, Bob must rely on Alice and this is not true. Bob should track Alice wallet and search for redeem transaction + Alice can send him a transaction address. Then Bob should extract the secret himself from that transaction.

@szerepak szerepak force-pushed the cl-79-update-documentation-after-lots-of-changes branch from b5e7199 to 6eb1d37 Compare February 28, 2018 09:54
alice_btc_wallet.address,
bob_btc_address,
bob_btc_wallet.address,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alice won't have access to bob_btc_wallet

'bfad3cf3b16c8fb1b71ce88b1a48cb951d339abbb5720a94fbd4d6345ee6e64f'


## 4. Communication

[**Alice**] sends her transaction hash `bfad3cf3b16c8fb1b71ce88b1a48cb951d339abbb5720a94fbd4d6345ee6e64f` to Bob.
[**Alice**] sends hers transaction hash `bfad3cf3b16c8fb1b71ce88b1a48cb951d339abbb5720a94fbd4d6345ee6e64f` to Bob.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alice also needs to send a contract from initial_transaction details.


## 5. Contract audit

[**Bob**] needs to create contract in network of coins he wants to receive (i.e. Alice's network), in our case in Bitecoin network.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add that at this point Bob should validate if the data returned in the contract is correct, he should also check if the transaction is present in the blockexplorer.

participate_transaction = alice_contract.participate(
'ltc',
bob_ltc_wallet.address,
alice_ltc_wallet.address,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bob won't have access to alice_ltc_wallet


[**Bob**] has to create parallel transaction from point 3 but in his network (i.e. Litecoin network). We call it `participate_transaction`.

litecoin_ammount = 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo amount


## 10. Secret capture

[**Bob**] Bob should track Alice's wallet and search for redeem transaction (Alice can but don't have to send him a transaction address).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Bob from the beginning

@szerepak szerepak force-pushed the cl-79-update-documentation-after-lots-of-changes branch 3 times, most recently from 7629080 to 64bafa2 Compare March 1, 2018 13:51
## 3. Alice is initializing an atomic swap transaction

[**Alice**] have to prepare a transaction input (UTXO's that she wants to spend in this transaction). You can find these information by viewing transaction on block explorer e.g. [link](https://api.blockcypher.com/v1/btc/test3/txs/6ecd66d88b1a976cde70ebbef1909edec5db80cff9b8b97024ea3805dbe28ab8?limit=50&includeHex=true)
[**Alice**] has to prepare a transaction input (UTXO's that she wants to spend in this transaction). You can find these information by viewing transaction on block explorer e.g. [link](https://api.blockcypher.com/v1/mona/test3/txs/6ecd66d88b1a976cde70ebbef1909edec5db80cff9b8b97024ea3805dbe28ab8?limit=50&includeHex=true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -81,37 +99,208 @@ Alice and Bob exchange their wallet addresses.
),
Copy link
Contributor

@trojkat trojkat Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utxo(
    tx_id='9fcc235b4c1830f6eb1c67be807aeda0a3f7290eb05caf948f4b9f1016c8bffd',
    vout=0,
    value=2.8,
    tx_script='76a9142b6a3314e8fcf1f1fd6b4d70b112bd5a1928505788ac'
),


## 7. Communication

[**Bob**] sends his transaction hash `4168d4ac41debc550f6af6f5cb3ab37ab68aff624f562012a120379c026f6b12` and contract to Alice.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and contract '63a8205de2198a39122100c4179933a4d577151445f400383aa6563d7fe2967cb54f8b8876a91462aef49943f16565b7ff9ef170a0d4bc5397763967041027995ab17576a91479364cbefe7c9b926792911b3611628102f9314c6888ac'

## 10. Secret capture

[**Bob**] should track Alice's wallet and search for redeem transaction (Alice can but don't have to send him a transaction address).
Then Bob should extract the secret himself from that transaction. (e.g. "hex" in https://api.blockcypher.com/v1/doge/main/txs/980ccfd7375a6946c3453178350784e5bf43a8216b039e513521805551a464dd?limit=50&includeHex=true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Lamden Lamden deleted a comment from trojkat Mar 2, 2018
@szerepak szerepak force-pushed the cl-79-update-documentation-after-lots-of-changes branch from 506a7f6 to aaad831 Compare March 2, 2018 14:30
Copy link
Contributor

@trojkat trojkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 👍

[**Bob**] should track Alice's wallet and search for redeem transaction (Alice can but don't have to send him a transaction address).
Then Bob should extract the secret himself from that transaction. (e.g. "hex" in https://api.blockcypher.com/v1/doge/main/txs/980ccfd7375a6946c3453178350784e5bf43a8216b039e513521805551a464dd?limit=50&includeHex=true)

secret = doge_network.extract_secret('0100000001222d497dd12edf372cd814bb0f09b958a511e002838343af8891f86ab758542e00000000fd2c014830450221009d1b15bf348b3965bae8da424765c1e1ce11911011e0f0e8a865e1401782c96602202e68592fe6308c10c7a225009a0e5548e5f4115555081fa9a96939d305ab54fb01410459cdb91eb7298bc2578dc4e7ac2109ac3cfd9dc9818795c5583e720d2114d540724bf26b4541f683ff51968db627a04eecd1f5cff615b6350dad5fb595f8adf4406950564e32496a76383243546a523966704f3945464e5239736932446373453367596649776f365357626b4e4176516d436b5164387878633534554453645948514c5d63a82088e65ab63c0aceb81187eabfd45594268ce6d565d42ed0963fbef48e88d89a158876a91485c0522f6e23beb11cc3d066cd20ed732648a4e667045ba4965ab17576a914621f617c765c3caa5ce1bb67f6a3e51382b8da296888ac0000000001b80c0400000000001976a91485c0522f6e23beb11cc3d066cd20ed732648a4e688ac00000000')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doge_network.extract_secret('0100000001362dd983e73de5c91651d08c85f0be575f2bafb2140fc11fe542b61b4a47a9c300000000fd2c01483045022100e89b7a267c252419cf6dbeaa53d0074bce98e5a0d7da0c29ad4f31d8cd1ebfff0220495666315b45b4a5a30e2ea2cba1a20bae2031b607ff21230fea295cd35ce591014104dbe8366e39f93afcd70616e9049ee3eb5e09acdcadb63fb7d488fbb7af9f211e7e36998ba279f68ea01f5f090be8478465ee7dd91085e3f44831b0db032a63f7406b4e4943623938384c72685a696b76336177424639436738616c58766737517058717466495639366f433353456c4d36634e71334c36636e42383632337a6a57514c5d63a8205de2198a39122100c4179933a4d577151445f400383aa6563d7fe2967cb54f8b8876a91462aef49943f16565b7ff9ef170a0d4bc5397763967041027995ab17576a91479364cbefe7c9b926792911b3611628102f9314c6888ac00000000010fe2f453020000001976a91462aef49943f16565b7ff9ef170a0d4bc5397763988ac00000000')

@szerepak szerepak force-pushed the cl-79-update-documentation-after-lots-of-changes branch from aaad831 to fcd4483 Compare March 2, 2018 14:58
@szerepak szerepak merged commit 5f2d308 into master Mar 2, 2018
@szerepak szerepak deleted the cl-79-update-documentation-after-lots-of-changes branch March 2, 2018 15:02
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

Successfully merging this pull request may close these issues.

3 participants