aionnetwork / AIP

Network & Protocol Improvement Proposals for Aion
https://aion.network
16 stars 13 forks source link

AIP #007 - To support transaction hash within solidity contract #10

Closed rakeshgohel01 closed 5 years ago

rakeshgohel01 commented 6 years ago

Title: To access transaction hash within solidity contract Author(s): Rakesh Gohel Type: Core Status: REVIEW Creation Date: October 3, 2018 Contact Information: rakesh@mavennet.com

Summary

Need to access transaction hash during solidity method execution.

Value Proposition

Transaction hash is a unique identifier which can be used during the execution of solidity method to save the state.

Motivation

The primary motivation for the proposol is to save transaction hash when bridge operator contract processes the bundle in bridge operator standard mentioned in AIP-005.

Non-Goals

The scope of this document is to provide access to only transaction hash when a solidity contract method being executed.

Success Metrics

The key indicator of success for this function can be measured by number of contracts using them. The bidirectional bridge has bridge operator contract which consumes this functionality.

Description

Bridge operator contract mentioned in AIP-005 processes the bundle reported by the bridge operator. If the bundle has been signed by minimum required signatories, the bridge operator contract initiates thawing token with the help of ATS token contract.

At the end of processing the complete bundle with all those transfer transactions, the bridge operator contract announces on blockchain by mapping bundle hash with transaction hash. If a bundle hash has a transction hash associated, it is deemed that the bundle has been processed.

High-Level Architecture

N/A

Specification

Definitions

Method

A constant function must be implemented.

transactionhash function

Returns hash of the transaction.

returns: bytes32.

    function transactionhash() public returns (bytes32);

Logic

N/A

Cross Chain Functionality

N/A

Risks & Assumptions

Compatibility notes:
transactionhash is not supported in Ethereum solidity, in case of porting Aion contract on Ethereum, this function will not be available on Ethereum.

Test Cases

N/A

Implementations

N/A

Dependencies

N/A

Copyright

All AIP’s are public domain. Copyright waiver: https://creativecommons.org/publicdomain/zero/1.0/

sampajotphipps commented 6 years ago

@mocha384 Could you change the Type to "Interface". Thanks!

qoire commented 6 years ago

@sampajotphipps I believe this is more of a "core" target, the way I see this change happening is the addition of a new OPCODE in the FVM.

sampajotphipps commented 6 years ago

@mocha384 updated to in REVIEW @qoire changed to Core type.

sampajotphipps commented 6 years ago

Open call for any comments, feedback or concerns.

qoire commented 6 years ago

@AionJayT have a look at this, relates to some kernel changes

rakeshgohel01 commented 5 years ago

@jeff-aion We would like to access transactionHash within a Java smart contract. Can we have a similar feature for AVM too?