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-43: Precompiled contract function for signature parallel verification #43

Closed
Sh11thead opened this issue Jul 10, 2019 · 1 comment
Closed

Comments

@Sh11thead
Copy link
Contributor

Sh11thead commented Jul 10, 2019

tip: 43
title: TRC-43: Precompiled contract function for signature parallel verification
author: Sh11thead<ksl2945@gmail.com> 
discussions to: https://github.com/tronprotocol/TIPs/issues/43
category: TRC
status: accept
created: 2019-07-10

Simple Summary

A new type of precompiled contract function for signature parallel verification

Abstract

Add a new type of build-in precompiled contract function for multisign validating instead of the compiled bytecode do the same task.

Motivation

Since the multi-signature is widely used in Tron, there needs a way for low energy cost and less CPU time multisign validating, the precompiled contract for multi-signature could be a well satisfying solution.

Specification

Adds a new precompiled contract function named batchvalidatesign , which need 3 arguments input:

  • bytes32 hash
  • bytes[] signatures
  • address[] addresses

Sample code

pragma experimental ABIEncoderV2;
contract Demo {
    function testBatch(bytes32 hash, bytes[] memory signatures, address[] memory addresses) public returns(bytes32){
        return batchvalidatesign(hash, signatures, addresses);
    }
}

output of the result of signature validating would be a bytes32, for example :
10100000000000000000000000000000 representing the first signatue and third signatue is correct

for safety concern, the number of signatures is limited to 16,when count of signatures is greater than 16,all zero output will be provided.

Energy cost

energy charge for the execution cost 1500 per signature

@BlueHoopor BlueHoopor changed the title TRC: Precompiled contract function for multisign validating TIP 43: Precompiled contract function for multisign validating Sep 10, 2019
@BlueHoopor BlueHoopor changed the title TIP 43: Precompiled contract function for multisign validating TRC-43: Precompiled contract function for multisign validating Sep 10, 2019
@zhaohong zhaohong changed the title TRC-43: Precompiled contract function for multisign validating TRC-43: Precompiled contract function for signature parallel verification Sep 15, 2019
@Leorexo
Copy link

Leorexo commented Sep 24, 2019

It seems to be a very useful precompiled contract. Save a lot of energy while verifying signatures in batch, while simplifying code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants