18.0 Testnet
Log in to the creators’ portal at http://portal.creators.gala.com/sanity and select ‘Testnet Access.’ Follow the step-by-step instructions on the screen to get access.
Check the sdk link for more info
Step 1: Install the GalaChain CLI
GalaChain SDK provides a CLI to manage your chaincode. You can install it with:
npm i -g @gala-chain/cli
To verify it works you can use:
galachain --help
Step 2: Initialize the project from template
GalaChain CLI can create a fully functional sample GalaChain chaincode with some features, tests, local .env setup and many others. Just type:
galachain init my-gc-chaincode
This will create a new directory my-gc-chaincode with the chaincode template. Change the directory to the newly created one.
Step 3: Update the contract (optional)
The chaincode template comes with some sample contract code. Feel free to modify the contract code to suit your needs. If you want to verify that your contract works, you can start the local test network with:
npm run network:start
And then run the end-to-end tests with:
npm run network:start
Step 4: Prepare and publish chaincode docker image
Before you can deploy your chaincode, you need to build a Docker image with it and publish it to a registry of your choice (e.g. Docker Hub).
Chaincode template comes with a Dockerfile that you should use to build a chaincode image. Also, it is recommended to use buildx to ensure that the image architecture is linux/amd64 (required by GalaChain network).
Assuming you have Docker tag name in $TAG environment variable, you can build and publish the image with the following commands:
docker buildx build --platform linux/amd64 -t $TAG .
docker push $TAG
Step 5: Connect your chaincode with GalaChain network
Since this is an early access feature, the ability to deploy to the testnet requires GalaChain approval.
Fill and submit this form to get approval and registration to use Testnet.
We require the following data to approve your registration:
- Docker image tag (without the version, or :latest part; the image needs to be publicly available),
- Chaincode admin public key (the content of keys/gc-admin-key.pub file),
- Developer public keys (the content of keys/gc-dev-key.pub files of all developers who want to deploy the chaincode).
Docker Image Tag (without the version, or :latest part)Chaincode admin public key (from keys/gc-admin-key.pub file)Developer public keys (from keys/gc-dev-key.pub file, comma-separated for multiple developers)
Step 6: Deploy the chaincode
To deploy the chaincode, you need to call the following command:
galachain deploy <image-tag>
Replace with the Docker image tag you provided, plus the version (e.g. my-registry/my-gc-chaincode:1.0.0).
The command will deploy the chaincode to the GalaChain network. The deployment process may take a while, as the network needs to download the chaincode image and start it.
Step 7: Call REST API
GalaChain Gateway provides a REST API to interact with the chaincode. The simplest way to call it is to use curl (for convenience, you can use galachain info and jq to build chaincode url):
Check this Doc for more details