<commit_before># bittiraha-walletd
Lightweight Bitcoin RPC compatible HD wallet

This project is meant as a drop-in replacement for bitcoind for use in lightweight servers.
For the moment, there is no support for bitcoind accounts. Parameters with account names are ignored.

If you need to access walletd from the command-line, one option is to use bitcoin-cli from bitcoind.

## Compiling
Developed with jdk 1.7.
All dependencies are included as .jar files under lib directory. A pull request with a working maven integration welcome.

Build process currently uses ant. To build, you can run the build script.
`sh build.sh`

## Running

Running requires a somewhat complex command, so the codebase includes run.sh script for that.
To start walletd, run:
`sh run.sh`

Walletd supports both mainnet and testnet. Default configuration will run both at once.
Wallet file for mainnet is `mainnet.wallet` and for testnet `testnet.wallet`.

## Configuration
There are two configuration files. One for mainnet `mainnet.conf` and one for testnet `testnet.conf`.
They will not be created automatically. a config file expressing the default settings would look like this
```
# start determines whether this network will be started. 1 means start, 0 means don't
start=1

# sendUnconfirmedChange determines whether walletd will consider unconfirmed change outputs spendable.
# 1 means they are spendable, 0 means they're not. You can use this to deal with malleability attack and
# to make your transactions look less risky to accept as 0-conf.
sendUnconfirmedChange=1

# targetCoinCount and targetCoinAmount control automatic splitting of change, which is helpful if sendUncofirmedChange
# is disabled. If you wish to disable the feature, set targetCoinCount to 0. Basically, walletd will split the change
# into more than one output when change is more than targetCoinAmount and there are less than targetCoinCount outputs
# of at least targetCoinAmount coins present in the wallet. Outputs smaller than targetCoinAmount will be counted as
# fractional outputs.
targetCoinCount=8
targetCoinAmount=0.5
```

## Working with the Wallet

If you wish to backup the wallet file itself, you can simply make a copy of the wallet file `mainnet.wallet`. The file
is in the default bitcoinj protobuf format and usable with many other bitcoinj tools.

The repository also includes a tool for manipulating bitcoinj wallet files. It's useful when you need to work with
the wallet file directly. For example if you want to make a backup of the wallet's seed or restore a wallet from
a seed. This tool was gratefully swiped from the bitcoinj repository.

### Backing up the wallet seed

Mainnet wallet: `sh wallet-tool.sh dump --wallet=mainnet.wallet --dump-privkeys | grep Seed`<commit_msg>modified docs<commit_after># bittiraha-walletd
Lightweight Bitcoin RPC compatible HD wallet

This project is meant as a drop-in replacement for bitcoind for use in lightweight servers.
For the moment, there is no support for bitcoind accounts. Parameters with account names are ignored.

If you need to access walletd from the command-line, one option is to use bitcoin-cli from bitcoind.

## Compiling
Developed with jdk 1.7.
All dependencies are included as .jar files under lib directory. A pull request with a working maven integration welcome.

Build process currently uses ant. To build, you can run the build script.
`sh build.sh`

## Running

Running requires a somewhat complex command, so the codebase includes run.sh script for that.
To start walletd, run:
`sh run.sh`

Walletd supports both mainnet and testnet. Default configuration will run both at once.
Wallet file for mainnet is `mainnet.wallet` and for testnet `testnet.wallet`.

## Configuration
There are two configuration files. One for mainnet `mainnet.conf` and one for testnet `testnet.conf`.
They will not be created automatically. a config file expressing the default settings would look like this
```
# start determines whether this network will be started. 1 means start, 0 means don't
start=1

# sendUnconfirmedChange determines whether walletd will consider unconfirmed change outputs spendable.
# 1 means they are spendable, 0 means they're not. You can use this to deal with malleability attack and
# to make your transactions look less risky to accept as 0-conf.
sendUnconfirmedChange=1

# targetCoinCount and targetCoinAmount control automatic splitting of change, which is helpful if sendUncofirmedChange
# is disabled. If you wish to disable the feature, set targetCoinCount to 0. Basically, walletd will split the change
# into more than one output when change is more than targetCoinAmount and there are less than targetCoinCount outputs
# of at least targetCoinAmount coins present in the wallet. Outputs smaller than targetCoinAmount will be counted as
# fractional outputs.
targetCoinCount=8
targetCoinAmount=0.5
```

## Working with the Wallet

If you wish to backup the wallet file itself, you can simply make a copy of the wallet file `mainnet.wallet`. The file
is in the default bitcoinj protobuf format and usable with many other bitcoinj tools.

The repository also includes a tool for manipulating bitcoinj wallet files. It's useful when you need to work with
the wallet file directly. For example if you want to make a backup of the wallet's seed or restore a wallet from
a seed. This tool was gratefully swiped from the bitcoinj repository.

### Creating wallet

Mainnet:
```
sh wallet-tool.sh create --wallet=mainnet.wallet
```

Testnet:
```
sh wallet-tool.sh create --wallet=testnet.wallet --net=TEST
```

These commands will create files mainnet.wallet and testnet.wallet, which will contain unencrypted wallet data.

### Backing up the wallet seed

Mainnet wallet: `sh wallet-tool.sh dump --wallet=mainnet.wallet --dump-privkeys | grep Seed`
{'fraction_non_alphanumeric': 0.048528652555498195, 'fraction_numerical': 0.0044742729306487695, 'mean_word_length': 4.637245392822503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4749279', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1476, 'n_words': 835}