Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRC-44: Address.isContract instruction #44

llwslc opened this issue Jul 11, 2019 · 1 comment


Copy link

commented Jul 11, 2019

tip: 44
title: TRC-44 Address.isContract instructions
author: llwslc<> 
discussions to:
category: TRC
status: accept
created: 2019-07-10

Simple Summary

To provide a new opcode, which returns the type of the address.


This TIP specifies a new opcode, which determines whether the address type is a contract address.


Some contracts need to limit its callers, such as some functions can only be called by the user, not by the contract.


A new opcode, ISCONTRACT, is introduced, with number 0xD4. The ISCONTRACT takes one argument from the stack, pushes to the stack the boolean value whether the address type is a contract address.

In case the address does not exist false is pushed to the stack.


contract Test {
    function checkAddr(address addr) view public returns (bool) {
        return addr.isContract;

The energy cost of the ISCONTRACT is 400.

Backwards Compatibility

There are no backwards compatibility concerns.

Test Cases

  1. The ISCONTRACT of a contract address is true.
  2. The ISCONTRACT of an account address is false.
  3. The ISCONTRACT of a non-existent address is false.
  4. The ISCONTRACT of a precompiled contract is false.
  5. The ISCONTRACT of self address in constructor function is true.
  6. The ISCONTRACT of a selfdestructed contract address is false.
@jeancky jeancky changed the title TRC: Address.isContract instructions TRC - 44: Address.isContract instructions Sep 10, 2019
@jeancky jeancky changed the title TRC - 44: Address.isContract instructions TRC-44 Address.isContract instructions Sep 10, 2019
@jeancky jeancky changed the title TRC-44 Address.isContract instructions TRC-44: Address.isContract instructions Sep 10, 2019
@jeancky jeancky changed the title TRC-44: Address.isContract instructions TRC-44: Address.isContract instruction Sep 10, 2019

This comment has been minimized.

Copy link

commented Sep 24, 2019

I think it is a good suggestion. Ability to extend TVM's access to blockchain while enriching the capabilities of smart contracts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.