コード例 #1
0
ファイル: test_root_chain.py プロジェクト: zhouer/plasma-cash
 def contract(self, tester_chain):
     deployer = Deployer()
     abi, bytecode, contract_name = deployer.compile_contract(
         'RootChain/RootChain.sol')
     address = tester_chain.chain.tx(sender=tester_chain.k0,
                                     to=b'',
                                     startgas=(4 * 10**6),
                                     value=0,
                                     data=utils.decode_hex(bytecode))
     tester_chain.chain.mine()
     return tester_chain.ABIContract(tester_chain.chain, abi, address)
コード例 #2
0
def get_child_chain():
    authority = plasma_config['AUTHORITY']
    root_chain = Deployer().get_contract('RootChain/RootChain.sol')
    return ChildChain(authority, root_chain)
コード例 #3
0
 def get_root_chain(self):
     if self._root_chain is None:
         self._root_chain = Deployer().get_contract('RootChain/RootChain.sol')
     return self._root_chain
コード例 #4
0
ファイル: client.py プロジェクト: yuzushioh/plasma-cash
 def __init__(self,
              root_chain=Deployer().get_contract('RootChain/RootChain.sol'),
              child_chain=ChildChainService('http://localhost:8546')):
     self.root_chain = root_chain
     self.child_chain = child_chain
コード例 #5
0
def deploy_contracts():
    Deployer().deploy_contract('RootChain/RootChain.sol')
コード例 #6
0
from plasma_cash.root_chain.deployer import Deployer

from ethereum import utils
import time

last_block = 1
plasma_latest_block = 0
last_submit_block = 0

f = open('config.json', 'r')
config = json.load(f)
f.close()
operator_key = config['op_Key']
authority = utils.privtoaddr(operator_key)
authority_address = w3.toChecksumAddress('0x' + authority.hex())
root_chain = Deployer().get_contract('RootChain/RootChain.sol')

twothirds = 1


class Block(object):
    def __init__(self, blkRoot, blkNum, isDepositBlock, depositTx,
                 depositTxProof):
        self.blkRoot = blkRoot
        self.blkNum = blkNum
        self.isDepositBlock = isDepositBlock
        self.depositTx = depositTx
        self.depositTxProof = depositTxProof
        self.signature = set()

    def add_signature(self, signature):
コード例 #7
0
 def get_child_chain(self):
     if self._child_chain is None:
         authority = plasma_config['AUTHORITY']
         root_chain = Deployer().get_contract('RootChain/RootChain.sol')
         self._child_chain = ChildChain(authority, root_chain)
     return self._child_chain