Spaces:
Runtime error
Runtime error
# # Create smart contract instance | |
# contract = web3.eth.contract(address=contract_address, abi=abi) | |
import json | |
from web3 import Web3 | |
# Initialize endpoint URL | |
node_url = "https://filecoin-hyperspace.chainstacklabs.com/rpc/v0" | |
# Create the node connection | |
web3 = Web3(Web3.HTTPProvider(node_url)) | |
def get_contract(): | |
contract_abi = [ | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
} | |
], | |
"name": "retrieveDataset", | |
"outputs": [ | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
} | |
], | |
"name": "retrieveModel", | |
"outputs": [ | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
} | |
], | |
"name": "retrievePaper", | |
"outputs": [ | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", | |
"name": "", | |
"type": "string" | |
} | |
], | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", | |
"name": "_ipfshash", | |
"type": "string" | |
} | |
], | |
"name": "storeDataset", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", | |
"name": "_ipfshash", | |
"type": "string" | |
} | |
], | |
"name": "storeModel", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
}, | |
{ | |
"internalType": "string", | |
"name": "_ipfshash", | |
"type": "string" | |
} | |
], | |
"name": "storePaper", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
} | |
], | |
"name": "voteDataset", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
} | |
], | |
"name": "voteModel", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"internalType": "string", | |
"name": "_name", | |
"type": "string" | |
} | |
], | |
"name": "votePaper", | |
"outputs": [], | |
"stateMutability": "nonpayable", | |
"type": "function" | |
} | |
] | |
address = '0x8A3BFF2474dF2331Ed667082ae99A4E69eAAb967' | |
contract = web3.eth.contract(address = address , abi = contract_abi) | |
return contract |