For anyone who has the time to hack around a little bit,
this is the way I created a valid
XCP transaction in python with python-trezor library installed.
The process is a pain in the ass right now,a) create transaction unsigned with counterwallet-cli
b) copy the raw transaction into
http://brainwallet.org to decode the raw transaction
c) Copy prevout, previndex and the OP_RETURN data into the python script
d) Set the correct BIP path and receipient in the python file, and launch it to sign the transaction with trezor
e) Now push the transaction with bitcoin core using "sendrawtransaction" api.
If anyone has fun making this thing more comfortable or maybe even integrating this workflow into Counterwallet GUI,
feel free to take my code:
#!/usr/bin/python
import binascii
import trezorlib.types_pb2 as proto_types
from trezorlib.client import TrezorClient, TrezorClientDebug
from trezorlib.tx_api import TXAPITestnet
from trezorlib.tx_api import TXAPIBitcoin
from trezorlib.transport_hid import HidTransport
FROM_BIP="44'/0'/0'/0/0"
PREVHASH='67ca16b97014a56189f50f1a30b4db68e8ea314b33473bd0553916078f6a8250'
N=2
TO='1H6w1CUk8cmSeaoGJ363LY9LWe57FPrCeA'
OPRETURN_DATA=binascii.unhexlify("6f6bf889b4e439735d37c3611b0942d26df866aaf773c825208fbb6a")
TOTAL=22853000
FEE=10000
DUST=5430
def main():
# List all connected TREZORs on USB
devices = HidTransport.enumerate()
# Check whether we found any
if len(devices) == 0:
print 'No TREZOR found'
return
# Use first connected device
transport = HidTransport(devices[0])
# Creates object for manipulating TREZOR
client = TrezorClient(transport)
client.set_tx_api(TXAPIBitcoin())
# The list of inputs.
inputs = [
proto_types.TxInputType(
address_n=client.expand_path(FROM_BIP),
prev_hash=binascii.unhexlify(PREVHASH),
prev_index=N,
),
]
outputs = [
proto_types.TxOutputType(
amount=DUST,
script_type=proto_types.PAYTOADDRESS,
address=TO,
),
proto_types.TxOutputType(
amount=0,
script_type=proto_types.PAYTOOPRETURN,
op_return_data=OPRETURN_DATA,
),
proto_types.TxOutputType(
amount=TOTAL-FEE-DUST,
script_type=proto_types.PAYTOADDRESS,
address_n=client.expand_path(FROM_BIP),
),
]
(signatures, serialized_tx) = client.sign_tx('Bitcoin', inputs, outputs)
print 'Transaction:', binascii.hexlify(serialized_tx)
client.close()
if __name__ == '__main__':
main()
Did you try to move XCP funds successfully with 0 tx fee?
It has always been the tx fee that stops me from using the XCP online wallet