Beispiel #1
0
 def http_web3():
     # return Web3(HTTPProvider('https://'+infura_host+'/'+settings.INFURA_KEY))
     return Web3(Web3.RPCProvider(
         host=infura_host,
         path=settings.INFURA_KEY,
         port='443',
         ssl=1))
 def __init__(self, ipfs_hash):
     self.ipfs_hash = ipfs_hash
     web3 = Web3(Web3.RPCProvider(host=os.environ['WEB3_HOST']))
     manager = Web3.PrivateKeySigningManager(web3._requestManager)
     manager.register_private_key(os.environ['WEB3_PRIV_KEY'])
     web3.setManager(manager)
     self.contract = web3.eth.contract(abi=json.loads(abi),
                                       address=os.environ['ROUTE_MUTEX'])
     self.account = manager.keys.keys()[0]
Beispiel #3
0
import pandas as pd
from web3 import Web3
from eth_utils import from_wei
from abis import auction_abi, wallet_abi

BID_OUTPUT_FILENAME = 'bids.csv'
TX_OUTPUT_FILENAME = 'txs.csv'

CONTRACT_CREATION_BLOCK = 4383437

web3 = Web3(Web3.RPCProvider())

auction_contract = web3.eth.contract(AUCTION_ADDRESS, abi=auction_abi)
wallet_abi = web3.eth.contract(WALLET_ADDRESS, abi=wallet_abi)


def fetch_bids():
    """Get all bid events and return them as a dataframe."""
    # get bid events
    log_filter = auction_contract.on('BidSubmission',
                                     {'fromBlock': CONTRACT_CREATION_BLOCK})
    events = log_filter.get(only_changes=False)
    df = pd.DataFrame({
        'amount':
        [from_wei(event['args']['_amount'], 'ether') for event in events],
        'missing': [
            from_wei(event['args']['_missing_funds'], 'ether')
            for event in events
        ],
        'sender': [event['args']['_sender'] for event in events],
        'block': [event['blockNumber'] for event in events],