Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
569d7dac
Commit
569d7dac
authored
Jun 19, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added watch only wallet for use in tumble bit
parent
c48d69a5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
12 deletions
+17
-12
Program.cs
Breeze/src/Breeze.Daemon/Program.cs
+2
-0
ExternalServices.cs
Breeze/src/Breeze.TumbleBit.Client/ExternalServices.cs
+1
-5
PaymentStateMachine.cs
Breeze/src/Breeze.TumbleBit.Client/PaymentStateMachine.cs
+5
-5
TumbleBitManager.cs
Breeze/src/Breeze.TumbleBit.Client/TumbleBitManager.cs
+5
-2
TumblingState.cs
Breeze/src/Breeze.TumbleBit.Client/TumblingState.cs
+4
-0
No files found.
Breeze/src/Breeze.Daemon/Program.cs
View file @
569d7dac
...
...
@@ -18,6 +18,7 @@ using Stratis.Bitcoin.Miner;
using
Stratis.Bitcoin.Notifications
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.WatchOnlyWallet
;
namespace
Breeze.Daemon
{
...
...
@@ -90,6 +91,7 @@ namespace Breeze.Daemon
{
tumblerAddress
=
tumblerAddress
.
Replace
(
"-tumbler-uri="
,
string
.
Empty
);
fullNodeBuilder
.
UseTumbleBit
(
new
Uri
(
tumblerAddress
));
fullNodeBuilder
.
UseWatchOnlyWallet
();
}
var
node
=
fullNodeBuilder
.
Build
();
...
...
Breeze/src/Breeze.TumbleBit.Client/ExternalServices.cs
View file @
569d7dac
...
...
@@ -13,11 +13,7 @@ namespace Breeze.TumbleBit.Client
{
return
null
;
}
public
void
Track
(
Script
scriptPubkey
)
{
}
public
bool
Broadcast
(
Transaction
tx
)
{
return
true
;
...
...
Breeze/src/Breeze.TumbleBit.Client/PaymentStateMachine.cs
View file @
569d7dac
...
...
@@ -98,8 +98,8 @@ namespace Breeze.TumbleBit.Client
correlation
=
GetCorrelation
(
session
.
SolverClientSession
.
EscrowedCoin
.
ScriptPubKey
);
// Tracker.AddressCreated(cycle.Start, TransactionType.ClientEscrow, escrowTxOut.ScriptPubKey, correlation);
// Tracker.TransactionCreated(cycle.Start, TransactionType.ClientEscrow, clientEscrowTx.GetHash(), correlation);
services
.
Track
(
escrowTxOut
.
ScriptPubKey
);
// Tracker.TransactionCreated(cycle.Start, TransactionType.ClientEscrow, clientEscrowTx.GetHash(), correlation);
this
.
watchOnlyWalletManager
.
Watch
(
escrowTxOut
.
ScriptPubKey
);
var
redeemDestination
=
this
.
OriginWallet
.
GetAccountsByCoinType
(
this
.
coinType
).
First
().
GetFirstUnusedReceivingAddress
().
ScriptPubKey
;
// Services.WalletService.GenerateAddress().ScriptPubKey;
var
redeemTx
=
session
.
SolverClientSession
.
CreateRedeemTransaction
(
feeRate
,
redeemDestination
);
...
...
@@ -147,7 +147,7 @@ namespace Breeze.TumbleBit.Client
var
tumblerInformation
=
await
this
.
BobClient
.
OpenChannelAsync
(
bobEscrowInformation
);
session
.
PromiseClientSession
=
session
.
ClientChannelNegotiation
.
ReceiveTumblerEscrowedCoin
(
tumblerInformation
);
//Tell to the block explorer we need to track that address (for checking if it is confirmed in payment phase)
services
.
Track
(
session
.
PromiseClientSession
.
EscrowedCoin
.
ScriptPubKey
);
this
.
watchOnlyWalletManager
.
Watch
(
session
.
PromiseClientSession
.
EscrowedCoin
.
ScriptPubKey
);
//Tracker.AddressCreated(cycle.Start, TransactionType.TumblerEscrow, PromiseClientSession.EscrowedCoin.ScriptPubKey, correlation);
//Tracker.TransactionCreated(cycle.Start, TransactionType.TumblerEscrow, PromiseClientSession.EscrowedCoin.Outpoint.Hash, correlation);
...
...
@@ -194,8 +194,8 @@ namespace Breeze.TumbleBit.Client
var
offerRedeemAddress
=
this
.
OriginWallet
.
GetAccountsByCoinType
(
this
.
coinType
).
First
().
GetFirstUnusedReceivingAddress
();
// Services.WalletService.GenerateAddress($"Cycle {cycle.Start} Tumbler Redeem").ScriptPubKey);
var
offerRedeem
=
session
.
SolverClientSession
.
CreateOfferRedeemTransaction
(
feeRate
,
offerRedeemAddress
.
ScriptPubKey
);
//May need to find solution in the fulfillment transaction
services
.
Track
(
offerRedeem
.
PreviousScriptPubKey
);
//May need to find solution in the fulfillment transaction
this
.
watchOnlyWalletManager
.
Watch
(
offerRedeem
.
PreviousScriptPubKey
);
//Tracker.AddressCreated(cycle.Start, TransactionType.ClientOfferRedeem, offerRedeemAddress.ScriptPubKey, correlation);
services
.
TrustedBroadcast
(
cycle
.
Start
,
TransactionType
.
ClientOfferRedeem
,
correlation
,
offerRedeem
);
logger
.
LogInformation
(
"Offer redeem "
+
offerRedeem
.
Transaction
.
GetHash
()
+
" locked until "
+
offerRedeem
.
Transaction
.
LockTime
.
Height
);
...
...
Breeze/src/Breeze.TumbleBit.Client/TumbleBitManager.cs
View file @
569d7dac
...
...
@@ -6,6 +6,7 @@ using NBitcoin;
using
NTumbleBit.ClassicTumbler
;
using
Stratis.Bitcoin
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.WatchOnlyWallet
;
namespace
Breeze.TumbleBit.Client
{
...
...
@@ -17,6 +18,7 @@ namespace Breeze.TumbleBit.Client
{
private
ITumblerService
tumblerService
;
private
readonly
IWalletManager
walletManager
;
private
readonly
IWatchOnlyWalletManager
watchOnlyWalletManager
;
private
readonly
ILogger
logger
;
private
readonly
Signals
signals
;
private
readonly
ConcurrentChain
chain
;
...
...
@@ -26,15 +28,16 @@ namespace Breeze.TumbleBit.Client
private
ClassicTumblerParameters
TumblerParameters
{
get
;
set
;
}
public
TumbleBitManager
(
ILoggerFactory
loggerFactory
,
IWalletManager
walletManager
,
ConcurrentChain
chain
,
Network
network
,
Signals
signals
)
public
TumbleBitManager
(
ILoggerFactory
loggerFactory
,
IWalletManager
walletManager
,
IWatchOnlyWalletManager
watchOnlyWalletManager
,
ConcurrentChain
chain
,
Network
network
,
Signals
signals
)
{
this
.
walletManager
=
walletManager
;
this
.
watchOnlyWalletManager
=
watchOnlyWalletManager
;
this
.
chain
=
chain
;
this
.
signals
=
signals
;
this
.
network
=
network
;
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
tumblingState
=
new
TumblingState
(
loggerFactory
,
this
.
chain
,
this
.
walletManager
,
this
.
network
);
this
.
tumblingState
=
new
TumblingState
(
loggerFactory
,
this
.
chain
,
this
.
walletManager
,
this
.
watchOnlyWalletManager
,
this
.
network
);
}
/// <inheritdoc />
...
...
Breeze/src/Breeze.TumbleBit.Client/TumblingState.cs
View file @
569d7dac
...
...
@@ -10,6 +10,7 @@ using NTumbleBit.ClassicTumbler;
using
NTumbleBit.PuzzlePromise
;
using
NTumbleBit.PuzzleSolver
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.WatchOnlyWallet
;
namespace
Breeze.TumbleBit.Client
{
...
...
@@ -20,6 +21,7 @@ namespace Breeze.TumbleBit.Client
private
readonly
ILogger
logger
;
private
readonly
ConcurrentChain
chain
;
private
readonly
IWalletManager
walletManager
;
private
readonly
IWatchOnlyWalletManager
watchOnlyWalletManager
;
private
readonly
CoinType
coinType
;
[
JsonProperty
(
"tumblerParameters"
)]
...
...
@@ -60,11 +62,13 @@ namespace Breeze.TumbleBit.Client
public
TumblingState
(
ILoggerFactory
loggerFactory
,
ConcurrentChain
chain
,
IWalletManager
walletManager
,
IWatchOnlyWalletManager
watchOnlyWalletManager
,
Network
network
)
{
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
chain
=
chain
;
this
.
walletManager
=
walletManager
;
this
.
watchOnlyWalletManager
=
watchOnlyWalletManager
;
this
.
coinType
=
(
CoinType
)
network
.
Consensus
.
CoinType
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment