pycoin | Python-based Bitcoin and alt-coin utility library | Cryptocurrency library
kandi X-RAY | pycoin Summary
kandi X-RAY | pycoin Summary
The pycoin library implements many utilities useful when dealing with bitcoin and some bitcoin-like alt-coins. It has been tested with Python 2.7, 3.6 and 3.7. See also [pycoinnet] for a library that speaks the bitcoin protocol.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create a Bitcoinish network
- Return the script for the given info
- Make an AddressAPI for the given script
- Compile a binary expression
- Create argument parser
- Arguments for read messages
- Iterate over all available networks
- Return the current netcode
- KU
- Parse a signed message
- Post - unpack a merkleblock
- Return an iterator that yields blocks from a blockfile
- Create OpenSSL optimizations
- Return public key pair
- Performs OP_CHECKSEQUENCE verification
- Sign a message
- Multiply a point by p
- Creates an unsigned tx for the given address
- Yield the ku output for a given address
- Get the best ripemd160 hash
- Return a dict with extra opcodes
- Multiply a given value by p
- Signs the contents of the transaction
- Load the library
- Create a function that returns a signature for the given script
- Generate a single transaction
pycoin Key Features
pycoin Examples and Code Snippets
from pycoin.ecdsa import generator_secp256k1, sign, verify
import hashlib, secrets
def sha3_256Hash(msg):
hashBytes = hashlib.sha3_256(msg.encode("utf8")).digest()
return int.from_bytes(hashBytes, byteorder="big")
def signECDSAsecp256k1(msg
repo_name, path, pkey = line.split(",")
sobakasu/vanitygen,README,5JLUmjZiirgziDmWmNprPsNx8DYwfecUNk1FQXmDPaoKB36fX1o
lekanovic/pycoin,tests/build_tx_test.py,5JMys7YfK72cRVTrbwkq5paxU7vgkMypB55KyXEtN5uSnjV7K8Y
wkit
def secret_exponent_to_wif(se, compressed):
blob = to_bytes_32(se)
if compressed:
blob += b'\01'
return BitcoinMainnet.ui.wif_for_blob(blob)
Community Discussions
Trending Discussions on pycoin
QUESTION
I had a simple EC library for C#, but it is gone and I can't find it on the web. It was previously published on MSDN, but the link is now dead.
I am trying to use the Bouncy Castle Library to accomplish similar tasks. I want to Create a curve (secp256k1), and I want to be able to do point arithmetic and view the raw point data.
i.e.:
G + 3 * G = 4 * G
p + q
4 * G - G = 3 * G
etc.
What namespaces do I need to include, how do I define / declare the curve, and how do I define my points? I have successfully (I believe...) included the Bouncy Castle .dll in my C# project.
I am NOT interested in creating keys or anything of that sort. Just EC point arithmetic. A different (simple) library that would allow me to do the these same operations would be just as good or better.
Thanks for the help.
EDIT: I have continued to work on this, and my code looks like this:
...ANSWER
Answered 2020-Aug-14 at 03:27Short answer: Use ECPoint.Normalize to return an ECPoint whose (X, Y) coordinates can be compared to PyCoin.
Details: By default (BouncyCastle's) ECPoint
operations are performed in projective coordinates; specifically what are usually called "Jacobian modified coordinates". This is for performance when performing a series of operations, especially a scalar multiplication. If you print out the value of e.g. twoG
using the provided ECPoint.ToString
method, you will see the extra coordinates present.
When you want to compare an ECPoint
to some (X, Y) value, you can call ECPoint.Normalize
, which returns a new ECPoint
where the Z coordinate is 1 and the X and Y coordinates are the affine values. It is a relatively expensive operation that is usually avoided until the final step of a larger calculation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pycoin
You can use pycoin like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page