Deploy & Connect to Testnet - rawrat/priveos-client GitHub Wiki
Deploy & Connect to Testnet
Connecting your client application to the testnet requires that your smart contract is deployed to testnet. Currently Priveos supports multiple testnets (such as Telos etc..) but the common one is the Jungle2
testnet which is referenced in this guide.
Prerequisites
- A running installation of
cleos
(https://developers.eos.io/eosio-cleos/docs/overview). - Please also read this first as it gives you a good understanding of the tools around key management and signing: https://developers.eos.io/eosio-nodeos/v1.1.0/docs/learn-about-wallets-keys-and-accounts-with-cleos
Deploy Smart Contract to testnet
- Create a user first (see Appendix). The user is the management account for the smart contract and is (if not set explicitly to multisig) the only account which is able to update the smart contract. So take care of the keys!
- Build the contract
- Run:
cleos -u https://jungle2.cryptolions.io set account <SMART_CONTRACT_NAME> ./
Connect client application to testnet
- Create a client user for testing (see Appendix; this time the user is the client interacting with your client application)
- Use this as config and replace the
<PLACEHOLDERS>
:
{
dappContract: '<YOUR_SMART_CONTRACT>',
priveosContract: 'priveosrules',
httpEndpoint: 'https://jungle2.cryptolions.io',
chainId: '3a953df32658a2c7ef97c4048acb255969e803dafd92b96755bbc90ce4d1e448',
brokerUrl: 'https://slantagnode3.priveos.io',
privateKey: '<USERS_PRIVATE_KEY>',
publicKey: '<USERS_PUBLIC_KEY>',
ephemeralKeyPrivate: '<SESSION_PRIVATE_KEY>', // see on how to generate eph keys: https://github.com/rawrat/priveos-client/blob/master/src/example.js
ephemeralKeyPublic: '<SESSION_PUBLIC_KEY>'
}
Appendix
Create a user
In order to connect the client to the privEOS jungle2 testnet:
- Generate a new key pair (see https://developers.eos.io/eosio-cleos/reference#pack_action_data)
- create an account at https://monitor.jungletestnet.io/#account
- fund the account at https://monitor.jungletestnet.io/#faucet