{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "This is the Python core library of the Ethereum project.\n\nFor the python based command line client see:\nhttps://github.com/ethereum/pyethapp\n\nInstallation:\n-------------\n\n``sudo apt-get install libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev``\n\n``git clone https://github.com/ethereum/pyethereum/``\n\n``cd pyethereum``\n\n``python setup.py install``\n\nComponents\n----------\n\nethereum.pow.chain\n~~~~~~~~~~~~~~~~~~\n\nContains the Chain class, which can be used to manage a blockchain. Main\nmethods are:\n\n- ``__init__(genesis=None, env=None, new_head_cb=None, reset_genesis=False, localtime=None)``\n - initializes with the given genesis. ``env`` specifies the\n *environment* (including chain config and database), ``new_head_cb``\n is a callback called when a new head is added, and ``localtime`` is\n what the chain assumes is the current timestamp. The genesis can be:\n\n - None - in which case it assumes ``env`` is given, and creates a\n Chain object with the data saved in ``env.db``. If\n ``reset_genesis`` is set, it re-initializes the chain.\n - A ``State`` object\n - A genesis declaration\n - A state snapshot (``State.snapshot()``)\n - An allocation (ie. dict\n ``{address: {balance: 1, nonce: 2, code: b'\\x03\\x04\\x05', storage: {\"0x06\": \"0x07\"}}}``)\n\n- ``add_block(block)`` - adds a block to the chain\n- ``process_time_queue(timestamp)`` - tells the chain that the current\n time has increased to the new timestamp. The chain will then process\n any blocks that were unprocessed because they appeared too \"early\"\n- ``get_blockhash_by_number(num)`` - get the block hash of a block at\n the given block number\n- ``get_block(hash)`` - gets the block with the given blockhash\n- ``get_block_by_number(num)`` - equivalent to\n ``get_block(get_blockhash_by_number(num))``\n- ``get_parent(block)`` - gets the parent of a block\n- ``get_children(block)`` - gets the children of a block\n- ``head`` (property) - gets the block at the head of the chain\n- ``state`` (property) - gets the state at the head of the chain\n- ``mk_poststate_of_blockhash(hash)`` - creates a state object after a\n given block\n- ``has_block(block)`` - is that block in the chain? Returns True/False\n- ``get_chain(from, to)`` - roughly equivalent to\n ``[get_block_by_number(i) for i in range(from, to)]``, though\n automatically stops if it reaches the head. ``from`` can be elided to\n start from genesis, ``to`` can be elided to go up to the head.\n- ``get_tx_position(tx)`` - if the transaction is in the chain, returns\n ``(blknum, index)`` where ``blknum`` is the block number of the block\n that contains the transaction and ``index`` is its position in the\n block\n\nethereum.state\n~~~~~~~~~~~~~~\n\nContains the State class, which is used to manage a state. Main methods\nare:\n\n- ``__init__(root_hash, env, **kwargs)`` - initializes a state with the\n given root hash, the given env (which includes a config and database)\n and the given auxiliary arguments. These include:\n\n - ``txindex`` - the transaction index\n - ``gas_used`` - amount of gas used\n - ``gas_limit`` - block gas limit\n - ``block_number`` - block number\n - ``block_coinbase`` - block coinbase address\n - ``block_difficulty`` - block difficulty\n - ``timestamp`` - timestamp\n - ``logs`` - logs created so far\n - ``receipts`` - receipts created so far (from previous transactions\n in the current block)\n - ``bloom`` - the bloom filter\n - ``suicides`` - suicides (or selfdestructs, the newer more\n politically correct synonym)\n - ``recent_uncles`` - recent uncle blocks in the chain\n - ``prev_headers`` - previous block headers\n - ``refunds`` - suicide/selfdestruct refund counter\n\nPyethereum follows a **maximally state-centric model**; the ONLY\ninformation needed to process a transaction or a block is located within\nthe state itself, allowing the actual state transition logic to be a\nvery clean ``apply_transaction(state, tx)`` and\n``apply_block(state, block)``.\n\n- ``get_balance``- gets the balance of an account\n- ``get_code`` - gets the code of an account\n- ``get_storage_data(addr, k)`` - gets the storage at the given key of\n the given address. Expects a key in **numerical** form (eg. b\"cow\" or\n \"0x636f77\" is represented as 6516599).\n- ``to_snapshot(root_only=False, no_prevblocks=False)`` - creates a\n snapshot for the current state. If ``root_only`` is set, only adds\n the state root, not the entire state. If ``no_prevblocks`` is set,\n does not add previous headers and uncles. Setting either of those\n flags means that the same database would be required to recover from\n the snapshot.\n- ``from_snapshot(snapshot, env)`` (classmethod) - creates a state from\n the given snapshot with the given ``env``.\n- ``ephemeral_clone()`` - creates a clone of the state that you can\n work with without affecting the original\n\nThere are also many methods that modify the state, eg. ``set_code``,\n``set_storage_data``, but it is generally recommended to avoid using\nthese, and instead modify the state ONLY through ``apply_transaction``\nand ``apply_block``.\n\nethereum.meta\n~~~~~~~~~~~~~\n\nThis file contains two functions:\n\n- ``apply_block(state, block)`` - takes a state and processes a block\n onto that state\n- ``make_head_candidate(chain, txqueue=None, parent=None, timestamp, coinbase, extra_data, min_gasprice=0)``\n - creates a candidate block for the chain on top of the given parent\n block (default: head of the chain). Gets transactions from the given\n ``txqueue`` object with the given ``mingasprice`` (otherwise does not\n add transactions). ``timestamp``, ``coinbase`` and ``extra_data`` can\n be used to specify those parameters in the block; otherwise defaults\n are used\n\nethereum.messages\n~~~~~~~~~~~~~~~~~\n\nThe main function that should be called from here is\n``apply_transaction(state, tx)``.\n\nethereum.utils\n~~~~~~~~~~~~~~\n\nContains a bunch of utility functions, including:\n\nNumerical and hex conversions\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- ``encode_int(i)`` - converts an integer into big-endian binary\n representation\n- ``zpad(data, length)`` - pads the data up to the desired length by\n adding zero bytes on the left\n- ``encode_int32(i)`` - equivalent to ``zpad(encode_int(i), 32)`` but\n faster\n- ``big_endian_to_int(d)`` - converts binary data into an integer\n- ``encode_hex(b)`` - converts bytes to hex\n- ``decode_hex(h)`` - converts hex to bytes\n- ``int_to_addr(i)`` - converts integer to address\n- ``is_numeric(i)`` - returns True if the value is int or long,\n otherwise False\n\nCryptography\n^^^^^^^^^^^^\n\n- ``sha3(data)`` - computes the SHA3 (or more precisely, keccak256)\n hash\n- ``ecrecover_to_pub(hash, v, r, s)`` - recovers the public key that\n made the signature as a 64-byte binary blob of\n ``encode_int32(x) + encode_int32(y)``. Hashing this and taking the\n last 20 bytes gives the *address* that signed a message.\n- ``ecsign(hash, key)`` - returns the v, r, s values of a signature\n- ``normalize_key(key)`` - converts a key from many formats into\n 32-byte binary\n- ``privtoaddr(key)`` - converts a key to an address\n\nAddresses\n^^^^^^^^^\n\n- ``normalize_address(addr)`` - converts an address into 20-byte binary\n form\n- ``check_checksum(addr)`` - returns True if the address checksum\n passes, otherwise False\n- ``checksum_encode(addr)`` - converts an address into hex form with a\n checksum\n- ``mk_contract_address(addr, nonce)`` - creates the address of a\n contract created by the given address with the given nonce\n\nMiscellaneous\n^^^^^^^^^^^^^\n\n- ``denoms`` - contains the denominations of ether, eg.\n ``denoms.finney = 10**15``, ``denoms.shannon = 10**9``,\n ``denoms.gwei = 10**9``\n\nethereum.block\n~~~~~~~~~~~~~~\n\nContains the ``Block`` and ``BlockHeader`` classes. Generally\nrecommended to avoid creating blocks and block headers directly, instead\nusing ``mk_head_candidate``. The member variables are straightforward:\n\n- ``block.transactions`` - transactions in a block\n- ``block.uncles`` - uncles in a block\n- ``block.header`` - header of a block\n\nAnd in the header:\n\n- ``header.hash`` - the hash (also the block hash)\n- ``header.mining_hash`` - the hash used for proof of work mining\n- ``header.to_dict()`` - serializes into a human-readable dict\n- ``header.prevhash`` - previous block hash\n- ``header.uncles_hash`` - hash of the uncle list\n- ``header.coinbase`` - coinbase (miner) address\n- ``header.state_root`` - root hash of the post-state\n- ``header.tx_list_root`` - hash of the transactions in the block\n- ``header.receipts_root`` - hash of the receipt trie\n- ``header.bloom`` - bloom filter\n- ``header.difficulty`` - block difficulty\n- ``header.number`` - block number\n- ``header.gas_limit`` - gas limit\n- ``header.gas_used`` - gas used\n- ``header.timestamp`` - timestamp\n- ``header.extra_data`` - block extra data\n- ``header.mixhash`` and ``header.nonce`` - Ethash proof of work values\n\nethereum.transactions\n~~~~~~~~~~~~~~~~~~~~~\n\nContains the Transaction class, with the following methods and values:\n\n- ``__init__(nonce, gasprice, startgas, to, value, data, (v, r, s optional))``\n - constructor\n- ``sign(key, network_id=None)`` - signs the transaction with the given\n key, and with the given EIP155 chain ID (leaving as None will create\n a pre-EIP155 tx, be warned of replay attacks if you do this!)\n- ``sender`` - the sender address of the transaction\n- ``network_id`` - the EIP155 chain ID of the transaction\n- ``hash`` - the hash of the transaction\n- ``to_dict()`` - serializes into a human-readable dict\n- ``intrinsic_gas_used`` - the amount of gas consumed by the\n transaction, including the cost of the tx data\n- ``creates`` - if the transaction creates a contract, returns the\n contract address\n- ``nonce``, ``gasprice``, ``startgas``, ``to``, ``value``, ``data``,\n ``v``, ``r``, ``s`` - parameters in the transaction\n\nethereum.tools.keys\n~~~~~~~~~~~~~~~~~~~\n\nCreates encrypted private key storaes\n\n- ``decode_keystore_json(jsondata, password)`` - returns the private\n key from an encrypted keystore object. NOTE: if you are loading from\n a file, the most convenient way to do this is\n ``import json; key = decode_keystore_json(json.load(open('filename.json')), 'password')``\n- ``make_keystore_json(key, pw, kdf='pbkdf2', cipher='aes-128-ctr')`` -\n creates an encrypted keystore object for the key. Keeping ``kdf`` and\n ``cipher`` at their default values is recommended.\n\nethereum.abi\n~~~~~~~~~~~~\n\nMost compilers for HLLs (solidity, serpent, viper, etc) on top of\nEthereum have the option to output an ABI declaration for a program.\nThis is a json object that looks something like this:\n\n::\n\n [{\"name\": \"ecrecover(uint256,uint256,uint256,uint256)\", \"type\": \"function\", \"constant\": false,\n \"inputs\": [{\"name\": \"h\", \"type\": \"uint256\"}, {\"name\": \"v\", \"type\": \"uint256\"}, {\"name\": \"r\", \"type\": \"uint256\"}, {\"name\": \"s\", \"type\": \"uint256\"}],\n \"outputs\": [{\"name\": \"out\", \"type\": \"int256[]\"}]},\n {\"name\": \"PubkeyTripleLogEvent(uint256,uint256,uint256)\", \"type\": \"event\",\n \"inputs\": [{\"name\": \"x\", \"type\": \"uint256\", \"indexed\": false}, {\"name\": \"y\", \"type\": \"uint256\", \"indexed\": false}, {\"name\": \"z\", \"type\": \"uint256\", \"indexed\": false}]}]\n\nYou can initialize an ``abi.ContractTranslator`` object to encode and\ndecode data for contracts as follows:\n\n::\n\n true, false = True, False \n ct = abi.ContractTranslator() \n txdata = ct.encode('function_name', [arg1, arg2, arg3]) \n\nYou can also call ``ct.decode_event([topic1, topic2...], logdata)`` to\ndecode a log.\n\nRLP encoding and decoding\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFor any transaction or block, you can simply do:\n\n::\n\n import rlp \n bindata = rlp.encode() \n\nTo decode:\n\n::\n\n import rlp \n from ethereum.transactions import Transaction \n rlp.decode(blob, Transaction) \n\nOr:\n\n::\n\n import rlp \n from ethereum.blocks import Block \n rlp.decode(blob, Block) \n\nConsensus abstraction\n~~~~~~~~~~~~~~~~~~~~~\n\nThe pyethereum codebase is designed to be maximally friendly for use\nacross many different consensus algorithms. If you want to add a new\nconsensus algo, you'll need to take the following steps:\n\n- Add a directory alongside ``pow``, and in it create a ``chain.py``\n class that implements a ``Chain`` module. This may have a totally\n different fork choice rule for proof of work (GHOST, signature\n counting, Casper, etc).\n- Add an entry to ``consensus_strategy.py``. You will need to\n implement:\n\n - ``check_seal`` - check that a block is correctly \"sealed\" (mined,\n signed, etc)\n - ``validate_uncles(state, block)`` - check that uncles are valid\n - ``initialize(state, block)`` - called in ``apply_block`` before\n transactions are processed\n - ``finalize(state, block)`` - called in ``apply_block`` after\n transactions are processed\n - ``get_uncle_candidates(chain, state)`` - called in\n ``mk_head_candidate`` to include uncles in a block\n\n- Create a chain config with the ``CONSENSUS_STRATEGY`` set to whatever\n you named your new consensus strategy\n\nTester module\n-------------\n\nSee https://github.com/ethereum/pyethereum/wiki/Using-pyethereum.tester\n\nTests\n-----\n\nRun ``python3.6 -m pytest ethereum/tests/`` for any .py file\nin that directory. Currently all tests are passing except for a few\nMetropolis-specific state tests and block tests.\n\nTo make your own state tests, use the tester module as follows:\n\n::\n\n from ethereum.tools import tester as t \n import json \n c = t.Chain() \n x = c.contract(, language=) \n pre = t.mk_state_test_prefill(c) \n x.foo() \n post = t.mk_state_test_postfill(c, pre) \n open('output.json', 'w').write(json.dumps(post, indent=4)) \n\nTo make a test filler file instead, do\n``post = t.mk_state_test_postfill(c, pre, True)``.\n\nLicense\n-------\n\nSee `LICENSE `_\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AugurProject/pyethereum", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ethereum-augur-temp2", "package_url": "https://pypi.org/project/ethereum-augur-temp2/", "platform": "", "project_url": "https://pypi.org/project/ethereum-augur-temp2/", "project_urls": { "Homepage": "https://github.com/AugurProject/pyethereum" }, "release_url": "https://pypi.org/project/ethereum-augur-temp2/2.0.6/", "requires_dist": [ "PyYAML", "pbkdf2", "py-ecc", "pyethash", "pysha3 (>=1.0.1)", "repoze.lru", "rlp (>=0.4.7)", "scrypt" ], "requires_python": "", "summary": "Next generation cryptocurrency network", "version": "2.0.6" }, "last_serial": 3215970, "releases": { "2.0.4": [], "2.0.5": [ { "comment_text": "", "digests": { "md5": "0d0d3db39493d2cea610834a8a578223", "sha256": "c2c5bd00cf9a5f34d31c44c3adf9aea15cf452e45fb4928c22795125bd55c7b6" }, "downloads": -1, "filename": "ethereum_augur_temp2-2.0.5-py2-none-any.whl", "has_sig": false, "md5_digest": "0d0d3db39493d2cea610834a8a578223", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 166207, "upload_time": "2017-10-01T03:48:59", "url": "https://files.pythonhosted.org/packages/52/1f/81279e9a83504fe31f5f4db4768b9d939a449bbf06ba631dbda39d2868a9/ethereum_augur_temp2-2.0.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c2a7bec3f0499e1ed66932a285eb3edf", "sha256": "02778f630338973a6a69781dd575c4601b8d9b1d6f48716852baea778237c23b" }, "downloads": -1, "filename": "ethereum-augur-temp2-2.0.5.tar.gz", "has_sig": false, "md5_digest": "c2a7bec3f0499e1ed66932a285eb3edf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 138800, "upload_time": "2017-10-01T03:49:04", "url": "https://files.pythonhosted.org/packages/4c/64/1319b82f1c416fc966938db4c6324b9c166d4f3a2dec72ccf010738690a0/ethereum-augur-temp2-2.0.5.tar.gz" } ], "2.0.6": [ { "comment_text": "", "digests": { "md5": "0f9c43b33ca978812209d4814e6ba069", "sha256": "9727d35f73f5a1fc937502d5865aa005527019cc3cd5db298c138b749fae9d24" }, "downloads": -1, "filename": "ethereum_augur_temp2-2.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "0f9c43b33ca978812209d4814e6ba069", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 166208, "upload_time": "2017-10-01T03:51:10", "url": "https://files.pythonhosted.org/packages/a4/05/f3acc4e2fb12277f638fbc7dcff34ecefe9fd063725915b791f4f595dfeb/ethereum_augur_temp2-2.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "806415822d2baa7894665f13fc6fc2b3", "sha256": "20cda765d2ee0223c11c9a398fe4018b5cd53f7ea29d907256a5516a13a28794" }, "downloads": -1, "filename": "ethereum-augur-temp2-2.0.6.tar.gz", "has_sig": false, "md5_digest": "806415822d2baa7894665f13fc6fc2b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 138806, "upload_time": "2017-10-01T03:51:13", "url": "https://files.pythonhosted.org/packages/50/5e/b32bf03235ce27b48b356ed5791a359161e4eb8ebc271ce4a3625d53dd99/ethereum-augur-temp2-2.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0f9c43b33ca978812209d4814e6ba069", "sha256": "9727d35f73f5a1fc937502d5865aa005527019cc3cd5db298c138b749fae9d24" }, "downloads": -1, "filename": "ethereum_augur_temp2-2.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "0f9c43b33ca978812209d4814e6ba069", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 166208, "upload_time": "2017-10-01T03:51:10", "url": "https://files.pythonhosted.org/packages/a4/05/f3acc4e2fb12277f638fbc7dcff34ecefe9fd063725915b791f4f595dfeb/ethereum_augur_temp2-2.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "806415822d2baa7894665f13fc6fc2b3", "sha256": "20cda765d2ee0223c11c9a398fe4018b5cd53f7ea29d907256a5516a13a28794" }, "downloads": -1, "filename": "ethereum-augur-temp2-2.0.6.tar.gz", "has_sig": false, "md5_digest": "806415822d2baa7894665f13fc6fc2b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 138806, "upload_time": "2017-10-01T03:51:13", "url": "https://files.pythonhosted.org/packages/50/5e/b32bf03235ce27b48b356ed5791a359161e4eb8ebc271ce4a3625d53dd99/ethereum-augur-temp2-2.0.6.tar.gz" } ] }