[LOCKED] Python cffi secp256k1-zkp wrapper - bounty


Python cffi secp256k1-zkp wrapper. The purpose of this wrapper is to be implemented
in the Mimblewimble implementation in Python @renzokuken is working on. The current obstacle is access to secp256k1-zkp methods. Grin uses our own fork of secp256k1-zkp library and the way it is used in Rust is via a wrapper . This bounty was created based on a request by Renzokuken the discussion in the CC meeting on the 13th of September.


  • Well documented Wrapper
  • Well tested (test cases should be made available)
  • Open source, Apache License 2.0, if not possible with wrapped C code, MIT license


You may simply start grabbing definitions from

and put them in defs.c

and then fetch the C source

git submodule init
git submodule update

and run the build

python build.py

and you will start getting parsing errors, type errors etc

Traceback (most recent call last):
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/cparser.py", line 336, in _parse
    ast = _get_parser().parse(fullcsource)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycparser/c_parser.py", line 152, in parse
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycparser/ply/yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc
    r = errorfunc(token)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycparser/c_parser.py", line 1861, in p_error
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycparser/plyparser.py", line 67, in _parse_error
    raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: <cdef source string>:57:5: before: secp256k1_pubkey

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "build.py", line 51, in <module>
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/api.py", line 112, in cdef
    self._cdef(csource, override=override, packed=packed, pack=pack)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/api.py", line 126, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/cparser.py", line 389, in parse
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/cparser.py", line 394, in _internal_parse
    ast, macros, csource = self._parse(csource)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/cparser.py", line 338, in _parse
    self.convert_pycparser_error(e, csource)
  File "/Users/marek/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages/cffi/cparser.py", line 367, in convert_pycparser_error
    raise CDefError(msg)
cffi.CDefError: cannot parse "secp256k1_pubkey* pubkey,"
<cdef source string>:57:5: before: secp256k1_pubkey

This is just how to get started. The goal is not to copy all the methods from rustyrussell/secp256k1-py/ but to have all those as well as all the MW zkp methods from GitHub - mimblewimble/secp256k1-zkp: Fork of secp256k1-zkp for the Grin/MimbleWimble project

Amount Available

10k USD paid 90% in BTC and 10% in Grin using a 1 month average. Alternative distribution of percentage is possible upon request. 3k USD advancement is available upon showing significant progress.


Congratulations to @walkbackgod, this bounty is locked for you :tada:. Please create a separate forum post where you give updates on the progress of this project every 2 weeks (a few bullet points will do). If we did not hear anything from you for 2 months, the bounty will become unlocked.