Skip to content

Commit

Permalink
Merge pull request #1050 from CounterpartyXCP/develop
Browse files Browse the repository at this point in the history
Merge develop to master (Counterparty release 9.56.0)
  • Loading branch information
chiguireitor authored Dec 27, 2018
2 parents c2d0964 + 8ec95ed commit e875c45
Show file tree
Hide file tree
Showing 88 changed files with 8,239 additions and 10,127 deletions.
17 changes: 17 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
## Library Versions ##
* v9.56.0 (2018-09-16)
* Use Bitcoin 0.16.2 with indexd as a transaction index
* allow multisig encoding method as the bytespersigop DoS protection was changed in Bitcoin Core v0.13.0
* API change (backwards compatible): adds extended_tx_info parameter to create methods
* Breaking API change. The result of get_unspent_txouts has changed and now looks like this: [{
"amount": 0.001,
"confirmations": 2,
"height": 1211095,
"txid": "832d27a9b6134ecf50c5e1724bca3ebb797c21fb05b850a9abf145372acc3933",
"value": 100000,
"vout": 1
}]
* Fixed unpack API method for enhanced sends
* Upgrade SQLite/APSW to v3.12.2
* Run `python3 setup.py install_apsw` to upgrade your installed version.
* Run `./tools/upgradesqlitepagesize.py <PATHTOYOURDB>` while your node is OFFLINE to upgrade.
Most likely the path to your DB is `~/.local/share/counterparty/counterparty.db`.
* v9.55.4 (2017-10-31)
* Fix for uncaught exception in short asset name issuances
* v9.55.3 (2017-09-26)
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ WORKDIR /counterparty-lib
RUN pip3 install -r requirements.txt
RUN python3 setup.py develop
RUN python3 setup.py install_apsw
RUN python3 setup.py install_serpent

# Install counterparty-cli
# NOTE: By default, check out the counterparty-cli master branch. You can override the BRANCH build arg for a different
Expand All @@ -31,4 +30,3 @@ EXPOSE 4000 14000

# NOTE: Defaults to running on mainnet, specify -e TESTNET=1 to start up on testnet
ENTRYPOINT ["start.sh"]

26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Coverage Status](https://coveralls.io/repos/CounterpartyXCP/counterparty-lib/badge.png?branch=develop)](https://coveralls.io/r/CounterpartyXCP/counterparty-lib?branch=develop)
[![Latest Version](https://pypip.in/version/counterparty-lib/badge.svg)](https://pypi.python.org/pypi/counterparty-lib/)
[![License](https://pypip.in/license/counterparty-lib/badge.svg)](https://pypi.python.org/pypi/counterparty-lib/)
[![Slack Status](http://slack.counterparty.io/badge.svg)](http://slack.counterparty.io)
[![Docker Pulls](https://img.shields.io/docker/pulls/counterparty/counterparty-server.svg?maxAge=2592000)](https://hub.docker.com/r/counterparty/counterparty-server/)


Expand All @@ -20,20 +19,33 @@ For a simple Docker-based install of the Counterparty software stack, see [this

# Manual installation

Download the newest [patched Bitcoin Core](https://github.com/btcdrak/bitcoin/releases) and create
Download the latest [Bitcoin Core](https://github.com/bitcoin/bitcoin/releases) and create
a `bitcoin.conf` file with the following options:

```
rpcuser=bitcoinrpc
rpcpassword=rpc
server=1
txindex=1
addrindex=1
rpctimeout=300
zmqpubhashblock=tcp://127.0.0.1:28832
zmqpubhashtx=tcp://127.0.0.1:28832
addresstype=legacy
```

**Note:** you can and should replace the RPC credentials. Remember to use the changed RPC credentials throughout this document.

Download and install latest Indexd:
```
$ git clone https://github.com/CounterpartyXCP/indexd-server.git
$ cd indexd-server
$ cp .env-mainnet-example .env
-- Modify .env with your rpcuser and rpcpassword --
$ npm install
$ npm start
```

You could run the indexd daemon with a process manager like `forever` or `pm2` (recommended).

Then, download and install `counterparty-lib`:

```
Expand Down Expand Up @@ -64,7 +76,7 @@ $ counterparty-server --backend-password=rpc start

# Basic Usage

## Via command-line
## Via command-line

(Requires `counterparty-cli` to be installed.)

Expand Down Expand Up @@ -121,9 +133,11 @@ Manual configuration is not necessary for most use cases. "back-end" and "wallet
A `counterparty-server` configuration file looks like this:

[Default]
backend-name = addrindex
backend-name = indexd
backend-user = <user>
backend-password = <password>
indexd-connect = localhost
indexd-port = 8432
rpc-host = 0.0.0.0
rpc-user = <rpcuser>
rpc-password = <rpcpassword>
Expand Down
8 changes: 3 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# Keep this as non-docker for now, to give some variety to our test configurations, as travis builds with docker
dependencies:
override:
- rm -rf /home/ubuntu/virtualenvs/venv-*/bin/serpent
- rm -rf /home/ubuntu/virtualenvs/venv-*/lib/python3.4/site-packages/apsw*
- pip install --upgrade pip
- pip install -r requirements.txt
- python setup.py install --with-serpent
- python setup.py install
- python -c "import apsw; print(apsw.apswversion())"
test:
override:
- py.test --verbose --capture=no counterpartylib/test/config_context_test.py
- py.test --verbose --capture=no counterpartylib/test/unit_test.py
- py.test --verbose --capture=no counterpartylib/test/utxolocks_test.py
- py.test --verbose --capture=no counterpartylib/test/bytespersigop_test.py
- py.test --verbose --capture=no counterpartylib/test/hashlib_test.py
- py.test --verbose --capture=no counterpartylib/test/parse_block_test.py
- py.test --verbose --capture=no --skiptestbook=all counterpartylib/test/integration_test.py
- py.test --verbose --capture=no counterpartylib/test/contracts_test.py
- py.test --verbose --capture=no --skiptestbook=mainnet -k test_book counterpartylib/test/reparse_test.py
- py.test --verbose --capture=no --skiptestbook=testnet -k test_book counterpartylib/test/reparse_test.py
- py.test --verbose --capture=no --skiptestbook=testnet -k test_book counterpartylib/test/reparse_test.py:
timeout: 5400
- py.test --verbose --capture=no counterpartylib/test/database_version_test.py
machine:
pre:
Expand Down
34 changes: 30 additions & 4 deletions counterpartylib/lib/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,41 @@ def pack(address):
"""
Converts a base58 bitcoin address into a 21 byte bytes object
"""
from .util import enabled # Here to account for test mock changes

short_address_bytes = bitcoin.base58.decode(address)[:-4]
return short_address_bytes
if enabled('segwit_support'):
try:
bech32 = bitcoin.bech32.CBech32Data(address)
witver = (0x80 + bech32.witver).to_bytes(1, byteorder='big') # mark the first byte for segwit
witprog = bech32.to_bytes()
if len(witprog) > 20:
raise Exception('p2wsh still not supported for sending')
return b''.join([witver, witprog])
except Exception as ne:
try:
short_address_bytes = bitcoin.base58.decode(address)[:-4]
return short_address_bytes
except bitcoin.base58.InvalidBase58Error as e:
raise e
else:
try:
short_address_bytes = bitcoin.base58.decode(address)[:-4]
return short_address_bytes
except bitcoin.base58.InvalidBase58Error as e:
raise e

# retuns both the message type id and the remainder of the message data
def unpack(short_address_bytes):
"""
Converts a 21 byte prefix and public key hash into a full base58 bitcoin address
"""
from .util import enabled # Here to account for test mock changes

check = bitcoin.core.Hash(short_address_bytes)[0:4]
return bitcoin.base58.encode(short_address_bytes + check)
if enabled('segwit_support') and short_address_bytes[0] >= 0x80 and short_address_bytes[0] <= 0x8F:
# we have a segwit address here
witver = short_address_bytes[0] - 0x80
witprog = short_address_bytes[1:]
return str(bitcoin.bech32.CBech32Data.from_bytes(witver, witprog))
else:
check = bitcoin.core.Hash(short_address_bytes)[0:4]
return bitcoin.base58.encode(short_address_bytes + check)
Loading

0 comments on commit e875c45

Please sign in to comment.