Skip to main content

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.

caution

Transformers blockchain browser currently does not support parsing custom parameter types and function methods.

The reference code is as follows:

img

img

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

  1. Create a new blank text file contract.txt, paste the contract binary code into the file.
  2. Copy the contract.txt file to the folder where the Transformers node is located.
  3. Run the node
  4. Run the menu option **8.
  5. Select the type of virtual machine on which to run the contract.
  6. 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

  1. Run the menu 9. Call contract.
  2. Enter the contract deployer account
  3. Enter the hash of all the transactions that will be deployed when the contract is run.
  4. Enter the inputs required to run the contract to complete the execution of the contract.
tips:

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 or Calldata in Remix IDE
    A string of hexadecimal digits (as shown in the following figure).

hex

  • Start Transformers validator node,generated contract folder in current directory of the program.Placed the binary code generated from the contract into the contract file in the directory.

Example: The content of the contract file is similar to the following figure.

img

Contract Deployment

  1. Run the following command to run the node in menu mode
./tfs_v0.32.x_xxxx_testnet - m
  1. Validator node running Menu Options 8. Deploy Contract

  2. Select the type of virtual machine running the contract.

  3. 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:

    1. To read the information column of a file type, you need to enter the file path or use default rules to read it.
    2. In advance, place the binary source code in the contract file. You can read the information from the file directly by selecting option 0. If the contract file does not exist, skip the contract reading operation.
      img
    3. 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
  4. 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 is Calldata, skip directly). Otherwise,enter 0 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

  1. Validator node running Menu options 9. Call contract
  2. Enter the wallet address of the contract deployer, which is the wallet address of the deployment contract node.
  3. Enter the transaction hash when running contract deployment.
  4. Enter the input args to run the contract.
  5. 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.
  6. Enter the fees to be paid to the contract.0 can be entered.
Tips:

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 100TTOS, enter 10,000,000,000; If 100 is entered, the actual payment will be made to the contract 0.000001TTOS.