Skip to content

Commit 874834f

Browse files
committedJul 15, 2024
switch to signet, add signet docker config
1 parent 6552ce5 commit 874834f

File tree

14 files changed

+56
-51
lines changed

14 files changed

+56
-51
lines changed
 

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ taptrade-cli-demo/target
33
taptrade-cli-demo/coordinator/target
44
taptrade-cli-demo/coordinator/dbs/*
55
taptrade-cli-demo/trader/target
6+
taptrade-cli-demo/rpc_node/testnet4/testnet4node
7+
taptrade-cli-demo/rpc_node/testnet3/data
8+
taptrade-cli-demo/rpc_node/signet/data

‎docs/TapTrade_obs/.obsidian/workspace.json

+11-8
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
"id": "bdb9fd88a01a8909",
1212
"type": "leaf",
1313
"state": {
14-
"type": "markdown",
14+
"type": "canvas",
1515
"state": {
16-
"file": "Research/Bitcoin fundamentals/Knowledge sources.md",
17-
"mode": "source",
18-
"source": false
16+
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
17+
"viewState": {
18+
"x": 31,
19+
"y": -44.99563086871524,
20+
"zoom": -0.432684559607355
21+
}
1922
}
2023
}
2124
}
@@ -85,7 +88,7 @@
8588
"state": {
8689
"type": "backlink",
8790
"state": {
88-
"file": "Research/Bitcoin fundamentals/Knowledge sources.md",
91+
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
8992
"collapseAll": false,
9093
"extraContext": false,
9194
"sortOrder": "alphabetical",
@@ -102,7 +105,7 @@
102105
"state": {
103106
"type": "outgoing-link",
104107
"state": {
105-
"file": "Research/Bitcoin fundamentals/Knowledge sources.md",
108+
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
106109
"linksCollapsed": false,
107110
"unlinkedCollapsed": true
108111
}
@@ -125,7 +128,7 @@
125128
"state": {
126129
"type": "outline",
127130
"state": {
128-
"file": "Research/Bitcoin fundamentals/Knowledge sources.md"
131+
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas"
129132
}
130133
}
131134
}
@@ -148,8 +151,8 @@
148151
},
149152
"active": "bdb9fd88a01a8909",
150153
"lastOpenFiles": [
151-
"Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
152154
"Research/Trade Pipelines/new concepts/concept pipeline 1.canvas",
155+
"Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
153156
"Research/Bitcoin fundamentals/Knowledge sources.md",
154157
"assets/ptlc2.png",
155158
"assets/ptlc.png",

‎docs/TapTrade_obs/Research/Trade Pipelines/new concepts/concept pipeline 1.canvas

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{"id":"9b054e655a321517","type":"text","text":"PSBT of contract\nMaker adds escrow input sig\n\nMaker only gets PSBT without the Sig of the Taker, so he can't maliciously hold the tx and publish it at a later point in time.","x":-345,"y":980,"width":295,"height":210},
2222
{"id":"345fbda43e40d028","type":"text","text":"Research/use PTLC","x":580,"y":41,"width":250,"height":50,"color":"2"},
2323
{"id":"7916e1f2236a38b6","type":"text","text":"Look into DLC negotiation procedure\nhttps://github.com/discreetlogcontracts/dlcspecs/blob/9cd9148938c616690c79d99ec6f330e213c246c5/Protocol.md","x":5,"y":500,"width":515,"height":140,"color":"4"},
24-
{"id":"5e3c3c0695787e9a","type":"text","text":"User (Tor)Browser (Wasm)","x":-720,"y":-69,"width":305,"height":60,"color":"3"},
24+
{"id":"5e3c3c0695787e9a","type":"text","text":"User (Tor)Browser (Wasm)","x":-720,"y":-69,"width":305,"height":69,"color":"3"},
2525
{"id":"483fbdbcc5ea8501","type":"text","text":"I think there could be an advanced mode / external wallet mode where this could be done directly from an external Wallet e.g. Hardware wallet with Sparrow. But it would require lot of copy pasting (signed txs, psbts, addresses). Also there is secret state needed to be saved for MuSig2, this could be downloaded as file or stored encrypted on the coordinator. \n\nFor easy use there would need to be a wallet in RoboSats (BDK) but UI wise this would be either a challenge or a privacy reduction (if you use the same wallet but different Robot). It's also possible to limit the Wallet to one robot so the user must withdraw the sats after the trade (can't import wallet into robosats, only export). I think wallet could also be stored encrypted on coordinator or exported as file/seed.","x":55,"y":-549,"width":660,"height":338},
2626
{"id":"f3b7288289dc8954","type":"text","text":"Backend","x":195,"y":-172,"width":250,"height":60,"color":"3"},
2727
{"id":"93c73227c82f1a81","type":"text","text":"**Coordinator**\n\nwatches Mempool and Chain, could publish the bond TX. Essentially just to prevent orderbook spam / for skin in the game.\n\n*SIGHASH_ALL | ANYONECANPAY* could make it possible for the coordinator to add inputs up to the height of the bond to push the TX fees without losing capital itself. \nAlso out of band mining would cause a cost for the Maker so there is always a price to being unreliable. \n\nThe Maker could be required to use Inputs at least the value of the trade amount to proof that he owns enough sats to fulfill the trade. Maybe lock the time to invalidate the bond after a certain amount of time.","x":80,"y":-98,"width":500,"height":418},

‎taptrade-cli-demo/bitcoin-testnet4-node/docker-compose.yml

-14
This file was deleted.

‎taptrade-cli-demo/coordinator/.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
BITCOIN_RPC_ADDRESS_PORT="127.0.0.1:18332"
2-
BITCOIN_RPC_COOKIE_FILE_PATH="~/.bitcoin/.cookie" # path to the cookie file for the bitcoind RPC
1+
BITCOIN_RPC_ADDRESS_PORT="127.0.0.1:8332"
2+
BITCOIN_RPC_COOKIE_FILE_PATH="./.cookie" # path to the cookie file for the bitcoind RPC
33
BITCOIN_RPC_WALLET_NAME="coordinator_wallet" # not used yet
44
DATABASE_PATH="./dbs/trades.db" # path to the coordinator sqlite database storing the trades
55
BDK_DB_PATH="./dbs/bdk-wallet" # Path to the BDK Sled database (no .db postfix)
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pub mod monitoring;
2-
pub mod create_taproot; // commented out for testing
2+
// pub mod create_taproot; // commented out for testing
33

44
use super::*;

‎taptrade-cli-demo/coordinator/src/wallet/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn init_coordinator_wallet() -> Result<CoordinatorWallet<sled::Tree>> {
4040
auth: Auth::Cookie {
4141
file: env::var("BITCOIN_RPC_COOKIE_FILE_PATH")?.into(),
4242
},
43-
network: bdk::bitcoin::Network::Testnet,
43+
network: bdk::bitcoin::Network::Signet,
4444
wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
4545
sync_params: None,
4646
};
@@ -51,13 +51,13 @@ pub fn init_coordinator_wallet() -> Result<CoordinatorWallet<sled::Tree>> {
5151
let wallet = Wallet::new(
5252
Bip86(wallet_xprv, KeychainKind::External),
5353
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
54-
bitcoin::Network::Testnet,
54+
bitcoin::Network::Signet,
5555
sled_db,
5656
)?;
5757

58-
wallet
59-
.sync(&backend, SyncOptions::default())
60-
.context("Connection to electrum server failed.")?; // we could also use Esplora to make this async
58+
// wallet
59+
// .sync(&backend, SyncOptions::default())
60+
// .context("Connection to electrum server failed.")?; // we could also use Esplora to make this async
6161
dbg!(wallet.get_balance()?);
6262
Ok(CoordinatorWallet {
6363
wallet: Arc::new(Mutex::new(wallet)),
@@ -266,7 +266,7 @@ mod tests {
266266
auth: Auth::Cookie {
267267
file: env::var("BITCOIN_RPC_COOKIE_FILE_PATH").unwrap().into(),
268268
},
269-
network: bdk::bitcoin::Network::Testnet,
269+
network: bdk::bitcoin::Network::Signet,
270270
wallet_name: env::var("BITCOIN_RPC_WALLET_NAME").unwrap(),
271271
sync_params: None,
272272
};
@@ -277,7 +277,7 @@ mod tests {
277277
let wallet = Wallet::new(
278278
Bip86(wallet_xprv, KeychainKind::External),
279279
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
280-
Network::Testnet,
280+
Network::Signet,
281281
MemoryDatabase::new(),
282282
)
283283
.unwrap();

‎taptrade-cli-demo/coordinator/src/wallet/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl BondTx for Transaction {
4141

4242
fn bond_output_sum(&self, bond_address: &str) -> Result<u64> {
4343
let bond_script = Address::from_str(bond_address)?
44-
.require_network(Network::Testnet)?
44+
.require_network(Network::Signet)?
4545
.script_pubkey();
4646

4747
for output in self.output.iter() {
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
[testnet4]
21
server=1
32
txindex=1
4-
rpcbind=127.0.0.1
5-
rpcallowip=127.0.0.1
6-
rpcport=18332
3+
74
# Authentication
8-
rpcauth=
5+
rpcauth=XXX:1234
96
# generator: https://jlopp.github.io/bitcoin-core-rpc-auth-generator/
107
# Cookie file authentication
11-
rpccookiefile=/home/user/.bitcoin/.cookie
8+
rpccookiefile=/home/bitcoin/.bitcoin/.cookie
129
# Increase the number of connections
1310
maxconnections=15
1411
# Set the maximum number of transactions to keep in the memory pool
1512
maxmempool=300
13+
# Run this node on the Bitcoin Test Network. Equivalent to -chain=test
14+
signet=1
15+
[signet]
16+
rpcbind=0.0.0.0
17+
rpcallowip=0.0.0.0/0
18+
rpcport=8332
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
bitcoin:
3+
container_name: bitcoin
4+
image: dobtc/bitcoin
5+
ports:
6+
- 8332:8332
7+
volumes:
8+
- ./bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf
9+
- ./data/:/home/bitcoin/.bitcoin
10+

‎taptrade-cli-demo/trader/maker.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ELECTRUM_ENDPOINT="ssl://mempool.space:40002" # testnet 4 electrum server
1+
ELECTRUM_ENDPOINT="ssl://mempool.space:60602" # signet electrum server
22
COORDINATOR_ENDPOINT="http://127.0.0.1:9999"
33
ROBOHASH_HEX="26ee3dee4815655d223c3505162fd4610294a9542f89bb3d3e9748f534ac10ae" # sha256 of "robot21"
44
TRADE_TYPE="buy"

‎taptrade-cli-demo/trader/src/wallet/bond.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Bond {
3333
debug!("Assembling bond transaction");
3434
// parse bond locking address as Address struct and verify network is testnet
3535
let address: Address =
36-
Address::from_str(&bond_target.bond_address)?.require_network(Network::Testnet)?;
36+
Address::from_str(&bond_target.bond_address)?.require_network(Network::Signet)?;
3737

3838
// build bond locking transaction. Use coin selection to add at least enough outputs
3939
// to have the full trading sum as change as evidence for the coordinator that the maker owns
@@ -53,10 +53,10 @@ impl Bond {
5353
builder.finish()?
5454
};
5555
debug!("Signing bond transaction.");
56-
// let finalized = wallet.sign(&mut psbt, SignOptions::default())?; // deactivated to test bond validation
57-
// if !finalized {
58-
// return Err(anyhow!("Transaction could not be finalized"));
59-
// };
56+
let finalized = wallet.sign(&mut psbt, SignOptions::default())?; // deactivated to test bond validation
57+
if !finalized {
58+
return Err(anyhow!("Transaction could not be finalized"));
59+
};
6060
Ok(psbt)
6161
}
6262
}
@@ -84,7 +84,7 @@ mod tests {
8484
let wallet = Wallet::new(
8585
Bip86(wallet_xprv, KeychainKind::External),
8686
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
87-
Network::Testnet,
87+
Network::Signet,
8888
MemoryDatabase::default(),
8989
)
9090
.unwrap();

‎taptrade-cli-demo/trader/src/wallet/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct TradingWallet {
2727

2828
pub fn get_wallet_xprv(xprv_input: Option<String>) -> Result<ExtendedPrivKey> {
2929
let xprv: ExtendedPrivKey;
30-
let network: Network = Network::Testnet;
30+
let network: Network = Network::Signet;
3131

3232
if let Some(xprv_i) = xprv_input {
3333
xprv = ExtendedPrivKey::from_str(&xprv_i)?;
@@ -45,7 +45,7 @@ impl TradingWallet {
4545
let wallet = Wallet::new(
4646
Bip86(trader_config.wallet_xprv, KeychainKind::External),
4747
Some(Bip86(trader_config.wallet_xprv, KeychainKind::Internal)),
48-
bitcoin::Network::Testnet,
48+
bitcoin::Network::Signet,
4949
MemoryDatabase::default(), // non-permanent storage
5050
)?;
5151

‎taptrade-cli-demo/trader/taker.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ELECTRUM_ENDPOINT="ssl://mempool.space:40002" # testnet 4 electrum server
1+
ELECTRUM_ENDPOINT="ssl://mempool.space:60602" # signet electrum server
22
COORDINATOR_ENDPOINT="http://127.0.0.1:9999"
33
ROBOHASH_HEX="169b6049cf865eba7d01e1ad26975f1d5ff29d570297ff18d40a53c8281dff5d" # sha256 of "robot22"
44
TRADE_TYPE="sell"
5-
PAYOUT_ADDRESS="tb1p37qg73t5y0l4un3q5dknzl8fgfhemghaap67wns45pzgrw2tasrq6kesxm"
5+
PAYOUT_ADDRESS="tb1pca4thykxsj4ura8h2pj3zx7v9hzlcvlw9k32u8m0vqs6mxp02c9qr9eup6"
66
BOND_RATIO=5
77
XPRV="tprv8ZgxMBicQKsPdHuCSjhQuSZP1h6ZTeiRqREYS5guGPdtL7D1uNLpnJmb2oJep99Esq1NbNZKVJBNnD2ZhuXSK7G5eFmmcx73gsoa65e2U32" # wallet xprv
88
OFFER_DURATION_HOURS=48

0 commit comments

Comments
 (0)
Please sign in to comment.