コード例 #1
0
    def __init__(self):
        self.w3 = Web3(HTTPProvider('http://localhost:8545'))
        self.root_chain = Deployer().deploy_contract('RootChain', concise=False)
        self.child_chain = ChildChain(AUTHORITY['address'], self.root_chain)

        self.transactions = []
        self.accounts = []
コード例 #2
0
 def __init__(self):
     self.root_chain = Deployer().deploy_contract('RootChain',
                                                  concise=False)
     self.child_chain = ChildChain(AUTHORITY['address'], self.root_chain)
     print("child chain {0}".format(self.child_chain))
     print("init {0}".format(AUTHORITY['address']))
     self.confirmations = {}
     self.accounts = []
コード例 #3
0
 def __init__(self,
              root_chain_provider=HTTPProvider('http://localhost:8545'),
              child_chain_url="http://localhost:8546/jsonrpc"):
     deployer = Deployer(root_chain_provider)
     self.root_chain = deployer.get_contract_at_address("RootChain",
                                                        CONTRACT_ADDRESS,
                                                        concise=True)
     self.child_chain = ChildChainService(child_chain_url)
コード例 #4
0
 def __init__(self,
              root_chain_address,
              root_chain_provider=HTTPProvider('http://localhost:8545'),
              child_chain_url="http://localhost:8546/jsonrpc"):
     deployer = Deployer(root_chain_provider)
     root_chain_address = Web3.toChecksumAddress(root_chain_address)
     self.root_chain = deployer.get_contract_at_address("RootChain",
                                                        root_chain_address,
                                                        concise=True)
     self.child_chain = ChildChainService(child_chain_url)
コード例 #5
0
 def __init__(self, root_chain_provider=None, child_chain_url="http://localhost:8546/jsonrpc"):
     if root_chain_provider is None:
         if plasma_config['NETWORK'].startswith("wss://"):
             root_chain_provider = WebsocketProvider(plasma_config['NETWORK'])
         else:
             root_chain_provider = HTTPProvider(plasma_config['NETWORK'])
     self.deployer = Deployer(root_chain_provider)
     self.w3 = self.deployer.w3
     self.root_chain = self.deployer.get_contract_at_address("RootChain", plasma_config['ROOT_CHAIN_CONTRACT_ADDRESS'], concise=False)
     self.child_chain = ChildChainService(child_chain_url)
コード例 #6
0
ファイル: conftest.py プロジェクト: wjh1001/plasma-mvp
 def create_contract(path, args=(), sender=t.k0):
     abi, hexcode, _ = Deployer().compile_contract(path, args)
     bytecode = u.decode_hex(hexcode)
     ct = ContractTranslator(abi)
     code = bytecode + (ct.encode_constructor_arguments(args) if args else b'')
     address = t.chain.tx(sender=sender, to=b'', startgas=(4 * 10 ** 6), value=0, data=code)
     return t.ABIContract(t.chain, abi, address)
コード例 #7
0
    def __init__(self):
        self.w3 = Web3(HTTPProvider('http://localhost:8545'))
        self.root_chain = Deployer().deploy_contract('RootChain', concise=False)
        self.child_chain = ChildChain(bytes.fromhex(AUTHORITY['address'][2:]), self.root_chain)

        self.transactions = []
        self.accounts = []

        self.handlers = dict()

        # Register handlers
        self.register_handler('Deposit', self.deposit)
        self.register_handler('Transfer', self.transfer)
        self.register_handler('SubmitBlock', self.submit_block)
        self.register_handler('Confirm', self.confirm)
        self.register_handler('Withdraw', self.withdraw)
コード例 #8
0
ファイル: client.py プロジェクト: sihoang/plasma-mvp
 def __init__(self,
              root_chain_provider=HTTPProvider('http://localhost:8545'),
              child_chain_url="http://localhost:8546/jsonrpc"):
     deployer = Deployer(root_chain_provider)
     abi = json.load(open("contract_data/RootChain.json"))
     self.root_chain = deployer.w3.eth.contract(
         abi,
         plasma_config['ROOT_CHAIN_CONTRACT_ADDRESS'],
         ContractFactoryClass=ConciseContract)
     self.child_chain = ChildChainService(child_chain_url)
コード例 #9
0
def main(root_chain_address, eth_node_endpoint):
    global child_chain
    root_chain_address = Web3.toChecksumAddress(root_chain_address)

    root_chain = Deployer(eth_node_endpoint).get_contract_at_address(
        "RootChain", root_chain_address, concise=False)
    print("root_chain is %s" % root_chain)
    child_chain = ChildChain(root_chain, eth_node_endpoint)

    run_simple('0.0.0.0', 8546, application)
コード例 #10
0
 def __init__(self,
              authority,
              root_chain_provider=HTTPProvider('http://localhost:8545'),
              child_chain_url="http://localhost:8546/jsonrpc"):
     deployer = Deployer(root_chain_provider)
     abi = json.load(open("contract_data/RootChain.json"))
     self.w3 = deployer.w3
     self.root_chain = self.w3.eth.contract(
         abi,
         plasma_config['ROOT_CHAIN_CONTRACT_ADDRESS'],
         ContractFactoryClass=ConciseContract)
     self.authority = authority
     self.blocks = {}
     self.current_block_number = 1
     self.current_block = Block()
     self.pending_transactions = []
コード例 #11
0
    def __init__(self, child_chain, CONTRACT_DATA_DIR=CONTRACT_DATA_DIR):
        self.CONTRACT_DATA_DIR = CONTRACT_DATA_DIR
        self.child_chain = child_chain
        self.root_chain = self.child_chain.root_chain
        self.root_address = self.root_chain.address
        self.authority = self.child_chain.authority
        self.address = "0x" + self.authority.hex()
        self.to_contractaddresses = set(
            [to_contractaddress for _, to_contractaddress in EXCHANGE_RATE])
        self.contract_instances = {}
        for contractaddress in self.to_contractaddresses:
            self.contract_instances[contractaddress] = Deployer(
            ).get_contract_at_address("ERC20", contractaddress, concise=False)

        if not self.get_balance():
            for contractaddress in self.to_contractaddresses:
                contract_instance = self.contract_instances[contractaddress]
                amount = int(100000000 * (10**18) / 100)
                contract_instance.transact({
                    'from': self.address
                }).approve(self.root_address, amount)
                self.root_chain.transact({
                    'from': self.address
                }).deposit(contractaddress, amount, 0)
コード例 #12
0
import rlp
from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
from jsonrpc import JSONRPCResponseManager, dispatcher
from ethereum import utils
from plasma.child_chain.child_chain import ChildChain
from plasma.root_chain.deployer import Deployer
from plasma_core.constants import CONTRACT_ADDRESS, AUTHORITY
from plasma_core.block import Block
from plasma_core.transaction import Transaction
from plasma_core.utils.transactions import encode_utxo_id

root_chain = Deployer().get_contract_at_address("RootChain", CONTRACT_ADDRESS, concise=False)
child_chain = ChildChain(AUTHORITY['address'], root_chain)


@Request.application
def application(request):
    # Dispatcher is dictionary {<method_name>: callable}
    dispatcher["submit_block"] = lambda block: child_chain.submit_block(rlp.decode(utils.decode_hex(block), Block))
    dispatcher["apply_transaction"] = lambda transaction: child_chain.apply_transaction(rlp.decode(utils.decode_hex(transaction), Transaction))
    dispatcher["get_transaction"] = lambda blknum, txindex: rlp.encode(child_chain.get_transaction(encode_utxo_id(blknum, txindex, 0)), Transaction).hex()
    dispatcher["get_current_block"] = lambda: rlp.encode(child_chain.get_current_block(), Block).hex()
    dispatcher["get_current_block_num"] = lambda: child_chain.get_current_block_num()
    dispatcher["get_block"] = lambda blknum: rlp.encode(child_chain.get_block(blknum), Block).hex()
    dispatcher["get_test"] = lambda: child_chain.get_test()
    dispatcher["set_dict"] = lambda **num: child_chain.set_dict(**num)
    dispatcher["set_test"] = lambda num: child_chain.set_test(num)
    dispatcher["hello"] = lambda: child_chain.hello()
    response = JSONRPCResponseManager.handle(
        request.data, dispatcher)
コード例 #13
0
import os
import pytest
from ethereum.tools import tester, _solidity
from ethereum.abi import ContractTranslator
from ethereum import utils
from plasma.utils import utils as plasma_utils
from plasma.root_chain.deployer import Deployer
from testing_lang.testing_language import TestingLanguage

OWN_DIR = os.path.dirname(os.path.realpath(__file__))

# Compile contracts once before tests start
deployer = Deployer()
deployer.compile_all()


@pytest.fixture
def t():
    tester.chain = tester.Chain()
    return tester


def get_dirs(path):
    abs_contract_path = os.path.realpath(
        os.path.join(OWN_DIR, '..', 'plasma', 'root_chain', 'contracts'))
    sub_dirs = [x[0] for x in os.walk(abs_contract_path)]
    extra_args = ' '.join(
        ['{}={}'.format(d.split('/')[-1], d) for d in sub_dirs])
    path = '{}/{}'.format(abs_contract_path, path)
    return path, extra_args
コード例 #14
0
ファイル: deployment.py プロジェクト: deckmon/plasma-mvp
def deploy():
    print("deleting child chain pickle")
    shutil.rmtree(plasma_config["PICKLE_DIR"], ignore_errors=True)
    
    deployer = Deployer()
    deployer.compile_all()
    deployer.deploy_contract("RootChain")
    
    deployer = Deployer(CONTRACTS_DIR=CONTRACTS_DIR, OUTPUT_DIR=OUTPUT_DIR)
    deployer.compile_all()
    erc721_contract = deployer.deploy_contract("ERC721Token", args=("My ERC721 Token", "MET721"))
    erc20_contract = deployer.deploy_contract("EIP20", args=(100000000 * (10 ** 18), "FEX", 18, "FEX"))
    print("minting erc721 ...")
    erc721_contract.mint(plasma_config["COINBASE"], 1, transact={'from': plasma_config["COINBASE"]})
    erc721_contract.mint(plasma_config["COINBASE"], 888, transact={'from': plasma_config["COINBASE"]})
    print("erc721 initialized")
    erc20_contract_2 = deployer.deploy_contract("EIP20", args=(100000000 * (10 ** 18), "TEST", 18, "TEST"))
    deployer.w3.eth.sendTransaction({'from': plasma_config["COINBASE"], 'to': to_checksum_address('0xd03ce696c376882fab5e808aad2ffeae2789a712'), 'value': deployer.w3.toWei(50, 'ether')})
    # wallet seed: desert allow payment inmate ribbon still hero claim return wear retreat stuff
    print("test wallet eth sent")
コード例 #15
0
class Client(object):

    def __init__(self, root_chain_provider=None, child_chain_url="http://localhost:8546/jsonrpc"):
        if root_chain_provider is None:
            if plasma_config['NETWORK'].startswith("wss://"):
                root_chain_provider = WebsocketProvider(plasma_config['NETWORK'])
            else:
                root_chain_provider = HTTPProvider(plasma_config['NETWORK'])
        self.deployer = Deployer(root_chain_provider)
        self.w3 = self.deployer.w3
        self.root_chain = self.deployer.get_contract_at_address("RootChain", plasma_config['ROOT_CHAIN_CONTRACT_ADDRESS'], concise=False)
        self.child_chain = ChildChainService(child_chain_url)

    def create_transaction(self, blknum1=0, txindex1=0, oindex1=0,
                           blknum2=0, txindex2=0, oindex2=0,
                           newowner1=b'\x00' * 20, contractaddress1=b'\x00' * 20, amount1=0, tokenid1=0,
                           newowner2=b'\x00' * 20, contractaddress2=b'\x00' * 20, amount2=0, tokenid2=0):
        return Transaction(blknum1, txindex1, oindex1,
                           blknum2, txindex2, oindex2,
                           newowner1, contractaddress1, amount1, tokenid1,
                           newowner2, contractaddress2, amount2, tokenid2)

    def sign_transaction(self, transaction, key1=b'', key2=b''):
        if key1:
            transaction.sign1(key1)
        if key2:
            transaction.sign1(key2)
        return transaction

    def deposit(self, contractAddress, amount, tokenId, owner):
        send_transaction(self.w3, self.root_chain.functions.deposit(contractAddress, amount, tokenId), options={'from': owner, 'value': amount})
        # self.root_chain.deposit(contractAddress, amount, tokenId, transact={'from': owner, 'value': amount})

    def apply_transaction(self, transaction):
        self.child_chain.apply_transaction(transaction)

    def submit_block(self, block):
        self.child_chain.submit_block(block)

    def withdraw(self, blknum, txindex, oindex, tx, proof, sigs):
        utxo_pos = blknum * 1000000000 + txindex * 10000 + oindex * 1
        self.root_chain.startExit(
            utxo_pos,
            rlp.encode(tx, UnsignedTransaction0),
            proof,
            sigs,
            transact={'from': '0x' + tx.newowner1.hex()}
        )

    def withdraw_deposit(self, owner, deposit_pos, amount):
        self.root_chain.startDepositExit(deposit_pos, amount, transact={'from': owner})

    def get_transaction(self, blknum, txindex):
        encoded_transaction = self.child_chain.get_transaction(blknum, txindex)
        return rlp.decode(utils.decode_hex(encoded_transaction), Transaction)

    def get_current_block(self):
        encoded_block = self.child_chain.get_current_block()
        return rlp.decode(utils.decode_hex(encoded_block), Block)

    def get_block(self, blknum):
        encoded_block = self.child_chain.get_block(blknum)
        return rlp.decode(utils.decode_hex(encoded_block), Block)

    def get_current_block_num(self):
        return self.child_chain.get_current_block_num()

    def get_balance(self, address, block):
        return self.child_chain.get_balance(address, block)

    def get_utxo(self, address, block):
        return self.child_chain.get_utxo(address, block)

    def get_all_transactions(self):
        return self.child_chain.get_all_transactions()
コード例 #16
0
from plasma.root_chain.deployer import Deployer

deployer = Deployer()
deployer.compile_all()
deployer.deploy_contract("RootChain")
コード例 #17
0
ファイル: test.py プロジェクト: deckmon/plasma-mvp
import os
import sys
import json
import subprocess
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

from ethereum import utils
from web3.contract import ConciseContract
from web3 import Web3, HTTPProvider
from plasma.cli import cli
from plasma.config import plasma_config
from plasma_tools.config import tools_config
from plasma.root_chain.deployer import Deployer

w3 = Web3(HTTPProvider(plasma_config['NETWORK']))
deployer = Deployer()
erc721_contract = deployer.get_contract_at_address(
    "ERC721Token", tools_config['ERC721_CONTRACT_ADDRESS'], concise=True)
erc20_contract = deployer.get_contract_at_address(
    "EIP20", tools_config['ERC20_CONTRACT_ADDRESS'], concise=True)


def process_cmd(command, raise_exception=True):
    command = "python plasma_tools/cli.py %s" % command
    print("cmd: " + command)
    status, output = subprocess.getstatusoutput(command)
    if status != 0 and raise_exception:
        raise Exception("None zero return code")
    print(output)
    return status, output
コード例 #18
0
class TestingLanguage(object):

    def __init__(self):
        self.root_chain = Deployer().deploy_contract('RootChain', concise=False)
        self.child_chain = ChildChain(AUTHORITY['address'], self.root_chain)

        self.transactions = []
        self.accounts = []

    def get_account(self):
        account = ACCOUNTS[len(self.accounts)]
        self.accounts.append(account)
        return account

    def deposit(self, account, amount):
        amount = int(amount)

        self.root_chain.transact({
            'from': account['address'],
            'value': amount
        }).deposit()

        # Wait for the Deposit event to be detected
        time.sleep(1)

        tx = Transaction(0, 0, 0,
                         0, 0, 0,
                         NULL_ADDRESS,
                         account['address'], amount,
                         NULL_ADDRESS, 0)

        self.transactions.append({
            'tx': tx,
            'confirm_sigs': b'',
            'is_deposit': True
        })
        return len(self.transactions) - 1

    def transfer(self,
                 input1, oindex1, newowner1, amount1, signatory1,
                 input2=None, oindex2=0, newowner2=None, amount2=None, signatory2=None, cur12=NULL_ADDRESS):
        newowner_address1 = newowner1['address']
        amount1 = int(amount1)

        newowner_address2 = NULL_ADDRESS
        if newowner2 is not None:
            newowner_address2 = newowner2['address']
        amount2 = int(amount2) if amount2 is not None else 0

        encoded_input_tx1 = rlp.encode(self.transactions[input1]['tx']).hex()
        blknum1, txindex1 = self.child_chain.get_tx_pos(encoded_input_tx1)

        blknum2, txindex2 = 0, 0
        if input2 is not None:
            encoded_input_tx2 = rlp.encode(self.transactions[input2]['tx']).hex()
            blknum2, txindex2 = self.child_chain.get_tx_pos(encoded_input_tx2)

        tx = Transaction(blknum1, txindex1, oindex1,
                         blknum2, txindex2, oindex2,
                         cur12,
                         newowner_address1, amount1,
                         newowner_address2, amount2)

        if signatory1 is not None:
            key1 = signatory1['key']
            tx.sign1(key1)

        if signatory2 is not None:
            key2 = signatory2['key']
            tx.sign2(key2)

        encoded_tx = rlp.encode(tx).hex()

        self.child_chain.apply_transaction(encoded_tx)

        self.transactions.append({
            'tx': tx,
            'confirm_sigs': b'',
            'is_deposit': False
        })
        return len(self.transactions) - 1

    def submit_block(self, signatory=AUTHORITY):
        signing_key = None
        if signatory is not None:
            signing_key = signatory['key']

        block = self.child_chain.current_block
        block.make_mutable()
        if signing_key:
            block.sign(signing_key)

        self.child_chain.submit_block(rlp.encode(block).hex())

    def confirm(self, tx_id, signatory1, signatory2=None):
        transaction = self.transactions[tx_id]

        tx = transaction['tx']
        encoded_tx = rlp.encode(tx).hex()

        blknum, _ = self.child_chain.get_tx_pos(encoded_tx)
        block_root = self.child_chain.blocks[blknum].merkle.root

        confirm_sigs = b''
        for signatory in [x for x in [signatory1, signatory2] if x is not None]:
            confirm_sigs += tx.confirm(block_root, signatory['key'])

        self.transactions[tx_id]['confirm_sigs'] = confirm_sigs

    def withdraw(self, tx_id, oindex, exitor):
        transaction = self.transactions[tx_id]

        tx = transaction['tx']
        encoded_tx = rlp.encode(tx).hex()
        tx_bytes = rlp.encode(tx, UnsignedTransaction)
        sigs = tx.sig1 + tx.sig2 + transaction['confirm_sigs']

        blknum, txindex = self.child_chain.get_tx_pos(encoded_tx)
        utxo_pos = blknum * 1000000000 + txindex * 10000 + oindex * 1

        if transaction['is_deposit']:
            deposit_amount = tx.amount1

            self.root_chain.transact({
                'from': exitor['address']
            }).startDepositExit(utxo_pos + 1, NULL_ADDRESS_HEX, deposit_amount)
        else:
            output_block = self.child_chain.blocks[blknum]
            hashed_transaction_set = [transaction.merkle_hash for transaction in output_block.transaction_set]
            merkle = FixedMerkle(16, hashed_transaction_set, hashed=True)
            proof = merkle.create_membership_proof(tx.merkle_hash)

            self.root_chain.transact({
                'from': exitor['address']
            }).startExit(utxo_pos, tx_bytes, proof, sigs)
コード例 #19
0
    def __init__(self):
        self.root_chain = Deployer().deploy_contract('RootChain', concise=False)
        self.child_chain = ChildChain(AUTHORITY['address'], self.root_chain)

        self.transactions = []
        self.accounts = []
コード例 #20
0
from functools import wraps

from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
from jsonrpc import JSONRPCResponseManager, dispatcher
from plasma.child_chain.child_chain import ChildChain
from plasma.child_chain.partially_signed_transaction_pool import PartiallySignedTransactionPool
from plasma.child_chain.block_auto_submitter import BlockAutoSubmitter
from plasma.child_chain.finalize_exits_auto_submitter import FinalizeExitsAutoSubmitter
# from plasma.child_chain.liquidity_provider import LiquidilyProvider
from plasma.config import plasma_config
from plasma.root_chain.deployer import Deployer

deployer = Deployer()
root_chain = deployer.get_contract_at_address(
    "RootChain", plasma_config['ROOT_CHAIN_CONTRACT_ADDRESS'], concise=False)
partially_signed_transaction_pool = PartiallySignedTransactionPool()
child_chain = ChildChain(
    plasma_config['AUTHORITY'],
    root_chain,
    partially_signed_transaction_pool=partially_signed_transaction_pool)
BlockAutoSubmitter(child_chain,
                   plasma_config['BLOCK_AUTO_SUMBITTER_INTERVAL']).start()
FinalizeExitsAutoSubmitter(
    plasma_config['AUTHORITY'], root_chain,
    plasma_config['FINALIZE_EXITS_AUTO_SUBMITTER_INTERVAL']).start()
# liquidity_provider = LiquidilyProvider(child_chain)


def printKey(key):
    def decorator(func):
コード例 #21
0
from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
from jsonrpc import JSONRPCResponseManager, dispatcher
from plasma.child_chain.child_chain import ChildChain
from plasma.config import plasma_config
from plasma.root_chain.deployer import Deployer

child_chain = ChildChain(plasma_config['AUTHORITY'],
                         Deployer().get_contract("RootChain/RootChain.sol"))


@Request.application
def application(request):
    # Dispatcher is dictionary {<method_name>: callable}
    dispatcher["submit_block"] = lambda block: child_chain.submit_block(block)
    dispatcher[
        "apply_transaction"] = lambda transaction: child_chain.apply_transaction(
            transaction)
    dispatcher[
        "get_transaction"] = lambda blknum, txindex: child_chain.get_transaction(
            blknum, txindex)
    dispatcher["get_current_block"] = lambda: child_chain.get_current_block()
    dispatcher[
        "get_current_block_num"] = lambda: child_chain.get_current_block_num()
    dispatcher["get_block"] = lambda blknum: child_chain.get_block(blknum)
    response = JSONRPCResponseManager.handle(request.data, dispatcher)
    return Response(response.json, mimetype='application/json')


if __name__ == '__main__':
    run_simple('localhost', 8546, application)
コード例 #22
0
class TestingLanguage(object):

    def __init__(self):
        self.root_chain = Deployer().deploy_contract('RootChain', concise=False)
        self.child_chain = ChildChain(AUTHORITY['address'], self.root_chain)
        self.confirmations = {}
        self.accounts = []

    def get_account(self):
        account = ACCOUNTS[len(self.accounts)]
        self.accounts.append(account)
        return account

    def deposit(self, account, amount):
        deposit_blknum = self.child_chain.chain.next_deposit_block

        self.root_chain.transact({
            'from': account['address'],
            'value': amount
        }).deposit()

        # Wait for the Deposit event to be detected
        time.sleep(1)

        return encode_utxo_id(deposit_blknum, 0, 0)

    def transfer(self,
                 input1, newowner1, amount1, signatory1,
                 input2=0, newowner2=None, amount2=0, signatory2=None, cur12=NULL_ADDRESS):
        newowner_address1 = newowner1['address']
        newowner_address2 = NULL_ADDRESS
        if newowner2 is not None:
            newowner_address2 = newowner2['address']

        tx = Transaction(*decode_utxo_id(input1),
                         *decode_utxo_id(input2),
                         cur12,
                         newowner_address1, amount1,
                         newowner_address2, amount2)

        if signatory1 is not None:
            key1 = signatory1['key']
            tx.sign1(key1)

        if signatory2 is not None:
            key2 = signatory2['key']
            tx.sign2(key2)

        spend_id = self.child_chain.apply_transaction(tx)
        self.submit_block()
        return spend_id

    def submit_block(self, signatory=AUTHORITY):
        signing_key = None
        if signatory is not None:
            signing_key = signatory['key']

        block = self.child_chain.current_block
        if signing_key:
            block.sign(signing_key)

        self.child_chain.submit_block(block)

    def confirm(self, tx_id, signatory1, signatory2=None):
        tx = self.child_chain.get_transaction(tx_id)
        (blknum, _, _) = decode_utxo_id(tx_id)
        block_root = self.child_chain.get_block(blknum).root

        confirm_sigs = b''
        for signatory in [x for x in [signatory1, signatory2] if x is not None]:
            confirm_sigs += confirm_tx(tx, block_root, signatory['key'])

        self.confirmations[tx_id] = confirm_sigs

    def start_deposit_exit(self, utxo_id, exitor):
        tx = self.child_chain.get_transaction(utxo_id)

        self.root_chain.transact({
            'from': exitor['address']
        }).startDepositExit(utxo_id, NULL_ADDRESS_HEX, tx.amount1)

    def start_exit(self, utxo_id, exitor):
        tx = self.child_chain.get_transaction(utxo_id)

        sigs = tx.sig1 + tx.sig2 + self.confirmations[utxo_id]
        (blknum, _, _) = decode_utxo_id(utxo_id)
        block = self.child_chain.get_block(blknum)
        proof = block.merkle.create_membership_proof(tx.merkle_hash)

        self.root_chain.transact({
            'from': exitor['address']
        }).startExit(utxo_id, tx.encoded, proof, sigs)