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

client: add a BTC exchange wallet #72

Merged
merged 6 commits into from
Dec 6, 2019
Merged

Conversation

buck54321
Copy link
Member

A DEX wallet interface and BTC implementation. To avoid the need to run a btcd node or to rewrite an RPC client from scratch, a compromise
is made to use btcd's rcpclient.Client for all RPC calls, but with wallet-related calls routed through the RawRequest method and parsed independently.

The wallet interface offered here is intended to be somewhat abstract, with language such as "utxos", "txid", and "vout" traded for more generalized terms such as "coins", "id", and "index". I
believe this makes the interface more flexible and keeps the client implementation independent of the underlying blockchain specifics.

client/asset/btc/btc.go Outdated Show resolved Hide resolved
dex/asset.go Outdated Show resolved Hide resolved
dex/btc/script.go Show resolved Hide resolved
server/comms/msgjson/types.go Outdated Show resolved Hide resolved
server/market/orderrouter.go Outdated Show resolved Hide resolved
server/asset/common.go Outdated Show resolved Hide resolved
// looking for the maker's redemption beginning at swapconf confirmations
// (at the latest) regardless of whether the server sends the 'redemption'
// message or not.
FindRedemption(ctx context.Context, txid string, vout uint32) (dex.Bytes, error)
Copy link
Member Author

Choose a reason for hiding this comment

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

In all wallet implementations, this method will need extra scrutiny. It should be impossible for someone to spend the swap output in such a way as to make this function fail.

@buck54321 buck54321 force-pushed the btcwallet branch 3 times, most recently from a763daf to 86344cf Compare November 20, 2019 17:46
@buck54321 buck54321 marked this pull request as ready for review November 20, 2019 17:47
Copy link
Member

@chappjc chappjc left a comment

Choose a reason for hiding this comment

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

First half reviewed.

client/asset/btc/btc.go Outdated Show resolved Hide resolved
client/asset/btc/btc.go Outdated Show resolved Hide resolved
client/asset/btc/go.sum Outdated Show resolved Hide resolved
client/asset/btc/go.mod Outdated Show resolved Hide resolved
client/asset/btc/btc.go Outdated Show resolved Hide resolved
client/asset/btc/btc.go Outdated Show resolved Hide resolved
client/asset/btc/btc.go Show resolved Hide resolved
client/asset/btc/btc.go Show resolved Hide resolved
client/asset/btc/walletclient.go Outdated Show resolved Hide resolved
client/asset/btc/btc.go Outdated Show resolved Hide resolved
@buck54321
Copy link
Member Author

There was some matrix discussion about using simnet instead of regnet. I failed to remember at the time, but bitcoind has no simnet.

@chappjc
Copy link
Member

chappjc commented Dec 2, 2019

Sounds like regnet will be the only option for rapid simulations with BTC then. Using this in market pairs with DCR simnet should then be permitted (i.e. only require a mainnet asset be paired with another mainnet asset).

@buck54321 buck54321 mentioned this pull request Dec 3, 2019
2 tasks
A wallet interface is developed along with the wallet functionality
needed for BTC, and likely a few clones. To avoid the need to run
a btcd node or to rewrite an RPC client from scratch, a compromise
is made to use btcd's rcpclient.Client for all RPC calls, but with
wallet-related calls routed through the RawRequest method and
parsed independently.

The wallet interface offered here is intended to be somewhat
abstract, with language such as "utxos", "txid", and "vout" traded
for more generalized terms such as "coins", "id", and "index". I
believe this makes the interface more flexible and keeps the client
implementation independent of the underlying blockchain specifics.
@chappjc chappjc merged commit 4749de6 into decred:master Dec 6, 2019
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