MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / encode

Function encode

bitcoin/segwit_addr.py:117–122  ·  view source on GitHub ↗

Encode a segwit address.

(hrp, witver, witprog)

Source from the content-addressed store, hash-verified

115
116
117def encode(hrp, witver, witprog):
118 """Encode a segwit address."""
119 ret = bech32_encode(hrp, [witver] + convertbits(witprog, 8, 5))
120 if decode(hrp, ret) == (None, None):
121 return None
122 return ret

Callers 2

__str__Method · 0.90
test_encode_decodeMethod · 0.90

Calls 3

bech32_encodeFunction · 0.85
convertbitsFunction · 0.85
decodeFunction · 0.70

Tested by 1

test_encode_decodeMethod · 0.72