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
049e63f6
Commit
049e63f6
authored
Jun 19, 2017
by
Dan Gershony
Committed by
GitHub
Jun 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #104 from bokobza/master
Added watch only wallet for use in tumble bit
parents
9a873237
569d7dac
Show 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 @
049e63f6
...
@@ -18,6 +18,7 @@ using Stratis.Bitcoin.Miner;
...
@@ -18,6 +18,7 @@ using Stratis.Bitcoin.Miner;
using
Stratis.Bitcoin.Notifications
;
using
Stratis.Bitcoin.Notifications
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.WatchOnlyWallet
;
namespace
Breeze.Daemon
namespace
Breeze.Daemon
{
{
...
@@ -90,6 +91,7 @@ namespace Breeze.Daemon
...
@@ -90,6 +91,7 @@ namespace Breeze.Daemon
{
{
tumblerAddress
=
tumblerAddress
.
Replace
(
"-tumbler-uri="
,
string
.
Empty
);
tumblerAddress
=
tumblerAddress
.
Replace
(
"-tumbler-uri="
,
string
.
Empty
);
fullNodeBuilder
.
UseTumbleBit
(
new
Uri
(
tumblerAddress
));
fullNodeBuilder
.
UseTumbleBit
(
new
Uri
(
tumblerAddress
));
fullNodeBuilder
.
UseWatchOnlyWallet
();
}
}
var
node
=
fullNodeBuilder
.
Build
();
var
node
=
fullNodeBuilder
.
Build
();
...
...
Breeze/src/Breeze.TumbleBit.Client/ExternalServices.cs
View file @
049e63f6
...
@@ -14,10 +14,6 @@ namespace Breeze.TumbleBit.Client
...
@@ -14,10 +14,6 @@ namespace Breeze.TumbleBit.Client
return
null
;
return
null
;
}
}
public
void
Track
(
Script
scriptPubkey
)
{
}
public
bool
Broadcast
(
Transaction
tx
)
public
bool
Broadcast
(
Transaction
tx
)
{
{
return
true
;
return
true
;
...
...
Breeze/src/Breeze.TumbleBit.Client/PaymentStateMachine.cs
View file @
049e63f6
...
@@ -99,7 +99,7 @@ namespace Breeze.TumbleBit.Client
...
@@ -99,7 +99,7 @@ namespace Breeze.TumbleBit.Client
// Tracker.AddressCreated(cycle.Start, TransactionType.ClientEscrow, escrowTxOut.ScriptPubKey, correlation);
// Tracker.AddressCreated(cycle.Start, TransactionType.ClientEscrow, escrowTxOut.ScriptPubKey, correlation);
// Tracker.TransactionCreated(cycle.Start, TransactionType.ClientEscrow, clientEscrowTx.GetHash(), correlation);
// Tracker.TransactionCreated(cycle.Start, TransactionType.ClientEscrow, clientEscrowTx.GetHash(), correlation);
services
.
Track
(
escrowTxOut
.
ScriptPubKey
);
this
.
watchOnlyWalletManager
.
Watch
(
escrowTxOut
.
ScriptPubKey
);
var
redeemDestination
=
this
.
OriginWallet
.
GetAccountsByCoinType
(
this
.
coinType
).
First
().
GetFirstUnusedReceivingAddress
().
ScriptPubKey
;
// Services.WalletService.GenerateAddress().ScriptPubKey;
var
redeemDestination
=
this
.
OriginWallet
.
GetAccountsByCoinType
(
this
.
coinType
).
First
().
GetFirstUnusedReceivingAddress
().
ScriptPubKey
;
// Services.WalletService.GenerateAddress().ScriptPubKey;
var
redeemTx
=
session
.
SolverClientSession
.
CreateRedeemTransaction
(
feeRate
,
redeemDestination
);
var
redeemTx
=
session
.
SolverClientSession
.
CreateRedeemTransaction
(
feeRate
,
redeemDestination
);
...
@@ -147,7 +147,7 @@ namespace Breeze.TumbleBit.Client
...
@@ -147,7 +147,7 @@ namespace Breeze.TumbleBit.Client
var
tumblerInformation
=
await
this
.
BobClient
.
OpenChannelAsync
(
bobEscrowInformation
);
var
tumblerInformation
=
await
this
.
BobClient
.
OpenChannelAsync
(
bobEscrowInformation
);
session
.
PromiseClientSession
=
session
.
ClientChannelNegotiation
.
ReceiveTumblerEscrowedCoin
(
tumblerInformation
);
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)
//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.AddressCreated(cycle.Start, TransactionType.TumblerEscrow, PromiseClientSession.EscrowedCoin.ScriptPubKey, correlation);
//Tracker.TransactionCreated(cycle.Start, TransactionType.TumblerEscrow, PromiseClientSession.EscrowedCoin.Outpoint.Hash, correlation);
//Tracker.TransactionCreated(cycle.Start, TransactionType.TumblerEscrow, PromiseClientSession.EscrowedCoin.Outpoint.Hash, correlation);
...
@@ -195,7 +195,7 @@ namespace Breeze.TumbleBit.Client
...
@@ -195,7 +195,7 @@ namespace Breeze.TumbleBit.Client
var
offerRedeemAddress
=
this
.
OriginWallet
.
GetAccountsByCoinType
(
this
.
coinType
).
First
().
GetFirstUnusedReceivingAddress
();
// Services.WalletService.GenerateAddress($"Cycle {cycle.Start} Tumbler Redeem").ScriptPubKey);
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
);
var
offerRedeem
=
session
.
SolverClientSession
.
CreateOfferRedeemTransaction
(
feeRate
,
offerRedeemAddress
.
ScriptPubKey
);
//May need to find solution in the fulfillment transaction
//May need to find solution in the fulfillment transaction
services
.
Track
(
offerRedeem
.
PreviousScriptPubKey
);
this
.
watchOnlyWalletManager
.
Watch
(
offerRedeem
.
PreviousScriptPubKey
);
//Tracker.AddressCreated(cycle.Start, TransactionType.ClientOfferRedeem, offerRedeemAddress.ScriptPubKey, correlation);
//Tracker.AddressCreated(cycle.Start, TransactionType.ClientOfferRedeem, offerRedeemAddress.ScriptPubKey, correlation);
services
.
TrustedBroadcast
(
cycle
.
Start
,
TransactionType
.
ClientOfferRedeem
,
correlation
,
offerRedeem
);
services
.
TrustedBroadcast
(
cycle
.
Start
,
TransactionType
.
ClientOfferRedeem
,
correlation
,
offerRedeem
);
logger
.
LogInformation
(
"Offer redeem "
+
offerRedeem
.
Transaction
.
GetHash
()
+
" locked until "
+
offerRedeem
.
Transaction
.
LockTime
.
Height
);
logger
.
LogInformation
(
"Offer redeem "
+
offerRedeem
.
Transaction
.
GetHash
()
+
" locked until "
+
offerRedeem
.
Transaction
.
LockTime
.
Height
);
...
...
Breeze/src/Breeze.TumbleBit.Client/TumbleBitManager.cs
View file @
049e63f6
...
@@ -6,6 +6,7 @@ using NBitcoin;
...
@@ -6,6 +6,7 @@ using NBitcoin;
using
NTumbleBit.ClassicTumbler
;
using
NTumbleBit.ClassicTumbler
;
using
Stratis.Bitcoin
;
using
Stratis.Bitcoin
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.WatchOnlyWallet
;
namespace
Breeze.TumbleBit.Client
namespace
Breeze.TumbleBit.Client
{
{
...
@@ -17,6 +18,7 @@ namespace Breeze.TumbleBit.Client
...
@@ -17,6 +18,7 @@ namespace Breeze.TumbleBit.Client
{
{
private
ITumblerService
tumblerService
;
private
ITumblerService
tumblerService
;
private
readonly
IWalletManager
walletManager
;
private
readonly
IWalletManager
walletManager
;
private
readonly
IWatchOnlyWalletManager
watchOnlyWalletManager
;
private
readonly
ILogger
logger
;
private
readonly
ILogger
logger
;
private
readonly
Signals
signals
;
private
readonly
Signals
signals
;
private
readonly
ConcurrentChain
chain
;
private
readonly
ConcurrentChain
chain
;
...
@@ -26,15 +28,16 @@ namespace Breeze.TumbleBit.Client
...
@@ -26,15 +28,16 @@ namespace Breeze.TumbleBit.Client
private
ClassicTumblerParameters
TumblerParameters
{
get
;
set
;
}
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
.
walletManager
=
walletManager
;
this
.
watchOnlyWalletManager
=
watchOnlyWalletManager
;
this
.
chain
=
chain
;
this
.
chain
=
chain
;
this
.
signals
=
signals
;
this
.
signals
=
signals
;
this
.
network
=
network
;
this
.
network
=
network
;
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
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 />
/// <inheritdoc />
...
...
Breeze/src/Breeze.TumbleBit.Client/TumblingState.cs
View file @
049e63f6
...
@@ -10,6 +10,7 @@ using NTumbleBit.ClassicTumbler;
...
@@ -10,6 +10,7 @@ using NTumbleBit.ClassicTumbler;
using
NTumbleBit.PuzzlePromise
;
using
NTumbleBit.PuzzlePromise
;
using
NTumbleBit.PuzzleSolver
;
using
NTumbleBit.PuzzleSolver
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.WatchOnlyWallet
;
namespace
Breeze.TumbleBit.Client
namespace
Breeze.TumbleBit.Client
{
{
...
@@ -20,6 +21,7 @@ namespace Breeze.TumbleBit.Client
...
@@ -20,6 +21,7 @@ namespace Breeze.TumbleBit.Client
private
readonly
ILogger
logger
;
private
readonly
ILogger
logger
;
private
readonly
ConcurrentChain
chain
;
private
readonly
ConcurrentChain
chain
;
private
readonly
IWalletManager
walletManager
;
private
readonly
IWalletManager
walletManager
;
private
readonly
IWatchOnlyWalletManager
watchOnlyWalletManager
;
private
readonly
CoinType
coinType
;
private
readonly
CoinType
coinType
;
[
JsonProperty
(
"tumblerParameters"
)]
[
JsonProperty
(
"tumblerParameters"
)]
...
@@ -60,11 +62,13 @@ namespace Breeze.TumbleBit.Client
...
@@ -60,11 +62,13 @@ namespace Breeze.TumbleBit.Client
public
TumblingState
(
ILoggerFactory
loggerFactory
,
public
TumblingState
(
ILoggerFactory
loggerFactory
,
ConcurrentChain
chain
,
ConcurrentChain
chain
,
IWalletManager
walletManager
,
IWalletManager
walletManager
,
IWatchOnlyWalletManager
watchOnlyWalletManager
,
Network
network
)
Network
network
)
{
{
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
chain
=
chain
;
this
.
chain
=
chain
;
this
.
walletManager
=
walletManager
;
this
.
walletManager
=
walletManager
;
this
.
watchOnlyWalletManager
=
watchOnlyWalletManager
;
this
.
coinType
=
(
CoinType
)
network
.
Consensus
.
CoinType
;
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