Smart Contract 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:
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.