Deployment Guide
This chapter introduces how to publish your Token/NFT
products or fungible tokens on the transformers main net.
Before reading this chapter, please familiarize yourself with information about the Solidity language, the ERC20/ERC721 contract standard.
You need to use the Remix tool to compile the contract source code. Make sure you have the contract's source code ready to compile and deploy.
Illustrate
To deploy a contract, please strictly adhere to the Ethereum ERC20/ERC721 contract standards. The types and methods defined in the contract should be named according to the standard.
Transformers blockchain browser currently does not support parsing custom parameter types and function methods.
The reference code is as follows:
Prerequisites
Transformers currently supports the deployment and execution of contracts on nodes. So to deploy a contract, a tradable, running node and an account with a certain number of Transformers coins to cover the fees incurred during the deployment process are required. Binary code of the smart contract. In Remix IDE is BYTECODE.object or Calldata, which is represented as a string of hexadecimal numbers.
Deploy contract
- Create a new blank text file contract.txt, paste the contract binary code into the file.
- Copy the contract.txt file to the folder where the Transformers node is located.
- Run the node
- Run the menu option **8.
- Select the type of virtual machine on which to run the contract.
- If there are incoming parameters in the contract constructor, enter the binary code of Parameters required for deployment (if contract.txt is Calldata, you can skip it directly), otherwise enter 0 to skip.
Execute the contract
Prerequisites
As with deploying a contract, the execution of the contract can only take place on the node for the time being. In addition to this, executing a contract requires knowledge of the deployer account of the contract and the transaction hash generated by the deployed transaction.
Executing a contract
- Run the menu 9. Call contract.
- Enter the contract deployer account
- Enter the hash of all the transactions that will be deployed when the contract is run.
- Enter the inputs required to run the contract to complete the execution of the contract.
Special options and requirements for executing smart contracts on the transformers chain:
- The gas fee for smart contracts does not require pre input, but if the balance is insufficient to pay for the gas fee, contract execution fails.
- You can pay a tip to the contract deployer while executing the contract, and the tip amount should not be less than the gas fee.
Contract deployment
What is required before deploy contracts?
- A tradable and running Validator
- An account with a certain amount of TTOS coins to pay the gas fees generated during the deployment process.
- The binary code of the contract which is
Bytecode
orCalldata
in Remix IDE
A string of hexadecimal digits (as shown in the following figure).
- Start Transformers validator node,generated
contract
folder in current directory of the program.Placed the binary code generated from the contract into thecontract
file in the directory.
Example: The content of the contract file is similar to the following figure.
Contract Deployment
- Run the following command to run the node in menu mode
./tfs_v0.32.x_xxxx_testnet - m
-
Validator node running Menu Options 8. Deploy Contract
-
Select the type of virtual machine running the contract.
-
According to the prompts, enter the contract name, version and compliant standards in sequence.The contract binary code, source code, ABI, and other information need to be saved in the form of a text file on the host.
Please be aware of the following information before proceeding:- To read the information column of a file type, you need to enter the file path or use default rules to read it.
- In advance, place the binary source code in the
contract
file. You can read the information from the file directly by selecting option0
. If thecontract
file does not exist, skip the contract reading operation.
- The default reading rules for files are as follows:
- Contract source codes:
./contract/source.sol
- ABI:
./contract/abi.json
- User Documentation:
./contract/userdoc.json
- Operation Documentation:
./contract/devdoc.json
- Compilation options:
./contract/compiler_options.json
- Source code compilation bytecode mapping:
./contract/srcmap.txt
- Bytecode mapping during source code runtime:
srcmap_runtime.txt
- Metadata:
./contract/metadata.json
- Custom Data:
./contract/otherdata.json
- Contract Bytecode:
./contract/contract
-
If the contract constructor has passed-in parameters, you need to enter the
Parameters
binary code required for deployment (if the binary code stored in the contract file isCalldata
, skip directly). Otherwise,enter0
to skip.
Contract Execution
What is required before Execute contracts?
- The deployer's wallet address
- The transaction hash generated by the deployment contract
Contract Execution
- Validator node running Menu options 9. Call contract
- Enter the wallet address of the contract deployer, which is the wallet address of the deployment contract node.
- Enter the transaction hash when running contract deployment.
- Enter the input args to run the contract.
- Enter the tip to be paid to the contract deployment address. 0 can be entered, but if the Tip is not 0, the tip must not be less than the gas fee.
- Enter the fees to be paid to the contract.0 can be entered.
Pay attention to unit conversion
If the balance is displayed as 999.92064300
, that is 99,992,064,300
contract transfer units.
If you want to pay contract 100
TTOS, enter 10,000,000,000
; If 100
is entered, the actual payment will be made to the contract 0.000001
TTOS.