<p>For compatible segwit transactions, it is basically using p2sh transactions.<br>
For <code>pycoin</code> specifically, you need to provide <code>p2sh_lookup</code> dict when sign the p2sh transaction.<br>
I have a <a href="https://github.com/xuanzhui/cryptocoin-py/blob/master/btc_sample.py" rel="nofollow noreferrer">sample</a> for bitcoin offline/paper transaction if you would like to check, the method <code>spend_sh_fund</code> may suit your need.</p>

CC BY-SA 4.0
2022-08-30T16:14:59.057Z
What about native segwit? Is there library to sign those?
Vincent Alex
CC BY-SA 4.0
2018-08-17T09:05:11.357Z
2018-08-17T09:05:11.357Z
xuanzhui
<p>My target is to make transaction with unspent transaction outputs(UTXOS).
The information of UTXOs is as follow.</p>

<pre><code>[   
  {
    "pt_idx": 0,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "92343",
    "block_height": 1288714,
    "txhash": "9e2d2d56632b609e9b5d0a1990cf0ffbd9865cec558b68ed106df352fd89cfb1",
    "pointer": 1083,
    "script_type": 14   
  },
  {
    "pt_idx": 1,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "9961066",
    "block_height": 1288718,
    "txhash": "b0e37f463aba4e3abb078eb77c472b29621cfdd17ed83ae41122b0b95df5e518",
    "pointer": 1096,
    "script_type": 14   
  },
  {
    "pt_idx": 1,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "315595",
    "block_height": 1288721,
    "txhash": "b062efcab010d436ca2f6bed0dc61b90d8cbced756e1ed7cc7593cac30d87326",
    "pointer": 1099,
    "script_type": 14   
  },
  {
    "pt_idx": 1,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "1872759",
    "block_height": 1288716,
    "txhash": "f88cfdb328f9d298b0ff8a641198d3e63ea7efaf6f98f5692ba3f88a03a73c2b",
    "pointer": 1088,
    "script_type": 14   }
]
</code></pre>

<p>From these I made transaction using pycoin library.
By the way, it is difficult to sign a SegWit transaction.
If anyone knows about this, please tell me.</p>

CC BY-SA 3.0
2018-04-16T17:35:36.200Z
What the pycoin version ?
f4r4
CC BY-SA 3.0
2018-04-17T17:58:04.113Z
pycoin 0.80.If you have solution, Pls tell me.
Coder HHC
CC BY-SA 4.0
2018-06-01T09:04:49.880Z
@Mickey102644 Can you paste the (unsigned) transaction you made with Pycoin?
Mike D
CC BY-SA 4.0
2023-12-04T12:21:14.897Z
I’m voting to close this question because the user doesn't show any trace of experiment or trial-and-error whatsoever, essentially asking us to write code for them.
Antoine Poinsot
<segregated-witness><python><utxo><pycoin>
Pycoin: How to sign SegWit transaction via Pycoin?
Coder HHC
# Pycoin: How to sign SegWit transaction via Pycoin?

(Asked by: username_0 on 2018-03-21)

My target is to make transaction with unspent transaction outputs(UTXOS).
The information of UTXOs is as follow.

```
[   
  {
    "pt_idx": 0,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "92343",
    "block_height": 1288714,
    "txhash": "9e2d2d56632b609e9b5d0a1990cf0ffbd9865cec558b68ed106df352fd89cfb1",
    "pointer": 1083,
    "script_type": 14   
  },
  {
    "pt_idx": 1,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "9961066",
    "block_height": 1288718,
    "txhash": "b0e37f463aba4e3abb078eb77c472b29621cfdd17ed83ae41122b0b95df5e518",
    "pointer": 1096,
    "script_type": 14   
  },
  {
    "pt_idx": 1,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "315595",
    "block_height": 1288721,
    "txhash": "b062efcab010d436ca2f6bed0dc61b90d8cbced756e1ed7cc7593cac30d87326",
    "pointer": 1099,
    "script_type": 14   
  },
  {
    "pt_idx": 1,
    "subaccount": 37,
    "ga_asset_id": 1,
    "value": "1872759",
    "block_height": 1288716,
    "txhash": "f88cfdb328f9d298b0ff8a641198d3e63ea7efaf6f98f5692ba3f88a03a73c2b",
    "pointer": 1088,
    "script_type": 14   }
]

```

From these I made transaction using pycoin library.
By the way, it is difficult to sign a SegWit transaction.
If anyone knows about this, please tell me.

**Tags:** segregated-witness, python, utxo, pycoin

> **Comments:**
> **username_1**: What the pycoin version ?  
> **username_0**: pycoin 0.80.If you have solution, Pls tell me.  
> **username_2**: @Mickey102644 Can you paste the (unsigned) transaction you made with Pycoin?  
> **username_3**: I’m voting to close this question because the user doesn't show any trace of experiment or trial-and-error whatsoever, essentially asking us to write code for them.  

---

## 1 answers

### Answer by username_4 on 2018-08-17. Score: 0

For compatible segwit transactions, it is basically using p2sh transactions.  
For `pycoin` specifically, you need to provide `p2sh_lookup` dict when sign the p2sh transaction.  
I have a [sample](https://github.com/username_4/cryptocoin-py/blob/master/btc_sample.py) for bitcoin offline/paper transaction if you would like to check, the method `spend_sh_fund` may suit your need.

> **Comments:**
> **username_5**: What about native segwit? Is there library to sign those?  

---

