A social gathering or a form of rotating savings and credit association
- There are 3 people that submit same amount 0.05 ether to a contract
- The contract is lock for 1 day
- Any of the people can withdraw after the locking period
- Then the contract destroy
backup from web3 import Web3
w3 = Web3(Web3.HTTPProvider('your_node_url'))
contract_address = '0xYourContractAddress'
private_key = '0xYourPrivateKey'
contract_abi = [ { "constant": True, "inputs": [], "name": "getRemainingTime", "outputs": [{"name": "", "type": "uint256"}], "payable": False, "stateMutability": "view", "type": "function", } ]
contract = w3.eth.contract(address=contract_address, abi=contract_abi)
account_address = '0xYourAccountAddress'
transaction = contract.functions.getRemainingTime().buildTransaction({ 'from': account_address, 'gas': 200000, 'gasPrice': w3.toWei('50', 'gwei'), # Replace '50' with your desired gas price in gwei 'nonce': w3.eth.getTransactionCount(account_address), })
signed_transaction = w3.eth.account.sign_transaction(transaction, private_key)
result = w3.eth.call({ 'to': contract_address, 'data': signed_transaction.rawTransaction })
remaining_time = int(result, 16) print(f'Remaining Time: {remaining_time} seconds')