mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
contrib/localnet/darkfid-singe-node: updated to work with latest darkfid
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
faucetd/blockchain
|
||||
darkfid0
|
||||
darkfid
|
||||
drk
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
darkfid localnet
|
||||
================
|
||||
|
||||
This will start one darkfid node in single-node mode and a faucet node.
|
||||
This will start one darkfid node in localnet mode,
|
||||
along with a minerd daemon to mine blocks.
|
||||
|
||||
If we want to test wallet stuff, we must generate
|
||||
a testing wallet and pass its address to the darkfid
|
||||
config, so the wallet gets the block rewards the node
|
||||
produces. First we start darkfid and wait until its
|
||||
initialized:
|
||||
```
|
||||
% ./tmux_sessions.sh
|
||||
```
|
||||
|
||||
In another terminal, we generate a wallet, set it as
|
||||
the default and grab its address:
|
||||
```
|
||||
% ../../../drk -c drk.toml wallet --initialize
|
||||
% ../../../drk -c drk.toml wallet --keygen
|
||||
% ../../../drk -c drk.toml wallet --default-address 1
|
||||
% ../../../drk -c drk.toml wallet --address
|
||||
```
|
||||
Then we replace the `recipient` field in `darkfid.toml`
|
||||
config with the output of the last command, and restart
|
||||
the daemon. After some blocks have been generated we
|
||||
will see some `DRK` in our test wallet.
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
#!/bin/sh
|
||||
rm -rf darkfid0 faucetd/blockchain
|
||||
git checkout faucetd/wallet.db
|
||||
rm -rf darkfid drk
|
||||
|
||||
57
contrib/localnet/darkfid-single-node/darkfid.toml
Normal file
57
contrib/localnet/darkfid-single-node/darkfid.toml
Normal file
@@ -0,0 +1,57 @@
|
||||
## darkfid configuration file
|
||||
##
|
||||
## Please make sure you go through all the settings so you can configure
|
||||
## your daemon properly.
|
||||
##
|
||||
## The default values are left commented. They can be overridden either by
|
||||
## uncommenting, or by using the command-line.
|
||||
|
||||
# JSON-RPC listen URL
|
||||
rpc_listen = "tcp://127.0.0.1:48340"
|
||||
|
||||
# Blockchain network to use
|
||||
network = "localnet"
|
||||
|
||||
# Localnet blockchain network configuration
|
||||
[network_config."localnet"]
|
||||
# Path to the blockchain database directory
|
||||
database = "darkfid"
|
||||
|
||||
# Finalization threshold, denominated by number of blocks
|
||||
threshold = 3
|
||||
|
||||
# minerd JSON-RPC endpoint
|
||||
minerd_endpoint = "tcp://127.0.0.1:48467"
|
||||
|
||||
# PoW block production target, in seconds
|
||||
pow_target = 10
|
||||
|
||||
# Optional fixed PoW difficulty, used for testing
|
||||
pow_fixed_difficulty = 1
|
||||
|
||||
# Participate in block production
|
||||
miner = true
|
||||
|
||||
# Wallet address to receive mining rewards.
|
||||
# This is a dummy one so the miner can start,
|
||||
# replace with your own one.
|
||||
recipient = "9vw6WznKk7xEFQwwXhJWMMdjUPi3cXL8NrFKQpKifG1U"
|
||||
|
||||
# Skip syncing process and start node right away
|
||||
skip_sync = true
|
||||
|
||||
## Localnet sync P2P network settings
|
||||
[network_config."localnet".sync_net]
|
||||
# P2P accept addresses the instance listens on for inbound connections
|
||||
inbound = ["tcp+tls://0.0.0.0:48242"]
|
||||
|
||||
# Allow localnet hosts
|
||||
localnet = true
|
||||
|
||||
## Localnet miners P2P network settings
|
||||
[network_config."localnet".miners_net]
|
||||
# P2P accept addresses the instance listens on for inbound connections
|
||||
inbound = ["tcp+tls://0.0.0.0:48241"]
|
||||
|
||||
# Allow localnet hosts
|
||||
localnet = true
|
||||
@@ -1,77 +0,0 @@
|
||||
## darkfid configuration file
|
||||
##
|
||||
## Please make sure you go through all the settings so you can configure
|
||||
## your daemon properly.
|
||||
##
|
||||
## The default values are left commented. They can be overridden either by
|
||||
## uncommenting, or by using the command-line.
|
||||
|
||||
# Chain to use (testnet, mainnet)
|
||||
chain = "testnet"
|
||||
|
||||
# Path to the wallet database
|
||||
wallet_path = "darkfid0/wallet.db"
|
||||
|
||||
# Password for the wallet database
|
||||
wallet_pass = "changeme"
|
||||
|
||||
# Path to the blockchain database directory
|
||||
database = "darkfid0/blockchain"
|
||||
|
||||
# JSON-RPC listen url
|
||||
rpc_listen = "tcp://127.0.0.1:8340"
|
||||
|
||||
# Participate in the consensus protocol
|
||||
consensus = true
|
||||
|
||||
# Enable single-node mode for local testing
|
||||
single_node = true
|
||||
|
||||
# P2P accept addresses for the consensus protocol
|
||||
consensus_p2p_accept = ["tcp://127.0.0.1:8341"]
|
||||
|
||||
# P2P external addresses for the consensus protocol
|
||||
consensus_p2p_external = ["tcp://127.0.0.1:8341"]
|
||||
|
||||
# Connection slots for the consensus protocol
|
||||
#consensus_slots = 8
|
||||
|
||||
# Connection slots for the consensus protocol
|
||||
#consensus_p2p_seed = []
|
||||
|
||||
# Peers to connect to for the consensus protocol
|
||||
#consensus_p2p_peer = []
|
||||
|
||||
|
||||
# Prefered transports of outbound connections for the consensus protocol
|
||||
consensus_p2p_transports = ["tls", "tcp"]
|
||||
|
||||
# P2P accept addresses for the syncing protocol
|
||||
sync_p2p_accept = ["tcp://127.0.0.1:8342"]
|
||||
|
||||
# P2P external addresses for the syncing protocol
|
||||
sync_p2p_external = ["tcp://127.0.0.1:8342"]
|
||||
|
||||
# Connection slots for the syncing protocol
|
||||
#sync_slots = 8
|
||||
|
||||
# Seed nodes to connect to for the syncing protocol
|
||||
#sync_p2p_seed = []
|
||||
|
||||
# Peers to connect to for the syncing protocol
|
||||
#sync_p2p_peer = []
|
||||
|
||||
# Prefered transports of outbound connections for the syncing protocol
|
||||
sync_p2p_transports = ["tls", "tcp"]
|
||||
|
||||
# Enable localnet hosts
|
||||
localnet = true
|
||||
|
||||
# Enable channel log
|
||||
channel_log = true
|
||||
|
||||
# Whitelisted faucet public key
|
||||
faucet_pub = ["DqaZzCTipXeJw4kcc6ro1SJuzo3diaNjFiaAnKTGQEK1"]
|
||||
|
||||
# Verify system clock is correct
|
||||
#clock_sync = true
|
||||
16
contrib/localnet/darkfid-single-node/drk.toml
Normal file
16
contrib/localnet/darkfid-single-node/drk.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
## drk configuration file
|
||||
##
|
||||
## Please make sure you go through all the settings so you can configure
|
||||
## your daemon properly.
|
||||
##
|
||||
## The default values are left commented. They can be overridden either by
|
||||
## uncommenting, or by using the command-line.
|
||||
|
||||
# Path to wallet database
|
||||
wallet_path = "drk/wallet.db"
|
||||
|
||||
# Password for the wallet database
|
||||
wallet_pass = "testing"
|
||||
|
||||
# darkfid JSON-RPC endpoint
|
||||
endpoint = "tcp://127.0.0.1:48340"
|
||||
@@ -1,55 +0,0 @@
|
||||
## faucetd configuration file
|
||||
##
|
||||
## Please make sure you go through all the settings so you can configure
|
||||
## your daemon properly.
|
||||
##
|
||||
## The default values are left commented. They can be overridden either by
|
||||
## uncommenting, or by using the command-line.
|
||||
|
||||
# Chain to use (testnet, mainnet)
|
||||
chain = "testnet"
|
||||
|
||||
# Path to the wallet database
|
||||
wallet_path = "faucetd/wallet.db"
|
||||
|
||||
# Password for the wallet database
|
||||
wallet_pass = "changeme"
|
||||
|
||||
# Path to the blockchain database directory
|
||||
database = "faucetd/blockchain"
|
||||
|
||||
# JSON-RPC listen URL
|
||||
rpc_listen = "tcp://127.0.0.1:8440"
|
||||
|
||||
# P2P accept addresses for the syncing protocol
|
||||
sync_p2p_accept = ["tcp://127.0.0.1:8442"]
|
||||
|
||||
# P2P external addresses for the syncing protocol
|
||||
sync_p2p_external = ["tcp://127.0.0.1:8442"]
|
||||
|
||||
# Connection slots for the syncing protocol
|
||||
#sync_slots = 8
|
||||
|
||||
# Seed nodes to connect to for the syncing protocol
|
||||
#sync_p2p_seed = []
|
||||
|
||||
# Peers to connect to for the syncing protocol
|
||||
sync_p2p_peer = ["tcp://127.0.0.1:8342"]
|
||||
|
||||
# Prefered transports of outbound connections for the syncing protocol
|
||||
sync_p2p_transports = ["tls", "tcp"]
|
||||
|
||||
# Enable localnet hosts
|
||||
localnet = true
|
||||
|
||||
# Enable channel log
|
||||
channel_log = true
|
||||
|
||||
# Airdrop timeout limit in seconds
|
||||
airdrop_timeout = 120
|
||||
|
||||
# Airdrop amount limit
|
||||
airdrop_limit = "1000000"
|
||||
|
||||
# Whitelisted faucet addresses
|
||||
faucet_pub = ["DqaZzCTipXeJw4kcc6ro1SJuzo3diaNjFiaAnKTGQEK1"]
|
||||
Binary file not shown.
10
contrib/localnet/darkfid-single-node/minerd.toml
Normal file
10
contrib/localnet/darkfid-single-node/minerd.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
## minerd configuration file
|
||||
##
|
||||
## Please make sure you go through all the settings so you can configure
|
||||
## your daemon properly.
|
||||
##
|
||||
## The default values are left commented. They can be overridden either by
|
||||
## uncommenting, or by using the command-line.
|
||||
|
||||
# JSON-RPC listen URL
|
||||
rpc_listen = "tcp://127.0.0.1:48467"
|
||||
@@ -3,14 +3,12 @@ set -e
|
||||
set -x
|
||||
|
||||
# Path to `drk` binary
|
||||
DRK="../../../drk"
|
||||
DRK="../../../drk -c drk.toml"
|
||||
|
||||
# First run the consensus node and the faucet:
|
||||
#
|
||||
# ./tmux_sessions.sh now && cd ../../../ && make darkfid faucetd && cd -
|
||||
# ./clean.sh
|
||||
# ./tmux_sessions.sh -v
|
||||
# ./sync-wallet.sh
|
||||
# ./tmux_sessions.sh -vv
|
||||
#
|
||||
# In another term run the wallet syncing:
|
||||
#
|
||||
|
||||
@@ -3,7 +3,7 @@ set -e
|
||||
set -x
|
||||
|
||||
# Path to `drk` binary
|
||||
DRK="../../../drk"
|
||||
DRK="../../../drk -vv -c drk.toml"
|
||||
|
||||
while true; do
|
||||
if $DRK ping 2> /dev/null; then
|
||||
@@ -12,7 +12,5 @@ while true; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
$DRK wallet --initialize
|
||||
$DRK scan
|
||||
$DRK subscribe blocks
|
||||
|
||||
$DRK subscribe
|
||||
|
||||
@@ -1,31 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Start a tmux session with a consensus nodes and a faucet that's able to mint tokens.
|
||||
# Start a tmux session with a minerd daemon and a darkfid node
|
||||
|
||||
if [ "$1" = "-v" ]; then
|
||||
verbose="-v"
|
||||
if [ "$1" = "-vv" ]; then
|
||||
verbose="-vv"
|
||||
shift
|
||||
else
|
||||
verbose=""
|
||||
fi
|
||||
|
||||
if [ "$1" = "now" ]; then
|
||||
now="$(date +%s)"
|
||||
|
||||
sed \
|
||||
-e 's/pub const SLOT_TIME: .*/pub const SLOT_TIME: u64 = 20;/' \
|
||||
-e 's/pub const FINAL_SYNC_DUR: .*/pub const FINAL_SYNC_DUR: u64 = 15;/' \
|
||||
-e "s/pub static ref TESTNET_GENESIS_TIMESTAMP: .*/pub static ref TESTNET_GENESIS_TIMESTAMP: Timestamp = Timestamp($now);/" \
|
||||
-e "s/pub static ref TESTNET_BOOTSTRAP_TIMESTAMP: .*/pub static ref TESTNET_BOOTSTRAP_TIMESTAMP: Timestamp = Timestamp($now);/" \
|
||||
-i ../../../src/consensus/constants.rs
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
tmux new-session -d
|
||||
tmux send-keys "LOG_TARGETS='!sled,!net' ../../../darkfid ${verbose} -c darkfid0.toml" Enter
|
||||
sleep 10
|
||||
tmux send-keys "../../../minerd ${verbose} -c minerd.toml" Enter
|
||||
sleep 1
|
||||
tmux split-window -v
|
||||
tmux send-keys "LOG_TARGETS='!sled,!net' ../../../faucetd ${verbose} -c faucetd.toml" Enter
|
||||
tmux send-keys "LOG_TARGETS='!sled,!net' ../../../darkfid ${verbose} -c darkfid.toml" Enter
|
||||
tmux attach
|
||||
|
||||
Reference in New Issue
Block a user