Пример #1
0
    def __init__(self):
        self.w3 = Web3(HTTPProvider('http://localhost:8545'))
        Shh.attach(self.w3, "shh")
        self.shh = self.w3.shh
        #Chain ID of Ropsten Test Net is 3, replace it to 1 for Main Net
        self.chainId = self.w3.net.chainId
        self.defaultTopic = "0x5a4ea131"
        self.privateKey = '0x862e3b865d47553509e7e97229a6e868c6656dd654799dd411ffbdcf8f2fa800'
        self.defaultRecipientPubKey = ''
        self.defaultPwd = 'core2duo'
        self.kid = ''
        self.defaultkId = '8158692724d0353cdf336f843ebea2de6932d811e2e6b06cb5c18bec67d37866'
        self.payloadMsg = ''

        self.data = {
            'msgs': '',
            'text': "",
            'symKeyId': '',
            'name': "",
            'asymKeyId': '',
            'sympw': "",
            'asym': True,
            'configured': False,
            'topic': self.defaultTopic,
            'recipientPubKey': self.defaultRecipientPubKey,
            'asymPubKey': ""
        }
        self.data['symKeyId'] = self.shh.generateSymKeyFromPassword(
            self.defaultPwd)
        print('data: ', self.data)
        self.getFilterMessage()
Пример #2
0
    address_to = b_pubKey
    #address_to = a_pubKey
    host = "http://localhost:8500"
    #host = "http://localhost:8501"
else:
    print("Unknown node")
    sys.exit(0)

# Connection
#---------------------------------------------------------------------

print("host", host)
web3 = Web3(HTTPProvider(host))
from web3.shh import Shh

Shh.attach(web3, "shh")

#kId = web3.shh.addPrivateKey(keyPair)
#pubKey = web3.shh.getPublicKey(kId)

# A sending messages to B and B then checking

# keyPair used for decryption
print("keyPair for filter", keyPair)
myFilter = pollFilter(topic, keyPair)

print("yo sending")
sendMessage(address_to, topic, "hello")
sendMessage(address_to, topic, "hi also")

# XXX this works, well hell a does
Пример #3
0
def include_shh_module(web3):
    Shh.attach(web3, "shh")
Пример #4
0
def include_shh_module(web3):
    Shh.attach(web3, "shh")