* Update scalafmt-core to 2.6.0
* Upgrade scalafmt, fix all formatting errors
* Scalafmt on 2.12
* fix test
* More fixes
Co-authored-by: Ben Carman <benthecarman@live.com>
* Implement unit test cases for initializing a wallet twice, and failing with an exception when we initialize a wallet with a different key-manager
* Use bip39PasswordOpt cached in the WalletUnitTest suite
* Turn off logging
* Run scalafmt
* Turn log level back to WARN
* Run scalafmt
* Made the standard non-interactive tx finalizer simple using composition of its (reusable) pieces
* Responded to code review and made minor improvements
* Fixed docs
* Refactored Transaction
Created RawTxBuilder
Created RawTxFinalizer as layer on top of RawTxBuilder
Introduced RawTxSigner and replaced TxBuilder!
Deleted TxBuilder!
* fixed things after rebase
* Made RawTxBuilder compatible with older versions of scala
* Began responding to review
* Made Finalizer take a Builder rather than the other way around
* Added composition for finalizers
* Ran scalafmt
* Updated txbuilder example documentation
* Moved tests from old TxBuilderTest files to relevant new test files
* Added scaladocs
Added OutputReference and introduced public key computation on SPKs
Made InputInfo into an ADT
Made UTXOSpendingInfo use InputInfo
Replaced UTXOSpendingInfo with NewSpendingInfo and got non-test things compiling
Made aliases for (NewSpendingInfo/NewSpendingInfoFull/NewSpendingInfoSingle)[InputInfo]
Got rid of source code mention of UTXOSpendingInfo
sbt compile passes
tests compile
Fixed all coreTest tests
Renamed to UTXOInfo
Some cleanup
Moved redeem script and script witness accessors to companion object
Responded to code review
Added OutputReference and scaladocs
Moved p2pkhPreImageOpt downstream and generalized to hashPreImages
Fixed adding-spks.md
Fixed psbts.md and txbuilder.md
Renamed UTXOInfo
Apply renaming to docs
* Added crypto project and decoupled BitcoinSLogger from NetworkElement
Decoupled BitcoinSLogger from Factory
Moved NetworkElement into crypto project
Moved Factory and BitcoinSUtil (renamed to BytesUtil) to crypto project
Moved MaskedToString to crypto project
Added BytesUtil to imports and cleaned up CryptoUtil.recoverPoint
Moved the rest of crypto stuff to the crypto project
Moved crypto tests to crypto-test project
* Added documentation for crypto project
* Add wallet creation time for rescans
* Fix docs
* Clean up and add test
* Remove account bday
* Fix compile issue and docs
* Add more chain handler tests
* Use Instant over Long, add docs
* Fix docs
* Implement Slick's multi database support via our DAOs
WIP2 work on chain project
WIP make JdbcProfieComponent so we have a common JdbcProfile
WIP2
Clean up a few things
WIP got CRUDAutoInc compiling
Get closer to everything compiling in the chain project
Begin moving database code into JdbcProfileComponent
WIP source compiling
Get dbCommonsTest/ test cases passing
Get rest of tests compiling and passing
* Rebase onto master, fix conflicts
* Run scalafmt
* Run scalafmt again
* Cleanup a few compiler warnings by adding type annotations to thigns
* Explicitly cast tables where they are needed in the wallet project where we need TableQuery for foreignkey / joins in slick
* Redo definition of 'table' to use the profile.api.TableQuery in scope
* Rename all *Table.scala files to *Db.scala
* First crack at address ben's code review
* Fix docs compile issue
* Fixed casting (#30)
* Fixed AppConfig casting
* Fixed TableQuery casting in DbManagement subtypes
* Fixed casts in DAOs relating to internal types
* Address nadav's code review, move JdbcProfileComponent into it's own file
* Remove unused listTables() method
Co-authored-by: Nadav Kohen <nadavk25@gmail.com>
* WIP: Build queue for getnewaddress
* Implement background thread to process requests to getNewAddress so that we fix issue 1009 with it's async issues
* Run scalafmt
* Replace the mutable.ArrayBuffer in AddressHandling with ConcurrentLinkedQueue
* Put FundTransactionhandling.fundRawTransactionInternal's call to getNewChangeAddress() into the for expression so we don't generate an address when the funding of the transaction fails when selecting utxos
* Move thread initialization out of method
* Switch to using ArrayBlockingQueue, which will block thread with .take() so we don't need to loop constantly, add 'addressQueueSize' and 'addressQueueTimeout' configurations
* Update wallet-test/src/test/scala/org/bitcoins/wallet/AddressHandlingTest.scala
Co-Authored-By: rorp <rorp@users.noreply.github.com>
* Add error handling to return the failed future if the queue is full, add a unit test for when the queue is full
* Run scalafmt
* Rebase
* Add scaladoc for throwing an exception
* Run scalafmt again
Co-authored-by: rorp <rorp@users.noreply.github.com>
* GetAddress Wallet API call
* Add ability to get unfunded address
* Generate new address if no unfunded addresses
* Add test
* Add wallet get address documentation
* Incoming and Outgoing Transaction Tables
* Remove script sigs for witness txs
* Create parent tx_table for incoming and outgoing txs
* Response to review
* Use isCloseEnough
* Fix test
* Fix rebase error
* Test that tx is tracking all sats correctly
* Add wallet rescan tests
* Create FilterSync, which gives us an API inside of the chain project to sync filters with
Add another unit test to filter sync
Add more unit tests for ChainSync and FilterSync
Clean up some docs, remove some extra lines of code
Run scalafmt
Add filter-sync.md
Cleanup some nits
Add more information of how FilterSync.syncFilters() works
Add 'FilterWithHeaderHash' type so that we can actually validate/verify block headers that are being fed into the chain project
Run scalafmt, hide imports in filter-sync.md so code appears cleaner
Move implicits out of invisible block as it seems to cause errors
Make it so FilterSync processes filters in batches rather than fetching them all at once
Fix compile error
* WIP bitcoind implement ChainQueryApi
* rework fixtures to be able to support injecting ChainQueryApi implemented by bitcoind into our fixture infrastructure for creating wallets
* Fix rebase problem
* Implement getFiltersBetweenHeight() with ben's solution
* WIP Start implementing NodeApi against bitcoind
* Actually inject the bitcoind backed nodeApi into our fixture
* Get first rescan test working for rescanning the entire blockchain
* Implement test case for rescanning from a specific height
* Fix NeutrinoNodeWalletTest test case that uses a experimental version of bitcoind, for now i believe our experimental binary is on v18
* Add wallet-rescan.md, add helper method to WalletApi that allows you to clear out the wallet's utxos/addresses
* Add another log to try to debug CI
* Address code review
* Fix wrong ordering of deletion of tables in clearUtxosAndAddresses()
* reset logging level
* Create FilterSync, which gives us an API inside of the chain project to sync filters with
Add another unit test to filter sync
Add more unit tests for ChainSync and FilterSync
Clean up some docs, remove some extra lines of code
Run scalafmt
Add filter-sync.md
Cleanup some nits
Add more information of how FilterSync.syncFilters() works
Add 'FilterWithHeaderHash' type so that we can actually validate/verify block headers that are being fed into the chain project
Run scalafmt, hide imports in filter-sync.md so code appears cleaner
Move implicits out of invisible block as it seems to cause errors
Make it so FilterSync processes filters in batches rather than fetching them all at once
Fix compile error
* Add comment about trust model
* Run scalafmt
* Create migration to drop confirmations column from txo_spending_info table in the wallet database, also fix a long standing issue in BitcoinSFixture where failure cases in the testing suite were not being handled properly
* Fix scala 2.11.12 compile issue
* Add flyway migrations
* Make different project's migrations independent of each other
* Rework all AppConfig.initialize() to use migrations rather than what we were doing before
* TXO State migration
* Move to new file, drop old column
* Add block hash column
Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
* Create 'fundRawTransaction' and 'fundRawTransactionInternal'
* Move TransactionTestUtil to testkit, begin writing tests for fundrawtransaction
* Add FundTransactionTests
* Move things to 'FundTransactionHandling' trait
* Start segregating things by HDAccount in the wallet, this gives us the ability to query for balances based on account, fund a transaction based on an account, generate a new address based on an account etc. All old api calls are now based on the default account, i.e. getBalance() returns the balance for account 0, fundRawTransaction funds the transaction from account 0 etc.
* Fix compile issue with 2.11.x
* Bump address generation Thread.sleep() to 500ms
* Address ben code review
* Address code review
* Introduced UTXOSpendingInfoSingle
* Implemented constructors for UTXOSpendingInfoSingle
* Introduced BitcoinSignerSingle
* Implemented SingleSigner
* Added property-based test for SingleSigner, it fails
* Fixed SignerTest :)
* Responded to code review
* Added scaladocs
* Fixed p2sh(p2wsh) signing
* Responded to code review and separated UTXOSpendingInfoSingle from UTXOSpendingInfoFull
* Fixed outputGen after rebase
* Fixed txbuilder.md to show this branch's changes
* Create 'fundRawTransaction' and 'fundRawTransactionInternal'
* Move TransactionTestUtil to testkit, begin writing tests for fundrawtransaction
* Add FundTransactionTests
* Move things to 'FundTransactionHandling' trait
* Address code review
* Run scalafmt
* Add more expressive txo states for the wallet
* Rename 'PendingReceived/PendingSpent' -> 'UnconfirmedReceived/UnconfirmedSent'
* Address code review
* Fix posInt implementation to work with older scala versions
* Rename to PendingConfirmationReceived/PendingConfirmationSpent
* Implement abililty to use BIP39 password. This means this password needs to be password through our various projects to be able to correctly generate the key that controls the wallet. This also renames 'CreateKeyManagerApi' -> 'BIP39CreateKeymanagerApi' as the bip39 password is needed when creating the KeyManager
* Add bip39 password to BIP39KeyManager.fromParams(), fix mdocs
* Fix bug in unit test were whe weren't specifying password
* Fix rebase issues
* This creates a subtype BIP39KeyManager and moves all existing KeyManager functionality to that subtype. We leave a empty 'KeyManager' trait for now
* Fix website docs
* Move initialization of wallet entropy into the key manager
* Enable key-manager in ci, add coverage minimum
* Add coverage minimum for key manager, add KeyManagerParams, start adding KeyManager test harness
* Remove success cases on ADTs, start using Either
* fix import
* Get test coverage to 90%
* Add documentation for key-manager.md, add side bar for key-manager
* Fix wallet.md
* Make seedPath default to baseDatadir, so we don't have a unique seed for every network. Add more documentation
* Address code review
* Address code review from Ben
* Add missing import
* Add more tests for coverage
* Segregate key manager from wallet
* More consistent naming in build.sbt, run scalafmt
* Add test case making sure we don't overwrite a mnemonic seed
* Add key-manager.md
* Fix compile issues with older scala versions
* Address code review
* Introduced ConditionalScriptPubKey
Some more progress
Added Conditional signing infrastracture, tests do not pass and there are no Conditional tests
Fixed tests!
* Redid calcLockTime and calcSequenceForInputs in TxBuilder (added Conditional support)
* Added ScriptGenerators for Conditional scripts, only one test to go!
* Fixed CLTV(Empty) tests
* Responded to code review
* responded to code review
* ScriptSignature only types Policy-compliant script signatures
* Fixed md doc
* Update scalafmt to 2.0.1
* Scalafmt
In this commit we
1) Reconfigure the .scalafmt.conf file
2) Add a scalafmt binary (same version as specified in conf file)
3) Use said binary on CI to check that everything is formatted correctly
* Ran scalafmt
* Update scalafmt ignore
* Add scalafmt plugin to project/plugins.sbt, run it
* run scalafmt
* Bump Scala versions
Support Scala 2.12.9
and 2.13.0.
To make this easier, we delete the `scripts` project. Everything
that was in here was covered by content on the website. We also
delete the `doc` folder, as that was a remnant from when `scripts`
was called `doc`.
* Crib uPickle akka-http support while we wait for publish
* Fix compiler warnings
* Add note on test logging to contribution guide
* Reduce duplication in Blockchain implementation
* Use Scala 2.12 for website
* Introduce compat package object for collections converters
* Fix Either compiler warnings
* Add sync-chain and create-wallet docs from deleted scripts
* Fix rebase goofup
* Split app loggers into their corresponding modules
This avoids a bunch of places with awkward implicit resolution.
We also make sure that all logging in node, chain and wallet
happens with the app loggers, and not BitcoinSLogger
* Tune test logging level to WARN
* Add functionality for updating SPV node bloom filter
* Add SPV node shutdown to exit hook
* Clean up traits/case classes
* Change fixture in WalletBloomTest
* Fix logging bug in TransactionProcessing
* Add MerkleBuffers
In this commit we add MerkleBuffers, which is an object
that lets us aggreagate merkleblocks with their corresponding
transactions before sending them out. This is global, mutable
state (bad!) but it's a working solution for now;
* Use TestAsyncUtil
* Add MerkleBuffers test
* Send getdata if receiving single header
* Change awaitSync to use block count
* Fix UpdateBloomFilterTest
* Add more logging of chain/headers validation
* Send getdata for all blocks
* Nits: Scaladocs, comments toString
* Add logging to data directory
In this commit we add the ability for the node, chain
and wallet projects (+ the server) to log to the users
data directory instead of whatever directory the
binaries was launched from. This is inherently a bit
more complicated than our previous setup, because
we need to read the user directory before we can create
loggers. As a result of this, some files/methods were
moved around, so the relevant app config could be
found in scope.
We also introduce several logging categories that can be
tuned individually through user configuration. These logggers
are exposed both as traits that give a field `logger`, or
as methods that return the required logger.
* Add datadir configuration to AppConfig
In this commit we add support for AppConfig to pick up
the data directory configuration file. We also add
a section to the contributing guide on how to tune
logging levels.
* Pass data directories explicitly for configuration
* This PR is attempting to remove the publishing errors when publish
locally many of which are incorrectly linked things in scaladocs which
there are some differences in formatting. Hopefully this removes alot
if not all of the "link not found for ..." warning messages that show
up.
In this commit we
1) Add the notion of address types in the wallet, and remove
the emphasis on account types. Users now just request
a segwit/nested-segwit/legacy address, and we take care
of querying for the correct account
2) Fix a bug where a wallet could only get addresses for
its default address type. This was a pretty minor bug,
where a few values that should have been dynamic was
hard coded.
* PoC bitcoin-s-cli
* Add CLI, Server sbt projects, remove Ammonite
In this commit we set up sbt configuration for
CLI, Server (in-work-name) and corresponding
test projects.
We also remove Ammonite shell from sbt, as that
isn't really being used. bloop console offers
the same functionality way more ergonimic.
* Move BitcoinSAppConfig into new server project
Server project depends on node, chain wand wallet
so this is a good time for introducing this class
into main sources. We also introduce
BitcoinSTestAppConfig in testkit, to replace the
functionality in BitcoinSAppConfig related to
tests.
* Type chain in blockchainresult
* MVP server setup for node, chain and wallet
* Extremely dirty CLI for interacting with server
* initial attempt at mimicking Bitcoin Core API
* WalletStorage: add method for checking for seed existance
* Check for seed existance on wallet startup
* Fix bug where MnemonicNotFound was not an error
* Segregate confirmed and unconfirmed balance methods
* Add error handling, improve formatting of CLI output
* Tweak build
Bump Sttp version, downgrade to uPickle 2.11 compat,
skip publish in cli-test and server-test
* Add CLI, server and picklers to root project
* Split wallet functionality into multiple traits
In this commit we refactor LockedWallet into multiple traits
that provide functionality related to a subset of total wallet
functionality. This has the benefit of making it clear which
methods are helper methods that are only intended to be used
in a very specific setting, and which methods are part of the
internal wallet API that other parts of the wallet can use.
* Rework TransactionOutput and TransactionOutPoint to case classes
* Add extension methods for flattening lists of assertions
* Segregate confirmed and unconfirmed balance methods
* Add test for FutureUtil.sequentially
* Add trace logging of balance fetching
* Process outgoing TXOs
Move TX processing into separate trait, add internal API method
Unify DB representation of TXOs
Prior to this commit we stored TXO information
across diferent tables, with joins and tuples
needed a bunch of places to keep track of
everything we needed. In this commit we unify
the tables, leaving us with only one table for
TXOs.
In this commit we replace addUtxo with
processTransaction in the wallet API. addUtxo
is kept around, but only as an internal
implementation detail.
The new flow looks like this:
1) The wallet gets notified about a new TX
through a processTransaction call
2) It then searches through our already
processed incoming TXs:
if found, updates the confirmation
status
else, inserts it into the DB
3) We then call addUtxo, if the previous
step resulted in a new TX in our
DB