mirror of https://github.com/hyperledger/besu
An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
Truffle Pet Shop example with Pantheon
Here you will find the bare bones of the Pet Shop example and instructions to run it with Pantheon and a wallet to manage keys.
Pre-requisites
- Truffle installed
npm install -g truffle
- Wallet installed
npm install truffle-privatekey-provider
To run the pet shop example:
cd acceptance-tests/truffle-pet-shop-tutorial
-
here you will find truffle.js which has network configurations for
- development (Ganache) and
- devwallet (points to localhost:8545)
- Note you don't need Ganache running unless you want to run the tests against it (see below)
- However this truffle.js uses address and private key generated by Ganache with default mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
-
To run the Truffle example with Pantheon, you need Pantheon running
- check out and build Pantheon
- run Pantheon (either in IDE or via command line), with mining and rpc enabled. Eg:
cd $pantheon-working-dir
./gradlew run -Ppantheon.run.args="--miner-enabled --miner-coinbase 0x627306090abaB3A6e1400e9345bC60c78a8BEf57 --sync-mode FULL --no-discovery --dev-mode --rpc-enabled --rpc-api eth,net --rpc-cors-origins 'all'"
- Run Truffle migrate
truffle migrate --network devwallet
- Output should look something like:
Using network 'devwallet'.
Running migration: 1_initial_migration.js
Deploying Migrations...
... 0x2c16dd43c0adfe0c697279e388f531581c2b722e7f0e968e3e65e4345bdeb502
Migrations: 0xfb88de099e13c3ed21f80a7a1e49f8caecf10df6
Saving successful migration to network...
... 0x1135ea1dd6947f262d65dde8712d17b4b0ec0a36cc917772ce8acd7fe01ca8e2
Saving artifacts...
Running migration: 2_deploy_contracts.js
Deploying Adoption...
... 0xa3d220639719b8e007a7aa8cb18e8caf3587337b77bac833959f4853b1695369
Adoption: 0xf204a4ef082f5c04bb89f7d5e6568b796096735a
Saving successful migration to network...
... 0xd7245d7b1c0a7eb5a5198754f7edd7abdae3b806605b54ecc4716f9b4b05de61
Saving artifacts...
If migrate works, try running the tests
cd acceptance-tests/truffle-pet-shop-tutorial
truffle test --network devwallet
- Output should look something like:
Using network 'devwallet'.
Compiling ./contracts/Adoption.sol...
Compiling ./test/TestAdoption.sol...
Compiling truffle/Assert.sol...
Compiling truffle/DeployedAddresses.sol...
TestAdoption
✓ testUserCanAdoptPet (4050ms)
✓ testGetAdopterAddressByPetId (5050ms)
✓ testGetAdopterAddressByPetIdInArray (4039ms)
✓ testUserCanUnadoptPet (5049ms)
4 passing (52s)