* Replace AppConfig with more specific types
* Rework database configuration
In this commit we:
1) Introduce new database settings for all submodules,
and at the same time remove the singular datbase setting
for the entire project
2) Introduce a new method .initialize on all configs
that is responsible for creating needed directories,
databases and files
3) Introduce a new class BitcoinSAppConfig that wraps
configs for all three other subproject config. We
also provide implicit conversions that enable this
super-config to be passed in wherever a specialized
config is required.
4) Add more tests for our configuration setup.
* Add Ammonite to Docs deps
Every now and then the Scalatest framework
has crashed when reporting errors, with
failure to serialize this. There should
be no downside to having the trait here,
and we avoid the nasty Scalatest failure.
* WIP: 2018 12 22 node project (#280)
* Add files from old spv node project
src compiling
test files compiling
ran scalafmt
Fix serializer tests
Get non networking test cases to work
WIP: Debug peermessagehandler
Update CRUD, remove all of the Actor craziness. Add DbManagement trait and unit test db
WIP: Rewroking PeerMessageHandler, create Peer, DataMessageHandler, PeerHandler
Reworking Client to handle all tcp messages and message alignment for bitcoin p2p messages
* Wip: Node refactor
* Create node test project, move all node tests into that project and move all generators for the node project into testkit
* Rework ClientTest to use testkit, start minimizing akka usage, implement connect(),isConnected(), disconnect(), isDisconnected() in PeerMessageReceiver
* Create Peer, PeerHandler, PeerMessageSender and PeerMessageReceiver
* update readme about status of node project (#359)
* Add flyway plugin to manage database schemas (#361)
* Add flyway plugin to manage database schemas
* Switch database driver to sqlite3 to be more portable, rework configs for sqlite3
* Set up sqlite database directories and files if they are not already created
* Add torkel's review
* Add chain, wallet, db-commons projects (#367)
* Add chain, wallet, db-commons projects
* Rework db creation logic if they db does not exist
* Add config logging to try to debug travis ci
* Pass explicit class loader for db config
* Remove duplicate call to dbConfig
* Make DbConfig.dbConfig a lazy val
* Remove noisy log
* Add scaladoc to DbConfig
* Switch dbConfig readme paragraphs
* Fix compile issues introduced during rebase onto master with rpc changes (#394)
* WIP: 2019 03 12 tip validation (#378)
* Implement blockchain handling data structures
Add TipValidation happy path
Add more test cases for TipValidation.checkNewTip for badPrevBlockHash and badPOW
Add overflow check, fix endianness bug for checking proof of work
Add pow transition check, refactor difficultyChangeInterval into chain params, add more tests
fix a few nits
Fix compile error, clean up unused import
Remove redundant files from node project
* Implement GetNextWorkRequrired/CalculateNextWorkRequired, move BlockHeaderDAOTest cases into chain project
* Add full POW change check in TipValidation, address code review nits
* Configure logging in chainTest, turn logging OFF in other test projects
* Address code review pt2
* Add coverage minimum for chain project (#398)
* Add coverage minimum for chain project
* Add first Blockchain.connectTip() unit test, switch to a in memory sqlite database for unit tests, starting using fixtures for BlockHeaderDAO in unit tests
* Add tests for ChainHandler.processNewHeader(), ChainHandler.getHeader(), Blockchain.connectTip(). Refactor redundant configurations being passed around excessivly
* Address code review, fix a flaky test in ClientTest.scala
* Test Fixtures (#403)
* Working test fixtures
* Removed ChainTestFixture trait in main code
* Composing Fixtures (#413)
* Downloaded over 9000 mainnet BlockHeaders into a json file
* Added new fixture with populated blockHeaderDAO
* Split writing to db into batches
* Rebased
* Simplified fixtures with makeFixture abstraction
* Added util functions for composing builders
* Add integration test between bitcoind <-> zmq <-> bitcoin-s-chain project. Test that we can relay a header from bitcoind over zmq into the bitcoin-s chain project. Redo ZmqConfig to use InetSocketAddress
* Address code review
* wip
* A compiling withBitcoindZmqChainHandler fixture
* Tests passing!
* Made blockHeaderDAO private
* Got 9000 new block headers from 562375 to 571375
* Added offset to populated blockHeaderDAO fixture
* Added scaladocs to fixture things
* Initial wallet: import UTXO and spend it (#391)
* Updates ExtKeyVersion with fromChainParams method
* Add equals to Address
* Update BIP44 classes
* Add ScriptType
* Initial work on wallet support
* Add foreign keys pragma for SQLite
* Add UTXO models and DAO
* Add addres P2WPKH generation and WIP for addUTXO
* Add logging config for wallet
* Add change address generation, proper-ish addUtxo and sendToAddress
* Address code review on #391
* Add empty AES passphrase invariant
* Add poor mans test fixtures
* Add listUtxos, listAddresses and getBalance to wallet API
* Use fixtures from chain project
* Fix CI test failures
* Fix broken up package path
* Updates bloop config for new projects (#424)
* Multi fixture file (#419)
* Created FixtureTag and ChainFixture
Used ChainFixture in BitcoinPowTest
Added implicit conversions for nice syntactic sugar
* Added documentation for multi-fixture
* Made defaultTag a val
* add a logback-test.xml to the wallet project (#433)
* Introduce AppConfig that combines ChainParams and DbConfig (#432)
* 2019 04 23 app config per project db config per project (#434)
* Add DB conf file resolution that works across projects
* Create applicatoin configurations for specific projects, rework DbConfig structures for individual projects. Force network to be mixed into DbConfig rather than DbConfig to be mixed into the network
* Add ammonite to db-commons, remove noisy logs
* remove mixin for DbConfig that required a NetworkDb. Now networkDb is just a field on 'DbConfig', this simplifies things downstream type wise when interacting with the projects AppConfig. This commit also removes a parameter from AppConfig, now only a DbConfig needs to be passed in, and we can derive the network and chain params from the DbConfig. The only exemption is UnitTestDbConfig as it is sometimes handy to specify a different network (i.e. mainnet) when testing
* Turn DbConfig objects to case objects, wrap those case objects in their parent type companion object
* remove cast in Wallet.scala
* Add EnhancedEither class for 2.11 compat (#437)
Add implicit conversion from Either to
2.11-compatible Either-wrapper. Also
remove trailing comma in WalletTestUtil
that breaks 2.11 build.
* Fix CI tests hanging (#438)
* Execute wallet tests sequentially to avoid SQLite deadlocks
* Refactor logback config to reduce duplication
* Use in-memory SQLite DB for unit tests
* Debug prints for DatabaseConfig.forConfig
* Fork JVMs in test to ensure proper in-memory DBs
* Pass in Akka config to Eclair tests, avoid cluttering Akka log output
* Don't fork JVM on node tests'
* Move things out of ChainUnitTest (#448)
* Move things out of ChainUnitTest
* Remove printlns
* 2019 04 29 client test (#449)
* Bump timeout on connect to node test
* Change from isConnected -> isInitialized to avoid the error trying to disconnect before we are fully initialized
* Wrote tests for POW difficulty change calculation and header processing (#429)
Fixed BitcoinPowTest
Rebased onto AppConfig code
Rewrote ChainHandler integration test
Made chain handler test synchronous
Fixed a couple test bugs
Implmented a more efficient getAncestorByHeight
Fixed ChainHandler integration test by using the correct starting conditions
Responded to code review
Responded to more code review
Deleted redundant Pow test
Made BlockHeaderDAO.getAncestorAtHeight use a List for its loop to improve performance
* WIP: Create ChainSync, BitcoindChainHandlerViaRpc, add simple ChainSyncTes… (#450)
* Create ChainSync, BitcoindChainHandlerViaRpc, add simple ChainSyncTest to sync one block from a external bitcoind instance via rpc
* Add check for having the best block hash in our chain state already
* Fix prev block hash to be empty hash if genesis block header
* BlockchainBuilder (#439)
* First commit for implementing a BlockchainBuilder
* use Builder rather than ReusableBuilder to be compatible with scala 2.11.x
* Decouple Blockchain & BlockHeaderDAO
* Rebase onto node, incorporate changes in #429
* Add more comments
* Reverse order of headers in builder
* rebase onot node branch, refactor apis
* DB: Add utility method for listing tables in a DB (#447)
* Node rebase (#458)
* Implement BIP32 path diffing
* Rebase node onto newest HD changes in master
* Fix 2.11 compile errors
* 2019 05 01 wallet ammonite scripts pt2 (#452)
* wip -- not finding testkit in doc worksheet
Wip -- classdef not found for create-wallet.sc
zmq bug
Clean up some logs
nest zmq start in bitcoindF
update jeromq to 0.5.2-SNAPSHOT to get rid of annoying log to stdout
Rebase onto node branch with new configs
Successfully running ammonite script create-wallet.sc
2019 05 01 wallet ammonite scripts pt2 (#25)
* Refactor Ammonite dep
* Add basic error handling in AmmoniteBridge
* Add very basic README for doc project
Fix compile issues after rebasing onto master
Add code to sync our wallet code with bitcoind after creating a tx
* refactor ZMQSubscriber to _hopefully_ avoid hanging when we call context.term(). We do this by closing the socket before calling context.term() and using socket.setLinger()
* Update doc/src/main/scala/org/bitcoins/doc/wallet/create-wallet.sc
Co-Authored-By: Christewart <stewart.chris1234@gmail.com>
* 2019 05 05 sync chain (#460)
* Add code to sync our wallet code with bitcoind after creating a tx
Add script to illustrate how the chain persisted and how to sync against a running bitcoind instance on regtest
* fix bug relating to subtraction operator not being communative in Pow.getNextWorkRequired(). This kept us from being able to switch proof of work intervals correctly
* rename script from persist-chain.sc -> sync-chain.sc
* fix 2.11.x compile issues
* Refactor chain, node, wallet config (#463)
* Refactor chain, node, wallet config
Get rid of NetworkDb, DbConfig
Add proper structure to conf system,
moving everything under the bitcoin-s
root key.
* Remove Scalacheck from node project
* Add doc on configuration
* Add override feature to AppConfig
* Address code review in #463
* Throw if default data dir is used in tests, add Scaladoc to AppConfig
* Add explanations for withOverrides, link to configuration.md from AppConfig
* Fix compile error
* Moves chain fixtures to testkit project (#475)
reset node files
* Store encrypted mnemonic to disk (#462)
* Add WalletStorage object
* Add encrypted mnemonic storage, locked wallet
Add lock and unlock operations to wallet.
Separate between locked and unlock wallet.
* Handle non-existant seed file
* Respond to code review from Chris
* Use val instead of import
* Add doc on how mnemonics are encrypted/stored
* 2019 05 15 spv sync headers (#479)
* Implement SpvNode skeleton, create NodeUnitTest and move it to the testkit
* Implement test case to sync a header via spv into bitcoin-s
* Fix compiler errors
* Make node project Main runnable (#26)
* Add logging configuration to node project
* Make default config workable in non-test environments
* Add more logging of config in BH DAO and AppConfig
* Make Peer id optional
* Make node Main.scala runnable
* Implement Main.scala to sync with a locally running bitcoind instance. You can now run with 'bloop run node' and sync the node if you adjust the parameters inside of Main.scala. This also reworks the structure of 'AppConfig'. It turns the *AppConfig into a case class intead of case objects. This allows us to pass custom configs into those case classes
* Address code review from torkel
* Reintroduce withOverrides (#29)
* Turn off chain validation logs
* Make datadir a parameter to bitcoind config rather than having it implicitly written to the bitcoin.conf file. This was a difference that was occurring in the node branch which had a parameter for the datadir and master which was implicitly writing it to bitcoin.conf
* Add ability to overrwrite conf file except in the case of overwriting the DEFAULT_DATADIR & DEFAULT_CONF
* remove extra Bitcoind.stopServers in WalletIntegrationTest
* Add proper parsing of bitcoin.conf, remove datadir
Somewhat recently a new config format was introduced
in Bitcoin Core. Options can now be specified under
section headers ([regtest], [main], [test]), as
well as with network prefixes (regtest.rpcport,
main.prune) and the traditional format. In this commit
we introduce a new type BitcoindConfig that parses
this format. We also make the necessary changes in
the bitcoind/Eclair RPC clients to accomodate this new
type.
We also remove the datadir field from
BitcoindAuthCredentials. This is not strictly necessary
to connect to a bitcoind, so this is a bad separation
of concerns. The datadir field is instead moved into
the BitcoindInstance.
Finally we go over some places in tests and test
utils and assert that we are operating in the
user temporary directory. This is a safety measure
so that other developers/users won't do the same
mistake I did while working on this and accidentally
blow up their $HOME/.bitcoin directory.
* Add BitcoindRpcClient.fromDatadir
* Address code review from Chris
* Add BIP44 and BIP32 path support
Make paths from strings, indexes/coins/chains,
BIP32 children types.
Derive xprivs and xpubs from paths.
* Address code review on BIP44 from Chris
* Rename children -> path, bip32child -> bip32node
* update README with bip44 name changes
* Reduce number of requests we send to eclair in testkits, add commandName param to parseResult in EclairRpcClient
* Factor our EclairRpcClient error message
* Make jvm opts more sane, refactor error message code again
* Add error message on EclairRpcTestUtil.sendPayments, scalafmt
* Fix bug of sign issue when serializing r,s ln invoice signatures, we weren't using the proper sign in some rare cases. We always want the BigInteger to be non-negative for r,s
* Fixing initialization problem with EmptyDigitalSignature
* revert default Deps.scala bitcoinsV to published version
* Address code review nits
* remove negative ln currency unit test case
* Add BasicArithmetic to MilliSatoshis
* Add BasicArithmetic
* Add LnCurrencyUnit, CurrencyUnit, Number to BasicArithmetic
* Add tests for BasicArithmetic
* Make logger in unit test class protected and annotated
* Use BitcoinSUnitTest class
* Address code review
WIP: Refactoring EclairTestUtil to use Futures
Finished refactor EclairTestUtil to use futures
Address code review
fix async bug in chan opening
Change snapshot version to something that should compile
* version 0.0.3
* Fix cross compile issues so we can now compile and publish a dependency for the scala 2.11 series
scalafmt
* bump versions on readme, try to fix scoverage crossversion issue
* Downgrade scoverage to try and get it to work with ci
* Tinker with scoverage versions
* Add suggestion from scoverage people to exclude secp256k1jni from build coverage
Add documentation for TxBuilder
Try to fix links on core/README.md
add readme badges for bintray
Nits and formatting of README (#23)
ran scalafmt, fixed format in secp readme
* remove duplicate files in rpc,eclair-rpc and replace them with publish testkit dep
remove gen package, fix bugs in testkit generators that weren't properly copied for the gen project
* Adding bintray resolver, fixing bug in bech32 address generator where exception was being thrown because an unassigned witness spk was hash was being called
* Implementation of LnCurrencyUnit
Fix unary and unneeded comments.
Refactor and change arithmetic to use PicoBitcoins.
Add property based testing for LnCurrencyUnits
Refactor LnCurrencyUnits after code review
Fix case and change LnPolicy to val
Remove division and add Unit tests
* Add additional unit tests and deserialization
* WIP: Implement LnHumanReadablePart (#190)
* Initial Implementation of LnHumanReadablePart
* Add unit tests and improve deserialization from string
* Refactor LnParams and LnHrp. Add requirements for instantiating LnHrp.
* Clean up and re-organize things
Re-working LnHumanReadablePart.fromString
Fix unnecessary pattern match
Removing test case
* Created eclairRpc project (#193)
Added getinfo functionality
Added connect functionality
Added most of the rpcs
Added send and checkpayment functionality
Added updaterelayfee functionality
Fixed compile errors
Ran scalafmt
Added DaemonInstance and start/stop methods
Added TestUtil
Added open test
Fixed typo in allUpdates
Fixed ChannelResult
Add eclair prefix to rpc stuff
open channel unit test passing
Adding instructions to grab default eclair in build
Add zmq config to bitcoin.conf
rename test log files, bump timeouts on connections
Add eclair-rpc README, rework some RpcUtil/TestUtil stuff for async
fixing bug in precious block, addressing code review
Address more code review comments
* Add NodeId, NodeUri, ChannelId (#196)
refactor json serializing methods to SerializerUtil, add more types
* Adding LnCurrencyUnit types to rpc api, fixing bug where eclair tests were not binding to a random port for zmq (#198)
Remove start stuff
* Adding more rpc tests, testing open, payment over channel, and closing of the channel (#199)
Add checkpayment tests
Address code review, create EclairTestUtil.createNodPair
* Two way eclair transactions sanity test (#200)
* Added a test for sending payments in both directions
* Updated travis bitcoin core version
* Initial LnInvoice Implementation (#194)
Start typing some ln invoice stuff
Add support for Fallback Address encoding
Part 1: Breaking out Bech32 specific functions into a util class, don't embed in Bech32Address
re-naming fromBase8ToBase5 -> from8BitTo5bit
Part 1: Breaking out Bech32 specific functions into a util class, don't embed in Bech32Address
rework ln invoices tags
fix more method names in Bech32
Rename ScriptPubKeyTag -> NodeIdTag
All invoice tags tests passing except weird serialization order one
Address code review, add some more comments
rename 'LnInvoiceTags' -> 'LnInvoiceTaggedFields'
create a UInt5 type to represent all of the bech32 data structures
Passing all serialization in the BOLT11 examples
First cut at deserialization
* Adding bitcoin-s types to the eclair-rpc, fixing bug with decoding numbers, refactoring more things (#204)
* Switch bech32 p2wpkh hash from RipdeMd160 -> Sha256Hash160Digest (#206)
* Add testkit project / dependency (#209)
fix core-gen build.sbt name
* add correct dependencies to testkit (#210)
* Get dep name right (#211)
* Add serialization symmetry property for LnInvoice, fixing various bugs in LnInvoice data structures, adding generators for various LnInvoice data structures (#217)
* Reworking AuthCredentials and Instances so that we can read from config files (#218)
add core files that were missing
* Reworking a lot of testkit data structures to be more helpful for testing (#219)
Add missing EclairApi file
remove noisy log
* Rebase onto master, fix testkit compile issues
* Simplify LnCurrencyUnit, add MilliSatoshis, refactor EclairRpc to use… (#226)
* Simplify LnCurrencyUnit, add MilliSatoshis, refactor EclairRpc to use MilliSatoshis
* Add some helper functions around millisatoshis for comparing them to other things
* more tests / helper methods, at generator for millisatoshis
* Fix typo
* Fix comparison operators for millisatoshis, add Writes for MilliSatos… (#227)
* Fix comparison operators for millisatoshis, add Writes for MilliSatoshis in JsonWriters
* re-add comparison operators to LnCurrencyUnit for convinience
* Add millisatoshi reads (#228)
* Updating version of eclair to https://github.com/ACINQ/eclair/releases/download/v0.2-beta8/eclair-node-0.2-beta8-52821b8.jar (#229)
* Derive nodeId from ln invoice signature, move nodeid case class into … (#230)
* Derive nodeId from ln invoice signature, move nodeid case class into the core project
* Add missing assert
* Fix null pointer exception that could occurred during requiring the invoice's signature to valid. This could occurr if a user tried to construct an invoice with an invalid signature (#233)
* Turn down logging / remove logging (#235)
* Cleaned up eclair conf (#237)
* Cleaned up eclair conf
* Added test for bad auth and Reads for LnInvoice
* WIP: rebase onto master with new compiler opts
fix more compiler warnings with testkit
* fix new compiler warnings for scalac 2.12.x on ln (#253)
* fix new compiler warnings for scalac 2.12.x on ln
* fix missing p2wpkhoutput in rawoutput testkit/CreditingTxGen.scala
* First cut at code review for the ln branch (#258)
Fix bug in parsing the LnTagPrefix.CltvExpiry, add properties that check if the NodeIdTag is given explicitly to the invoice
remove dumb invariants
revert version
* 2018 12 4 ln code review rd2 (#259)
* Amend EclairRpc test case for confirming that channel is closed
* Add final check to test case to make sure the bitcoind wallet received funds when closing channel
* Address Torkel's code review
* Addresses some review on #256 (#260)
* Docstring cleanup, small nits
* Refactors some redudant data, nested if => switch
* Fixes SO error by reversing remowal of `new`
* Fixes a couple of bugs
* map.get instead of list.find
* StringBuilder in HRP
* Rework NetworkParam to LnParam
* Cleanup
* Renames file to match trait/object name
* Docstring cleanup, pure formatting
* Simplifies a few expressions, doesn't change semantics
* Adds overloaded findRoute method instead of Either[NodeId, LnInvoice]
* Eclair cleanup
* Address concerns from Chris
* Type annotation to match case
* Address nadav's code review