Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,11 +46,19 @@ def upload_to_blockchain(hash):
|
|
| 46 |
|
| 47 |
# Call your function: 11155111 is Sepolia's id
|
| 48 |
call_function = contract.functions.storeHash(hash).build_transaction({"chainId": 11155111,
|
|
|
|
| 49 |
"nonce": w3.eth.get_transaction_count(st.secrets["EthWallet"])})
|
| 50 |
|
| 51 |
# Sign transaction
|
| 52 |
signed_tx = w3.eth.account.sign_transaction(call_function, private_key=st.secrets["pk"])
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
# Send transaction
|
| 55 |
send_tx = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
|
| 56 |
|
|
|
|
| 46 |
|
| 47 |
# Call your function: 11155111 is Sepolia's id
|
| 48 |
call_function = contract.functions.storeHash(hash).build_transaction({"chainId": 11155111,
|
| 49 |
+
"from": st.secrets["EthWallet"],
|
| 50 |
"nonce": w3.eth.get_transaction_count(st.secrets["EthWallet"])})
|
| 51 |
|
| 52 |
# Sign transaction
|
| 53 |
signed_tx = w3.eth.account.sign_transaction(call_function, private_key=st.secrets["pk"])
|
| 54 |
|
| 55 |
+
print("Sending from:", st.secrets["EthWallet"])
|
| 56 |
+
print("To contract:", st.secrets["ContractAddress"])
|
| 57 |
+
print("Function input (IPFS hash):", hash)
|
| 58 |
+
print("Nonce:", w3.eth.get_transaction_count(st.secrets["EthWallet"]))
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
# Send transaction
|
| 63 |
send_tx = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
|
| 64 |
|