Deploying and Searching Smart Contract
Deploying the Smart Contract on the blockchain using the information registered and generated before.
Prerequisites
1. You must be authenticated to use the ChainZ API Service. For more details, refer to Getting Started > Creating Credentials and Getting Started > Issuing Access Tokens.
2. The issued access token must be within its validity period.
3. The Contract Artifact (ABI, Bytecode, and Additional Information) must be registered in the ChainZ API Service. For details, please refer to “Registering and searching CONTRACT ARTIFACT Information”.
4. You must know the address of the Account created through the Account API. For details, please refer to 'Creating and Searching Account'.
Deploying and Searching Smart Contract
Deploying Smart Contract
1. API information
Use the callContractFunction of the Transaction API (Link to Reference).
2. Input Information
Access Tokens & API Keys
ChainID - Blockchain Identification Information
ClientReqID - The unique identification information of the business provider in the Request
params - Address, Contract ID, and initial value parameters for From Account.
3. Example of deploying Smart Contract
Transactions are sent using Transaction API.
curl -X POST "https://tx-api.chainz.biz/api/v1/transactions/contract-deployment" \
-H "accept: application/json" \
-H "x-api-key: {API key}" \
-H "Authorization: Bearer {access token}" \
-H "Content-Type: application/json" \
-d "{
"chain": "8768cb29-2417-4281-84b1-924b82ebb720",
"clientReqId": "dc397f5d-6eb6-49e2-a4b4-b603b29c4729",
"params": {
"from": "0xbdc1776dd12feda8cc0f85fec65ea9e6ec906791",
"contractId": "745c7625-1467-4b66-ae9f-a9f8664f418c",
"initParams": [
],
"gas": "200000",
"gasPrice": "0"
},
"maxRetry": 3,
"isSync": true
}"
When sending a transaction, the UUID must be sent differently. If you need to test multiple times, change only one or two characters from the previously UUID before testing.
{
"status": "SUCCEEDED",
"log": "{\"type\":\"CONTRACT_DEPLOYMENT\",\"isSync\":true,\"maxRetry\":3,\"txReceipt\":{\"blockHash\":\"0xfb461d242230abea4163284ae89ef4bb385446ba0aaa7cf8270ce39a140fc2b1\",\"blockNumber\":\"0x2b9a0f\",\"contractAddress\":\"0x64a0b1f26453e9fe70f03eb1a039664432da464f\",\"cumulativeGasUsed\":\"0x1d023\",\"from\":\"0xbdc1776dd12feda8cc0f85fec65ea9e6ec906791\",\"gasUsed\":\"0x1d023\",\"logs\":[],\"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"status\":\"0x1\",\"to\":null,\"transactionHash\":\"0xa7651c822cb1eab6f8114dda801e2d8977226c86898e5d533dfc150a97548493\",\"transactionIndex\":\"0x0\"}}",
"timestamp": "2021-09-30T09:29:28.959Z",
"id": "98f9ee15-25c3-4bb4-900d-ed15411b4fc7"
}
The ID value (RequestID) received by Response is used to check the transaction processing status.
Searching Smart Contract Deployment Status
1. API information
Use findTXLogsByReqId of the Transaction API (Link to Reference).
2. Input Information
Access Tokens & API Keys
ChainID - Blockchain Identification Information
ClientReqID - The unique identification information of the business provider in the Request
params - Address, Contract ID, and initial value parameters for From Account.
3. Example of Smart Contract deployment status search
curl -X GET "https://tx-api.chainz.biz/api/v1/transactions/98f9ee15-25c3-4bb4-900d-ed15411b4fc7
/logs" \
-H "accept: application/json" \
-H "x-api-key: {API key}" \
-H "Authorization: Bearer {access token}"
{
"logList": [
{
"status": "REQUESTED",
"log": "{\"type\":\"CONTRACT_DEPLOYMENT\",\"isSync\":true,\"maxRetry\":3}",
"timestamp": "2021-09-30T09:29:26.812Z"
},
{
"status": "SUCCEEDED",
"log": "{\"type\":\"CONTRACT_DEPLOYMENT\",\"isSync\":true,\"maxRetry\":3,\"txReceipt\":{\"blockHash\":\"0xfb461d242230abea4163284ae89ef4bb385446ba0aaa7cf8270ce39a140fc2b1\",\"blockNumber\":\"0x2b9a0f\",\"contractAddress\":\"0x64a0b1f26453e9fe70f03eb1a039664432da464f\",\"cumulativeGasUsed\":\"0x1d023\",\"from\":\"0xbdc1776dd12feda8cc0f85fec65ea9e6ec906791\",\"gasUsed\":\"0x1d023\",\"logs\":[],\"logsBloom\":\"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"status\":\"0x1\",\"to\":null,\"transactionHash\":\"0xa7651c822cb1eab6f8114dda801e2d8977226c86898e5d533dfc150a97548493\",\"transactionIndex\":\"0x0\"}}",
"timestamp": "2021-09-30T09:29:28.959Z"
}
],
"requestId": "98f9ee15-25c3-4bb4-900d-ed15411b4fc7",
"pCode": "DGFK6277"
}
4. Log information analysis
Remove all backslashes () from the log information for which the status information of Response Data is' SUCCEEDED',
{"type":"CONTRACT_DEPLOYMENT","isSync":true,"maxRetry":3,"txReceipt":{"blockHash":"0xfb461d242230abea4163284ae89ef4bb385446ba0aaa7cf8270ce39a140fc2b1","blockNumber":"0x2b9a0f","contractAddress":"0x64a0b1f26453e9fe70f03eb1a039664432da464f","cumulativeGasUsed":"0x1d023","from":"0xbdc1776dd12feda8cc0f85fec65ea9e6ec906791","gasUsed":"0x1d023","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":null,"transactionHash":"0xa7651c822cb1eab6f8114dda801e2d8977226c86898e5d533dfc150a97548493","transactionIndex":"0x0"}}
and format it in JSON format in JSON Parser (https://jsonformatter.org/json-parser).

You can check the transaction receipt details from “TxReceipt”.
{
"type": "CONTRACT_DEPLOYMENT",
"isSync": true,
"maxRetry": 3,
"txReceipt": {
"blockHash": "0xfb461d242230abea4163284ae89ef4bb385446ba0aaa7cf8270ce39a140fc2b1",
"blockNumber": "0x2b9a0f",
"contractAddress": "0x64a0b1f26453e9fe70f03eb1a039664432da464f",
"cumulativeGasUsed": "0x1d023",
"from": "0xbdc1776dd12feda8cc0f85fec65ea9e6ec906791",
"gasUsed": "0x1d023",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": null,
"transactionHash": "0xa7651c822cb1eab6f8114dda801e2d8977226c86898e5d533dfc150a97548493",
"transactionIndex": "0x0"
}
}
You can check detailed information in Block Explorer with blockHash, blockNumber, and transactionHash information among the txReceipt information.
Searching in Block Explorer
Transaction details can be searched in Block Explorer.
Mainnet Block Explorer URL: https://block-explorer.chainz.biz
Testnet Block Explorer URL: https://test-block-explorer.chainz.biz
1. Searching by Block Hash

2. Search result screen

For more information, please refer to Getting Started > Using BLOCK EXPLORER.
Last updated