Ontology Developer Center
DISCOVERCOMMUNITYSUPPORT
  • Introduction
  • Discover Ontology
  • Getting Started
  • Glossary
  • Decentralized Identity and Data
    • ONT ID
      • Decentralized Identifiers
        • Method Specification for Ontology
        • Method Specification for Ethereum
        • Method Specification for BSC
      • Verifiable Credentials
        • Anonymous Credentials
      • ONT Login
        • Scenarios
        • Protocol Specification
        • Front-end JavaScript SDK
          • Integration and Usage
          • API Reference
        • Front-end UI SDK
          • Integration and Usage
          • API Reference
        • Back-end Go SDK
          • Integration and Usage
          • API Reference
        • Back-end Java SDK
          • Integration and Usage
          • API Reference
      • ONT TAG
        • Workflow
        • API Reference
      • Mercury
      • OScore
    • DDXF
      • Components and Interfaces
      • GREP
      • Overall Scheme
      • Solutions
        • Marketplace
          • Deployment
          • Scenarios
          • SaaS Tenant
          • Java SDK
        • Data Storage
          • Deployment
          • Java SDK
        • Resource Auditor
        • Offline Judge
      • Use Cases
        • E-Shops
  • ONTOLOGY ELEMENTS
    • Smart Contracts
      • Types of smart contracts
    • Token Protocols
    • Consensus Mechanism
    • Ontology Oracle
      • Oracle Process Flow
  • GUIDES & TUTORIALS
    • Development Guides
      • dApp Development
        • Using the dAPI
        • Data Synchronization
      • Smart Contract Development
        • EVM Contract
          • Development Environment and Tools
          • Wallet Setup
          • Contract Development
          • How to Deploy a Smart Contract with GetBlock
        • NeoVM Contract
          • Development tools and environment
          • Launching the IDE
          • Writing and editing program logic
          • Deploying and testing on private net
        • WASM Contract
          • Development Environment
          • Project Initiation - Hello World
          • Creating your own project
          • Development using SmartX
          • Runtime API
          • Contract Fundamentals
          • Inter-contract Interaction
          • Developing Contracts in C++
        • Publish Contract Source Code
    • Integration Guides
      • dApp Integration
        • dAPI Integration
          • Chrome Plugin
          • Mobile wallet dApp
          • QR code mechanism
          • Wake call mechanism
        • Cocos 2D-x
        • Unity 3D applications
      • Mobile Wallet Integration
        • SDK integration
        • dAPI Integration
          • In-wallet applications
          • QR code mechanism
          • Wake call mechanism
        • Stake
      • Using ONT ID
      • Exchange Integration
        • Exchange Docking Guide
        • Exchange API
      • Ontology for dApp Stores
    • EVM & Token Decimals Upgrade
  • ONTOLOGY NODE
    • Abstract
    • Node Deployment
      • Standard Node
      • Rosetta Node
    • Interacting with a Public Node
  • DEVELOPER TOOLS
    • dApp Development Framework
      • Punica CLI
      • Punica boxes
      • Solo Chain
    • IDE
    • APIs
      • HTTP API
        • Restful
        • WebSocket
        • Remote Procedure Call (RPC)
      • Explorer v2 API
        • Block
        • Address
        • Contract
        • Token
        • Transactions
        • ONT ID
        • Summary
        • Node
      • Native Token API
        • ONT Contract API
        • ONG Contract API
      • ONT ID Contract API
      • Web3 API
      • OScore Open API
      • Rosetta Node API
        • Data API
        • Construction API
      • DToken Contract API
      • DDXF
        • Marketplace Contract API
        • Storage API
      • Governance API
    • Digital Wallet
      • Chrome Plugin provider
      • Chrome Plugin dAPI
      • Mobile version provider
      • Mobile version dAPI
    • SDKs
    • Signing Server
      • Installation
      • API reference
  • COMMUNITY
    • Ecosystem Programs
    • Community Libraries
    • Community Events
    • Community Channels
    • Core Contributors
  • SUPPORT
    • FAQ
      • Basic blockchain concepts
      • Ontology Nodes
      • Ontology token protocols
      • Smart contracts
      • SDKs and APIs
    • Contact Us
Powered by GitBook
On this page
  • Introduction
  • Ontology Nodes
  • Changes to ONT & ONG Deposit Events (required)
  • ONT Transaction Events
  • ONG Transaction Events
  • Withdraw ONT & ONG Using tranferV2 (optional)
  • Ontology SDKs
  • Signature Server

Was this helpful?

  1. GUIDES & TUTORIALS

EVM & Token Decimals Upgrade

PreviousOntology for dApp StoresNextAbstract

Last updated 3 years ago

Was this helpful?

Introduction

To provide better support for dApps on Ontology, the network now is EVM compatible. Transaction fees are still paid in ONG. However, now ONT has 9 decimals, and ONG has 18 decimals.

This guide introduces the upgrade work needed on your end to enjoy these features.

Ontology Nodes

The Ontology MainNet will be upgraded at the block height of 13920000, please finish the local node upgrade before that (but after Ontology MainNet consensus nodes upgrade).

Ontology release link:

Changes to ONT & ONG Deposit Events (required)

The events and logs for ONT / ONG transactions will be different after the upgrade, which affects your event listeners.

ONT Transaction Events

Contract address: "0100000000000000000000000000000000000000"

The array held by States can have 4 or 5 elements.

a. When the transaction amount is an integer, the event remains the same.

Example

Transfer 1 ONT:

{
    "ContractAddress": "0100000000000000000000000000000000000000",
        "States": [
        "transfer",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        1
    ]
},

States[0]: "transfer" (fixed)

States[1]: from address

States[2]: to address

States[3]: amount (integer, no decimal place)

b. When the transaction amount is a decimal number, States looks like the below example.

Example

Transfer 1.052999999 ONT:

{
    "ContractAddress": "0100000000000000000000000000000000000000",
        "States": [
        "transfer",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        1,
        52999999
    ]
}

States[0]: "transfer" (fixed)

States[1]: from address

States[2]: to address

States[3]: amount (integer representing digits before the decimal point, no decimal place)

States[4]: amount (integer representing digits after the decimal point, 9 digits maximum)

ONG Transaction Events

Contract address ”0200000000000000000000000000000000000000“

The array held by States can have 4 or 5 elements.

a. When the number of the transaction amount only have 1 - 9 decimal places, the event remains the same.

Example

Transfer 0.000000001 ONG:

{
    "ContractAddress": "0200000000000000000000000000000000000000",
    "States": [
        "transfer",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        1
    ]
}

States[0]: "transfer" (fixed)

States[1]: from address

States[2]: to address

States[3]: amount (integer representing digits after the decimal point, 9 digits maximum)

b. When the number of the transaction amount have 10 - 18 decimal places, States looks like the below example.

Example

Transfer 0.00000000105 ONG:

{
"ContractAddress": "0200000000000000000000000000000000000000",
    "States": [
        "transfer",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        "AdeTj6K9UUmz5yfyc8SLX7mJSmCqDKK6yT",
        1,
        50000000
    ]
}

States[0]: "transfer" (fixed)

States[1]: from address

States[2]: to address

States[3]: amount (integer representing digits on the 1st - 9th decimal places, 9 digits maximum)

States[4]: amount (integer representing digits on the 10th - 18th decimal places, 9 digits maximum)

Withdraw ONT & ONG Using tranferV2 (optional)

Previously, the transfer method is used for ONT and ONG withdrawals, which only takes an integer for the ONT withdrawal amount, or a decimal with 9 places for the ONG withdrawal amount (the smallest number is 0.000000001). The tranferV2 method is created to accommodate the decimals upgrade.

The transfer method still functions as before, you can continue using the method and related code if you don't change existing withdrawal rules. If you want to adapt to the decimals upgrade, you need to make below changes:

Ontology SDKs

Please use the latest SDKs:

SDK
Demo

Signature Server

There are two ways to sign a transaction:

  1. First, invoke the Ontology SDK method transferV2 to construct a transaction, and get the raw transaction in hex format. Then call the Ontology signature server method sigrawtx to sign the transaction, and get the signed transaction in hex format. Last, call the node's sendrawtx method to broadcast the transaction.

  2. Invoke the Ontology signature server method sigtransfertxV2 to construct a transaction and sign it, and call the node's sendrawtx method to broadcast the transaction.

,

Please read the detailed doc for Ontology Signature Server .

https://github.com/ontio/ontology/releases/tag/v2.3.5
here
Golang
Demo
Java
Demo 1
Demo 2
TypeScript
Demo