Previous topic

Records

This Page

Ethereum

class hashchain.ethereum.connector.EthConnector(contract_abi, contract_address, sender_public_key, sender_private_key, provider_url)[source]

Connector to interact with a smart contract on the Ethereum blockchain.

get_record(key)[source]

Get the record hash from the smart contract storage

Parameters

key (str) – unique key

Return type

str

Returns

hexadecimal string of the hash

record(key, hash, wait=False)[source]

Records the key and hash in the smart contract storage

Parameters
  • key (str) – indexed key, used to retrieve the hash

  • hash (str) – hash of the record

  • wait – wait for the transaction to receipt before completing

Return type

str

Returns

transaction hash

class hashchain.ethereum.contract.EthContract[source]

Solidity contract encapsulated in a Python object

deploy(sender_public_key, sender_private_key, provider_url)[source]

Deploy the Solidity Smart contract to the Ethereum blockchain

Parameters
  • sender_public_key (str) – public key of the sender

  • sender_private_key (str) – private key of the sender

  • provider_url (str) – address of the Ethereum connection provider

Return type

str

Returns

hexadecimal string of the hash of the transaction hash

get_txn_receipt()[source]

Wait until the transaction receipt is available and add the address variable to EthContract and returns the transaction receipt of the contract creation transaction.

Return type

dict

Returns

transaction receipt