Spaces:
Build error
Build error
Create blockchain.py
Browse files- blockchain.py +15 -0
blockchain.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from web3 import Web3
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
+
class BlockchainManager:
|
| 5 |
+
def __init__(self):
|
| 6 |
+
# Using free public Ethereum testnet
|
| 7 |
+
self.w3 = Web3(Web3.HTTPProvider('https://rpc.sepolia.org'))
|
| 8 |
+
|
| 9 |
+
def create_inheritance_record(self, heir_id, assets):
|
| 10 |
+
# Simple smart contract deployment using local signing
|
| 11 |
+
contract = self.w3.eth.contract(
|
| 12 |
+
abi=self.get_contract_abi(),
|
| 13 |
+
bytecode=self.get_contract_bytecode()
|
| 14 |
+
)
|
| 15 |
+
return contract.functions.recordInheritance(heir_id, json.dumps(assets)).call()
|