To create your own CryptoKitties to send across the bridge, you need to deploy your own set of contracts. Only the contract owner can create new cats. You can also create a group of cats during the deployment process using an env variable.
In this example, we will deploy contracts to the Kovan & Sokol testnets. You will need a small amount of test currency in your wallet for both testnets in order to deploy the contracts.
$ git clone --recursive https://github.com/poanetwork/cryptokitties-xdai-demo.git
$ cd cryptokitties-xdai-demo$ yarn
$ yarn compile
$ nano .env
Copy the following into the .env file, change parameters as needed and save.
#The private key hex value of the account responsible for contracts deploymentDEPLOYMENT_ACCOUNT_PRIVATE_KEY=<YOUR PRIVATE WALLET KEY># Extra gas added to the estimated gas of a particular deployment/configuration transactionDEPLOYMENT_GAS_LIMIT_EXTRA=0.2# The RPC channel to a Home node able to handle deployment/configuration transactions.HOME_RPC_URL=https://sokol.poa.network# The "gasPrice" parameter set in every deployment/configuration transaction on Home network (in Wei).HOME_DEPLOYMENT_GAS_PRICE=1000000000# The address of the existing AMB bridge in the Home network that will be used to pass messages# to the Foreign network.HOME_AMB_BRIDGE=0xFe446bEF1DbF7AFE24E81e05BC8B271C1BA9a560# The gas limit that will be used in the execution of the message passed to the mediator contract# in the Foreign network.HOME_MEDIATOR_REQUEST_GAS_LIMIT=1000000# Address on Home network with permissions to change parameters of the mediator contract.HOME_MEDIATOR_OWNER=<YOUR WALLET OWNER ADDRESS># Address on Home network with permissions to upgrade the mediator contractHOME_UPGRADEABLE_ADMIN=<YOUR WALLET OWNER ADDRESS># The RPC channel to a Foreign node able to handle deployment/configuration transactions.FOREIGN_RPC_URL=https://kovan.infura.io# The "gasPrice" parameter set in every deployment/configuration transaction on Foreign network (in Wei).FOREIGN_DEPLOYMENT_GAS_PRICE=1000000000# The address of the existing AMB bridge in the Foreign network that will be used to pass messages# to the Home network.FOREIGN_AMB_BRIDGE=0xFe446bEF1DbF7AFE24E81e05BC8B271C1BA9a560# The gas limit that will be used in the execution of the message passed to the mediator contract# in the Home network.FOREIGN_MEDIATOR_REQUEST_GAS_LIMIT=1000000# Address on Foreign network with permissions to change parameters of the mediator contract.FOREIGN_MEDIATOR_OWNER=<YOUR WALLET OWNER ADDRESS># Address on Foreign network with permissions to upgrade the mediator contractFOREIGN_UPGRADEABLE_ADMIN=<YOUR WALLET OWNER ADDRESS># Cryptokitties contract address on Foreign network. If not defined or set to address zero, the contract will be deployed on Foreign network.CRYPTOKITTIES_ADDRESS=0x0000000000000000000000000000000000000000# Amount of Kitties to Mint on Foreign networkKITTIES_AMOUNT=15
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=<Your Private Wallet Key>: This is the key associated with the account deploying the contracts. This wallet must have both test Ether and test POA. To retrieve a private key from Nifty Wallet:
Go to the deployment account and click the dots next to the account name. Select Export Private Key.
Enter in your Nifty Wallet password:
Copy your private key.
HOME_AMB_BRIDGE=0xFe446bEF1DbF7AFE24E81e05BC8B271C1BA9a560: This is the address for the currently deployed AMB bridge on the Sokol network. If you deploy elsewhere, use your deployed address address.
HOME_MEDIATOR_OWNER=<YOUR WALLET OWNER ADDRESS>: You should have access to this wallet address so you can create a cat later if needed. The following <YOUR WALLET OWNER ADDRESS> parameters can use the same address for the purposes of this tutorial. For more information, see TokenBridge roles.
FOREIGN_AMB_BRIDGE=0xFe446bEF1DbF7AFE24E81e05BC8B271C1BA9a560: This is the address for the currently deployed AMB bridge on the Kovan network. If you deploy elsewhere, use your deployed address.
KITTIES_AMOUNT=15: This is the number of kitties minted by the contract, select any number here. You can send these to other addresses or bridge yourself.
$ yarn deploy
On successful deployment, you will receive confirmation of the contract addresses: For example:
[ Home ] homeMediator: 0x5EeC77239398FE328791E28700CAFddB2990ea97[ Home ] simpleKittyCore: 0xc6a592ED792de33e6CBBF7ce04Dd9D3884B46B9A[ Foreign ] foreignMediator: 0x7dB6493D9B6D99D9A240a6914AdAd5e0E8E8BE40[ Foreign ] kittyCore: 0x13AC5C6338796a31A39e74D70B0153C1bE5f53B4
In our example, Sokol is the Home network, and Kovan is the Foreign Network. This means CryptoKitties are deployed on Kovan, and can be transferred to Sokol following the next instructions. Once they are bridged to Sokol, they can be bridged back to Kovan as well.
See View Kitties in BlockScout to view the kitties you have created.