feat: add web3 config

This commit is contained in:
snsd0805 2024-05-31 01:51:29 +08:00
parent 5afd668379
commit 87646d9661
Signed by: snsd0805
GPG Key ID: 569349933C77A854
2 changed files with 11 additions and 1 deletions

9
constant.py Normal file
View File

@ -0,0 +1,9 @@
# web3 provider information
# include provider HTTPS endpoint URL & its API Key.
# Alchemy is a good choice for Web3 provider
WEB3_PROVIDER_URL = "https://eth-sepolia.g.alchemy.com/v2/"
WEB3_PROVIDER_KEY = ""
# Please write down your wallet key to sign a transaction with our contract.
WALLET_KEY = ""

View File

@ -5,6 +5,7 @@ import time
import docker
from web3 import Web3
from src.scheduler import Scheduler
from constant import *
class NodeManager():
def __init__(self, host, port):
@ -28,7 +29,7 @@ class NodeManager():
self.docker_client = docker.from_env()
# web3 provider
self.w3 = Web3(Web3.HTTPProvider('https://eth-sepolia.g.alchemy.com/v2/'+ALCHEMY_KEY))
self.w3 = Web3(Web3.HTTPProvider(WEB3_PROVIDER_URL + WEB3_PROVIDER_KEY))
time.sleep(2)