Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation

Overview

secp256k1

Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation

Example Usage

import secp256k1 as ice
print('[C]',privatekey_to_address(0, True, 42866423864328564389740932742094))

Speed

On my old Laptop with i7 4810 MQ CPU

timeit ice.privatekey_to_address(0, True, 67)
7.13 µs ± 359 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

timeit ice.scalar_multiplication(3240945)
3.1 µs ± 38.7 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

timeit ice.point_increment(P)
2.76 µs ± 267 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

timeit ice.point_addition(P,G)
2.91 µs ± 35.4 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

With 500000 continuous keys in 1 group call, we get :
timeit ice.privatekey_group_to_ETH_address(256, 500000)
1.55 s ± 2.53 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Comments
  • BTC Address : [Segwit      ] Wrong

    BTC Address : [Segwit ] Wrong

    import secp256k1_lib bip44_h160_c = secp256k1_lib.privatekey_to_h160(0, True, 0xe0353e2293a63769802b1e3d0d9affdedfda4d4486ed300428eadac4620427bf)

    secp256k1_lib.hash_to_address(1, False, bip44_h160_c) '32Q5Sa9pTezVeBYBZitidknwTs1Gd9HmPJ' False secp256k1_lib.hash_to_address(1, True, bip44_h160_c) '32Q5Sa9pTezVeBYBZitidknwTs1Gd9HmPJ' False

    PVK1 BTC Address : [Segwit ] 33eYbdrqZcxSXvPb26fj8KBqW4xxofzRpC True

    opened by Noname400 5
  • please check how privatekey_to_h160 works

    please check how privatekey_to_h160 works

    Hello please check how privatekey_to_h160 works

    m/0'/1'/9 world evolve cry outer garden common differ jump few diet cliff lumber bd85556143de177ed9781ac3b24ba33d0bc4f8d6f34d9eaa1d9b8ab0ee3a7e84d42638b520043234bcedb4e869464b9f964e7e8dbf1588395f7a7782588ae664 dbb4ccf92b0a0742016c915585864a8261994ec2 | 1DMtkFF6J1abNqgVmpL5WtZZkcJtaCeW7d | 42a38914e258e63e4baaff51a62d61df0236f6d1 | 1DFWG8gL7jqRdwCogdKhXC9FRXuRb5Ed7X |

    opened by Noname400 5
  • not work on Linux 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

    not work on Linux 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

    print(ice.scalar_multiplication(2)) : '\x04\xc6\x04\x7f\x94A\xed}m0E@n\x95\xc0|\xd8\w\x8eK\x8c\xef<\xa7\xab\xac\t\xb9\p\x9e\xe5\x1a\xe1h\xfe\xa6=\xc39\xa3\xc5\x84\x19Fl\xea\xee\xf7\xf62e2f\xd0\xe1#d1\xa9P\xcf\xe5*')

    P = ice.scalar_multiplication(2) print(type(P)) : <type 'str'>

    P.hex() : AttributeError: 'str' object has no attribute 'hex'

    opened by Goga0123 3
  • ice_secp256k1.dll Windows 10 error...

    ice_secp256k1.dll Windows 10 error...

    Python 3.9.12 under (windows 10 Pro)

    Traceback (most recent call last): File "H:\Ramset\RANDBITS\random bits\Random.seed\BTC RANDOM SEED #64 II.py", line 4, in import secp256k1 as ice File "H:\Ramset\RANDBITS\random bits\Random.seed\secp256k1.py", line 22, in ice = ctypes.CDLL(pathdll) File "C:\Programs\Python\Python38\lib\ctypes_init_.py", line 374, in init self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'H:\Ramset\RANDBITS\random bits\Random.seed\ice_secp256k1.dll' (or one of its dependencies). Try using the full path with constructor syntax.

    This problem occurs since windows 10 update to version 21H2... the dll file is not found even though it is present in the folder..

    opened by Jolly-Joker-71 2
  • Incorrect ice.btc_pvk_to_wif

    Incorrect ice.btc_pvk_to_wif

    Hi. Thank you for your work. But...

    `import secp256k1 as ice

    addr = ice.btc_wif_to_pvk_hex('L3kQp4CrH2uc5bCRZhiS5sEGMpmcRZdpAhmWLRfMmufGTAW3ddfY')

    wif = ice.btc_pvk_to_wif('c2d15fb4e3649b708c4ed87392bcf6df704db45cec5e762a1a52a9502df54e50')

    print (addr) print (wif)`

    addr = c2d15fb4e3649b708c4ed87392bcf6df704db45cec5e762a1a52a9502df54e50; correct wif = L3kQp4CrH2uc5bCRZhiS5sEGMpmcRZdpAhmWLRfMmufGTARdCfsV; incorrect

    Correct - L3kQp4CrH2uc5bCRZhiS5sEGMpmcRZdpAhmWLRfMmufGTAW3ddfY

    Thanks.

    opened by boodooboo 2
  • How can I use 2 blooms in one program?

    How can I use 2 blooms in one program?

    this works great. Thanks. How can I use 2 blooms in one program? ice.Load_data_to_memory("eth_sorted.bin", False) ice.check_collision(this_key_eth_bytes)

    opened by Noname400 0
  • Error then run

    Error then run

    File "test.py", line 1, in import secp256k1 as ice File "/home/xman/secp256k1/secp256k1.py", line 30, in ice = ctypes.CDLL(pathdll) File "/usr/lib/python3.7/ctypes/init.py", line 356, in init self._handle = _dlopen(self._name, mode) OSError: /home/xman/secp256k1/ice_secp256k1.so: cannot open shared object file: No such file or directory

    How to solve this ?

    thanks

    opened by Hurd8x 0
  • _point_sequential_decrement and Fill_in_bloom

    _point_sequential_decrement and Fill_in_bloom

    Hello, little problem. ` P='02504673bb8f9a16e40227b4ee12fb8d940630cb687fbc98c1747493d18e22f39c'

    P = ice.pub2upub('02504673bb8f9a16e40227b4ee12fb8d940630cb687fbc98c1747493d18e22f39c') xx=ice._point_sequential_decrement(15, P) for t in range(10): OnePub = xx[t65:t65+65] print(ice.point_to_cpub(OnePub)); _bits, _hashes, _bf =ice.Fill_in_bloom(xx, _fp = 0.000001) ice.dump_bloom_file('my_bloom_file3.bin',_bits, _hashes, _bf) xsxa='023df3506a9994ad4a28bf59a14fecd436a2871d257129d6b3bbd02a9d5cafaef5' xsxa = ice.pub2upub(xsxa) print(ice.check_in_bloom(xsxa, _bits, _hashes, _bf))`

    the xsxa public key in byte representation is exactly contained in the array passed to the "Fill_in_bloom" function However, checking for presence in bloom - returns False

    PS public keys obtained using the "point_subtraction" function and added to bloom are checked and found. "check_in_bloom" function returns true

    opened by omskns 2
  • incremnet line by line print

    incremnet line by line print

    P4 = ice.point_sequential_increment(500000, P) P4[:65].hex() : '046ebfe8cd423c6c16fa29ce8aae12fa15b4ab78314773aa6453aa98b2bdcc10f66a43166c2f45267331dcf4a113aa584cd040fb0f8fe07326c28a8cb6b0f84149'

    above example print one line 65byte without this print is like first 10 pubkeys like this

    04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a04f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e67204e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd1351ed993ea0d455b75642e2098ea51448d967ae33bfbdfe40cfe97bdc47739922042f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d604fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556ae12777aacfbb620f3be96017f45c560de80f0f6518fe4a03c870c36b075f297045cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da042f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a015c4da8a741539949293d082a132d13b4c2e213d6ba5b7617b5da2cb76cbde90404acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbecc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c3704a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d704774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cbd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b

    how to get line by line print of selected 10, P or 500000, P ???

    also mention line by line cpub print please...

    opened by onetrader2022 1
Owner
iceland
Orion Nebula, M42
iceland
Bot Telegram per creare e gestire un Babbo Natale Segreto con amici ecc

Babbo Natale Segreto: Telegram Bot Bot Telegram per creare e gestire un Babbo Natale Segreto con amici ecc. Che cos'è? Il Babbo Natale Segreto è un gi

Francesco Ciociola 2 Jul 18, 2022
Bitcoin tracker hecho con python.

Bitcoin Tracker Precio del Bitcoin en tiempo real. Script simple hecho con python. Rollercoin RollerCoin es un juego en el que puedes ganar bitcoin (y

biyivi 3 Jan 4, 2022
Use an air-gapped Raspberry Pi Zero to sign for Bitcoin transactions! (and do other cool stuff)

Hello World! Build your own offline, airgapped Bitcoin transaction signing device for less than $35! Also generate seed word 24 or generate a seed phr

null 371 Dec 31, 2022
Trust-minimized Bitcoin wallet

coldcore Trust-minimized, airgapped Bitcoin management This is experimental software. Wait for a formal release before use with real funds. A trust-mi

James O'Beirne 121 Jan 1, 2023
Crypto trading bot that detects surges in the bitcoin price and executes trades.

The bot will be trading Bitcoin automatically if the price has increased by more than 3% in the last 10 minutes. We will have a stop loss of 5% and t

null 164 Oct 20, 2022
This is simply code for bitcoin fair value.

About The Project This is a code for bitcoin fair value, its simply exclude bubble data using RANSAC method, and then plot the results. Check youtube

BitcoinRaven 4 Mar 26, 2022
Bitcoin-chance-wheel - Try your luck at getting bitcoins

Program Features - ✍️ Why did we name this tool the Lucky Wheel? - ✍️ This tool

hack4lx 20 Dec 22, 2022
Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Harun Mbaabu Mwenda 46 Sep 1, 2022
A fast, easy to set up telegram userbot running Python 3 which uses fork of the Telethon Library.

forked from friendly-telegram/friendly-telegram Friendly Telegram Userbot A fast, easy to set up telegram userbot running Python 3 which uses fork of

GeekTG 75 Jan 4, 2023
toldium is a modular, fast, reliable and customizable multiplatform bot library for your communities

toldium The easy multiplatform bot toldium is a modular, fast, reliable and customizable multiplatform bot library for your communities, from a commun

Stockdroid Fans 5 Nov 3, 2021
Aio-binance-library - Async library for connecting to the Binance API on Python

aio-binance-library Async library for connecting to the Binance API on Python Th

GRinvest 10 Nov 21, 2022
MashaRobot : New Generation Telegram Group Manager Bot (🔸Fast 🔸Python🔸Pyrogram 🔸Telethon 🔸Mongo db )

MashaRobot Me On Telegram ✨ MASHA ✨ This is just a demo bot.. Don't try to add to your group.. Create your own bot How To Host The easiest way to depl

Mr Dark Prince 40 Oct 9, 2022
Super Fast Telegram UserBot Made With Python.

Description Super Fast Telegram UserBot Made With Python. LOGO Made With Support of All Userbots Dev's Dark-Venom is a Light-Weight Userbot. It's unde

null 2 Sep 14, 2021
domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time.

domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time

Naufal Ardhani 59 Dec 4, 2022
🚀 A fast, flexible and lightweight Discord API wrapper for Python.

Krema A fast, flexible and lightweight Discord API wrapper for Python. Installation Unikorn unikorn add kremayard krema -no-confirmation Pip pip insta

Krema 20 Sep 4, 2022
GroupMenter : New Telegram Group Manager Bot🔸Fast 🔸Python🔸Pyrogram 🔸

GroupMenter An PowerFull Group Manager Bot. Written In Pytelethon. Info • A modular Telegram Python bot running on python3. • Can be found on telegram

Group Menter 24 Jun 28, 2022
A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.

Light Gradient Boosting Machine LightGBM is a gradient boosting framework that uses tree based learning algorithms. It is designed to be distributed a

Microsoft 14.5k Jan 8, 2023
Fast IP address lookup

ipscoop Fast IP Scoop Table of Contents Installation CLI Getting Started Ref Installation To install ipscoop, simply: $ python3 -m pip install -U git+

null 6 Mar 16, 2022
⚡ A really fast and powerful Discord Token Checker

discord-token-checker ⚡ A really fast and powerful Discord Token Checker How To Use? Do pip install -r requirements.txt in your command prompt Make to

vida 25 Feb 26, 2022