poetapp / node

The core of Po.et
https://docs.poetnetwork.net/
MIT License
193 stars 27 forks source link

Use bitcoind + bitcoinjs-lib #24

Closed lautarodragan closed 6 years ago

lautarodragan commented 6 years ago

Drop Insight API and Bitcore altogether.

BlockchainWriter will require bitcoinjs-lib for transaction building.

Module will need to use bitcoind's json-rpc, and since Bitcoin Core doesn't index utxos, we'll need it to be wallet-enabled too.

Add bitcoind docker image for development and local testing, running in regtest by default.

Prior Research

lautarodragan commented 6 years ago

https://github.com/poetapp/bitcoind-client

lautarodragan commented 6 years ago

Please wait a bit before starting work on this.

geoffturk commented 6 years ago

BlockchainReader split out into #106.

geoffturk commented 6 years ago

Research alternatives to bitcoinjs-lib first to see if there is a better option.

wzalazar commented 6 years ago

we have these repositories related, it's a before research

https://github.com/poetapp/bitcoind-docker https://github.com/poetapp/bitcoind-client

krobi64 commented 6 years ago

What doin you mean by Bitcoin Core does not index utxos? From https://bitcoin.stackexchange.com/questions/37397/where-is-the-utxo-data-stored

For the tip (the last block in the active chain), we maintain a database with the set of unspent transaction outputs (UTXOs), stored in $DATADIR/chainstate, and aggressively cached in memory. When a new block is received, we remove the UTXOs spent by transactions in the block, and add the outputs of those transactions. When a reorganization happens, we use undo data (stored in $DATADIR/blocks/rev*.dat) to roll back the changes to the UTXO set. In a way, you can see blocks as patches to the UTXO set - but the UTXO set is never explicitly committed to or stored in blocks, it is merely implied by them.

lautarodragan commented 6 years ago

@krobi64 I may be wrong in that statement. I also believe whether the entire UTXO set is accessible or just the ones for wallets is configurable.

But I'm not 100% sure of any of this. What I did find out is that when I tried to use the get UTXO RPC call on any address I'd get an empty array in return, unless the account had been created and managed in that bitcoind.

I then did some reading on the subject and found people mentioning how not the entire UTXO set was stored, and that being one of the reasons things like bitcore existed. But all of that could be outdated info.

If you can get the UTXO of any address that would allow us to continue creating transactions are we currently are — otherwise we'd need to use the wallet RPC calls.

geoffturk commented 6 years ago

@lautarodragan @krobi64 Let's continue this discussion here.

poet-ci commented 6 years ago

:tada: This issue has been resolved in version 1.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: