forked from dotsandspaces/conflictculturesportVR
-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
JimChen2002 edited this page Nov 1, 2021
·
19 revisions
-
Install a truffle
-
npm install -g truffle
-
-
Initialize a new truffle project
-
truffle init
-
-
To deploy, we need a blockchain so we fork ganache.
npm install -g @celo/ganache-cli
-
Start ganache
ganache-cli --port 7545
-
Deploy the contract to the local network
truffle migrate --network test
-
Interact with the contract via the truffle console
truffle console --network test
-
Add truffle-assertions
npm install truffle-assertions
- When deploying to Alfajores, we'll need a Celo client.
export CELO_IMAGE=us.gcr.io/celo-org/geth:alfajores
- Use a Docker image containing the Celo node software
docker pull $CELO_IMAGE
- Set up a data directory
mkdir celo-data-dir
cd celo-data-dir
-
Start ganache
- Command:
ganache-cli --port 7545
- Error:
Callback was already called.
- Potential reason: ganache is not compatible with newer version of node
- Solution: download Ganache from official website, open and click Quickstart. It should have the same effect as the command
- Command:
-
Run docker
- Command: any docker command that specifies a path
- Error:
docker: invalid reference format: repository name must be lowercase.
- Solution: surround the path with quotation mark
-
Start the node
- Command:
docker run --name celo-ultralight-node ......
- Error:
docker: Error response from daemon: driver failed programming external connectivity on endpoint celo-ultralight-node (<YOUR-ACCOUNT-ADDRESS>): Bind for 127.0.0.1:8545 failed: port is already allocated.
- Environment: port 8545 is not allocated before running the command
- Potential reason: docker fail to reinitialize
- Solution: restart docker
- Command:
-
Migrate to Alfajores
- Command:
truffle migrate --network alfajores
- Error:
*** Deployment Failed *** "Bolt" -- Returned error: invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go struct field SendTxArgs.gas of type hexutil.Uint64. at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
- Potential reason: newer version of truffle is not compatible with alfajores
- Solution (from Celo Discord): change the version of truffle from 5.4.14 to 5.4.0 with commands
npm uninstall -g truffle
andnpm install -g [email protected]
- Command: