Skip to content

Latest commit

 

History

History
647 lines (563 loc) · 78.4 KB

readme.md

File metadata and controls

647 lines (563 loc) · 78.4 KB

CGAS

Release Note:

1.0.3

Script Hash: 0x74f2dc36a68fdc4682034178eb2220729231db76

CGAS Contract Address: AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM

Known Issues: not found

1.0.2

Script Hash: 0x505663a29d83663a838eee091249abd167e928f5

CGAS Contract Address: Ae8AD6Rc3cvQapqttJcUTj9ULfLi2tLHmc

Known Issues: transfer method cannot be called by other contract

1.0.1

Script Hash: 0x9121e89e8a0849857262d67c8408601b5e8e0524

CGAS Contract Address: AK4LdT5ZXR9DQZjfk5X6Xy79mE8ad8jKAW

Known Issues: transferAPP method naming not canonical

It is recommended to use the latest version, if you have already used the old version, do not worry, you can refund CGAS to GAS and transfer GAS to the latest version contract. the old version contract will not cause asset loss.

Readme

English 简体中文

Overview:

CGAS refer to NEP-5 contract assets issued by NGD (NEO Global Development). CGAS can be exchanged for GAS at a 1:1 ratio and are fully refundable. The contract aims to map global assets GAS for the benefit of its internal transfer using the method of contract invocation.

Descriptions:

Methods defined in NEP-5 standard:

Methods Parameters Return value Descriptions
balanceOf byte[] account int Get the CGAS balance of an account. The return value is the actual amount x 10⁸.
decimals --- int Get the decimals of CGAS. The return value is constant 8.
name --- string Get the contract name. The return value is constant NEP5 GAS.
symbol --- string Get the contract symbol. The return value is constant CGAS.
totalSupply --- int Get the total supply of CGAS. The return value is the actual amount × 10⁸. Given that CGAS is exchanged for GAS at a 1:1 ratio, the GAS amount retrieved from the contract address is equal to the total supply of CGAS.
transfer byte[] from, byte[] to, int amount bool A transfer method that transfers CGAS from the sender account to the recipient account. The transfer value is the "amount"; "from" and "to" are script hash value and "amount" is the actual transfer amount × 10⁸. This method supports both user invocation and contract invocation.

Additional methods other than NEP-5 methods used to support GAS-CGAS swap:

Methods Parameters Return value Descriptions
getRefundTarget byte[] txId byte[] Get the owner of the UTXO pending refund; the parameter is the TxId of the UTXO (confirm that a UTXO consists of TxId and output index; the output index takes the default value of 0); the return value is the account the UTXO is refunded to, whose owner can set the UTXO as a transaction input and send GAS from the CGAS address to his/her account.
getTxInfo byte[] txId TransferInfo Get detailed transfer info under a TxId. TxInfo will be recorded under the following 4 instructions: mintTokens, refund, transfer, transferAPP.
mintTokens --- bool A mintTokens method for CGAS users, who can transfer GAS to CGAS contract address by constructing InvocationTransaction and convert GAS to CGAS by invoking mintTokens method. Upon successful invocation, CGAS in the equal value of the GAS will be added to the user's asset account. NOTE
refund byte[] from bool It takes two steps to claim CGAS and convert it to GAS. First, construct an InvocationTransaction, including GAS transfer within the same CGAS address (the transfer amount should be the GAS amount users expect to get refunded) to invoke the refund method (set the parameter as the Script Hash of the refund account). Upon successful invocation, CGAS in the equal amount of the refunded GAS will be automatically destroyed and the No.0 output of the transaction will be marked with the ownership of the user. Second, the user may construct a transaction and set the UTXO marked in the first step as a transaction input and his/her account as the transaction output to get GAS from the CGAS address.
supportedStandards --- string NEP-10 standard for return contract; the return value is constant {"NEP-5", "NEP-7", "NEP-10"}.

Notification defined in NEP-5 standard:

Notification Parameters Descriptions
transfer byte[] from, byte[] to, int value Notification contains the three elements of transfer: sender (from), recipient (to) and transfer value (value). CGAS is the default type of assets for transfer.

Other notifications realized in the contract:

Notification Parameters Descriptions
refund byte[] txid, byte[] who Notification contains two elements of transfer: UTXO pending refund (txid) and Script Hash of refund account (who).

[NOTE]

In mintTokens, please note that the total count of InvocationTransaction Inputs and Outputs should not be more than 60, otherwise the cost of execution will exceed the free limit of 10 GAS. If a large number of GAS UTXO need to be exchange to CGAS, it is recommended to make a regular transfer, UTXO merge, and then Minttokens operation.

Examples

The following are the trading structures of mintTokens and refund and the application Log for developers' reference.

mintTokens transaction:

[NOTE]

Type: InvocationTransaction

Input: from user's address

Output: to CGAS contract address

Script: invoke mintTokens methods in CGAS contract

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x48bd784d0ed6000cba64d0e303117e4c10081e3268afcf3b07e8b353a7594772",
        "size": 246,
        "type": "InvocationTransaction",
        "version": 1,
        "attributes": [],
        "vin": [
            {
                "txid": "0x5918258bb67ee292358f8780d6b86e8fcd825bdde623429e4e547a2f9e496cf8",
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "10",
                "address": "AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM"
            }
        ],
        "sys_fee": "0",
        "net_fee": "0",
        "scripts": [
            {
                "invocation": "408e13fc267d69ca1c8463ac8bc3f266343ee0661ef85e9fa66fe986dc787f14fc6c13279bc90883297e186ca65d918ccdcf407497c0de1de9573e9a519a4f9aa5",
                "verification": "21037ebe29fff57d8c177870e9d9eecb046b27fc290ccbac88a0e3da8bac5daa630dac"
            }
        ],
        "script": "000a6d696e74546f6b656e736776db3192722022eb7841038246dc8fa636dcf274f16658600e9b9af88bcb",
        "gas": "0",
        "blockhash": "0xafb5b19021e1b57e7d64deb9d99bedabb0e40fdc3393d6c58c324730c0061aae",
        "confirmations": 2,
        "blocktime": 1536906512
    }
}

mintTokens application log:

{
	"txid": "0x48bd784d0ed6000cba64d0e303117e4c10081e3268afcf3b07e8b353a7594772",
	"vmstate": "HALT, BREAK",
	"gas_consumed": "4.648",
	"stack": [],
	"notifications": [{
		"contract": "0x74f2dc36a68fdc4682034178eb2220729231db76",
		"state": {
			"type": "Array",
			"value": [{
				"type": "ByteArray",
				"value": "7472616e73666572"
			}, {
				"type": "ByteArray",
				"value": ""
			}, {
				"type": "ByteArray",
				"value": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
			}, {
				"type": "Integer",
				"value": "1000000000"
			}]
		}
	}]
}

refund 1st step transaction:

[NOTE]

Type: InvocationTransaction

Input: from CGAS contract address

Output: to CGAS contract address (same address to input)

Script: invoke refund methods in CGAS contract, and set the parameter as the Script Hash of the refund account

Scripts: need 2 witnesses: 1、witness of CGAS; 2、witness of user (additional witness)

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x306daa4ab2b2ef73ff4fd8f9121fc926f5e21653080602b6841ad3f17f80777c",
        "size": 7205,
        "type": "InvocationTransaction",
        "version": 0,
        "attributes": [
            {
                "usage": "Script",
                "data": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
            }
        ],
        "vin": [
            {
                "txid": "0x48bd784d0ed6000cba64d0e303117e4c10081e3268afcf3b07e8b353a7594772",
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "5",
                "address": "AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM"
            },
            {
                "n": 1,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "5",
                "address": "AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM"
            }
        ],
        "sys_fee": "0",
        "net_fee": "0",
        "scripts": [
            {
                "invocation": "520131",
                "verification": "012fc56b6c766b00527ac46c766b51527ac4616168164e656f2e52756e74696d652e47657454726967676572009c6c766b52527ac46c766b52c36418046161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b53527ac46c766b53c36168194e656f2e5472616e73616374696f6e2e476574496e707574736c766b54527ac46c766b53c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b55527ac4616c766b54c36c766b59527ac4006c766b5a527ac4622b016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168124e656f2e496e7075742e476574496e646578009c6c766b5c527ac46c766b5cc364de00616168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c6545176c766b5d527ac46c766b5dc36c766b5bc36168114e656f2e496e7075742e47657448617368617c6555176c766b5e527ac46c766b5ec3c000a06c766b5f527ac46c766b5fc3646f00616c766b54c3c051907c907c9e6310006c766b55c3c0519c009c620400516c766b60527ac46c766b60c3640f00006c766b0111527ac4620f076c766b55c300c36168184e656f2e4f75747075742e476574536372697074486173686c766b5ec39c6c766b0111527ac462dc0661616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63ccfe61682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b56527ac4006c766b57527ac4616c766b53c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b0112527ac4006c766b0113527ac462e9006c766b0112c36c766b0113c3c36c766b0114527ac4616c766b0114c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b0115527ac46c766b0115c3640f00006c766b0111527ac462d0056c766b0114c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b0116527ac46c766b0116c3642c006c766b57c36c766b0114c36168134e656f2e4f75747075742e47657456616c7565936c766b57527ac4616c766b0113c351936c766b0113527ac46c766b0113c36c766b0112c3c09f630cff006c766b58527ac4616c766b55c36c766b0117527ac4006c766b0118527ac4628b006c766b0117c36c766b0118c3c36c766b0119527ac4616c766b0119c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b011a527ac46c766b011ac3642c006c766b58c36c766b0119c36168134e656f2e4f75747075742e47657456616c7565936c766b58527ac4616c766b0118c351936c766b0118527ac46c766b0118c36c766b0117c3c09f636aff6c766b58c36c766b57c39c6c766b0111527ac4627c046168164e656f2e52756e74696d652e47657454726967676572609c6c766b011b527ac46c766b011bc3649e026161682b53797374656d2e457865637574696f6e456e67696e652e47657443616c6c696e67536372697074486173686c766b011c527ac46c766b00c30962616c616e63654f66876c766b011d527ac46c766b011dc36419006c766b51c300c36165f7036c766b0111527ac462e2036c766b00c308646563696d616c73876c766b011e527ac46c766b011ec3641200616570046c766b0111527ac462b3036c766b00c30f676574526566756e64546172676574876c766b011f527ac46c766b011fc36419006c766b51c300c361653b046c766b0111527ac46276036c766b00c3096765745478496e666f876c766b0120527ac46c766b0120c36419006c766b51c300c36165b1046c766b0111527ac4623f036c766b00c30a6d696e74546f6b656e73876c766b0121527ac46c766b0121c36412006165e6056c766b0111527ac4620e036c766b00c3046e616d65876c766b0122527ac46c766b0122c36412006165200a6c766b0111527ac462e3026c766b00c306726566756e64876c766b0123527ac46c766b0123c36419006c766b51c300c36165fc096c766b0111527ac462af026c766b00c30673796d626f6c876c766b0124527ac46c766b0124c36412006165f70e6c766b0111527ac46282026c766b00c312737570706f727465645374616e6461726473876c766b0125527ac46c766b0125c36412006165ca0e6c766b0111527ac46249026c766b00c30b746f74616c537570706c79876c766b0126527ac46c766b0126c36412006165bc0e6c766b0111527ac46217026c766b00c3087472616e73666572876c766b0127527ac46c766b0127c36441006c766b51c300c36c766b51c351c36c766b51c352c36c766b011cc361537951795572755172755279527954727552727565d60e6c766b0111527ac462b9016162a9016168164e656f2e52756e74696d652e47657454726967676572519c6c766b0128527ac46c766b0128c3647d016161682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b0129527ac461682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b012a527ac4616c766b012ac361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b012b527ac4006c766b012c527ac462bb006c766b012bc36c766b012cc3c36c766b012d527ac4616c766b012dc36168184e656f2e4f75747075742e476574536372697074486173686c766b0129c3907c907c9e6347006c766b012dc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e620400006c766b012e527ac46c766b012ec3640f00006c766b0111527ac4623d00616c766b012cc351936c766b012c527ac46c766b012cc36c766b012bc3c09f633aff516c766b0111527ac4620f00006c766b0111527ac46203006c766b0111c3616c756654c56b6c766b00527ac4616c766b00c3c001149c009c6c766b52527ac46c766b52c36439003254686520706172616d65746572206163636f756e742053484f554c442062652032302d62797465206164647265737365732e6175f06168164e656f2e53746f726167652e476574436f6e74657874056173736574617c652f0f6c766b51527ac46c766b51c36c766b00c3617c65530f6c766b53527ac46203006c766b53c3616c756600c56b58616c756654c56b6c766b00527ac4616c766b00c3c001209c009c6c766b52527ac46c766b52c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c657a0e6c766b51527ac46c766b51c36c766b00c3617c659e0e6c766b53527ac46203006c766b53c3616c756656c56b6c766b00527ac4616c766b00c3c001209c009c6c766b53527ac46c766b53c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c65cd0d6c766b51527ac46c766b51c36c766b00c3617c65f10d6c766b52527ac46c766b52c3c0009c6c766b54527ac46c766b54c3640e00006c766b55527ac4622c006c766b52c36168174e656f2e52756e74696d652e446573657269616c697a656c766b55527ac46203006c766b55c3616c756653c56b6c766b00527ac4616c766b00c361681a4e656f2e426c6f636b636861696e2e476574436f6e74726163746c766b51527ac46c766b51c36424006c766b51c36168164e656f2e436f6e74726163742e497350617961626c65620400516c766b52527ac46203006c766b52c3616c75660114c56b6161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b00527ac4006c766b51527ac46c766b00c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b52527ac4616c766b52c36c766b59527ac4006c766b5a527ac46210016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c6c766b5c527ac46c766b5cc36434006c766b51c376632400756c766b5bc36168184e656f2e4f75747075742e476574536372697074486173686c766b51527ac46c766b5bc36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689c6c766b5d527ac46c766b5dc3640e00006c766b5e527ac462dd02616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63e7fe6c766b00c36168174e656f2e5472616e73616374696f6e2e476574486173686165dafc00a06c766b5f527ac46c766b5fc3640e00006c766b5e527ac46280026c766b00c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b53527ac4006c766b54527ac4616c766b53c36c766b60527ac4006c766b0111527ac46203016c766b60c36c766b0111c3c36c766b0112527ac4616c766b0112c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e6753637269707448617368907c907c9e6347006c766b0112c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c620400006c766b0113527ac46c766b0113c3642e00616c766b54c36c766b0112c36168134e656f2e4f75747075742e47657456616c7565936c766b54527ac461616c766b0111c351936c766b0111527ac46c766b0111c36c766b60c3c09f63f3fe6168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c658b096c766b55527ac46c766b55c30b746f74616c537570706c79617c65030a6c766b56527ac46c766b56c36c766b54c3936c766b56527ac46c766b55c30b746f74616c537570706c796c766b56c361527265290a616168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6514096c766b57527ac46c766b57c36c766b51c3617c6538096c766b58527ac46c766b57c36c766b51c36c766b58c36c766b54c39361527265260a61006c766b51c36c766b54c36152726596046161006c766b51c36c766b54c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5e527ac46203006c766b5ec3616c756600c56b084e45503520474153616c75660111c56b6c766b00527ac4616c766b00c3c001149c009c6c766b59527ac46c766b59c36436002f54686520706172616d657465722066726f6d2053484f554c442062652032302d62797465206164647265737365732e6175f061682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b51527ac46c766b51c361681a4e656f2e5472616e73616374696f6e2e4765744f75747075747300c36c766b52527ac46c766b52c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b5a527ac46c766b5ac3640e00006c766b5b527ac46228036c766b52c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689e6c766b5c527ac46c766b5cc3640e00006c766b5b527ac462bd026168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c65d5066c766b53527ac46c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e47657448617368617c65df06c000a06c766b5d527ac46c766b5dc3640e00006c766b5b527ac4624b026c766b00c36168184e656f2e52756e74696d652e436865636b5769746e657373009c6c766b5e527ac46c766b5ec3640e00006c766b5b527ac4620f026168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6528066c766b54527ac46c766b54c36c766b00c3617c654c066c766b55527ac46c766b52c36168134e656f2e4f75747075742e47657456616c75656c766b56527ac46c766b55c36c766b56c39f6c766b5f527ac46c766b5fc3640e00006c766b5b527ac46287016c766b55c36c766b56c39c6c766b60527ac46c766b60c36416006c766b54c36c766b00c3617c653f0761621f006c766b54c36c766b00c36c766b55c36c766b56c39461527265c606616c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3615272654007616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c6524056c766b57527ac46c766b57c30b746f74616c537570706c79617c659c056c766b58527ac46c766b58c36c766b56c3946c766b58527ac46c766b57c30b746f74616c537570706c796c766b58c361527265c205616c766b00c3006c766b56c3615272658c0061616c766b00c3006c766b56c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961616c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3617c06726566756e6453c168124e656f2e52756e74696d652e4e6f7469667961516c766b5b527ac46203006c766b5bc3616c756656c56b6c766b00527ac46c766b51527ac46c766b52527ac46161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726168174e656f2e5472616e73616374696f6e2e476574486173686c766b53527ac46153c5766c766b00c3007cc4766c766b51c3517cc4766c766b52c3527cc46c766b54527ac46168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c6587036c766b55527ac46c766b55c36c766b53c36c766b54c36168154e656f2e52756e74696d652e53657269616c697a6561527265470561616c756600c56b0443474153616c756600c56b1c7b224e45502d35222c20224e45502d37222c20224e45502d3130227d616c756652c56b616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c65f3026c766b00527ac46c766b00c30b746f74616c537570706c79617c656b036c766b51527ac46203006c766b51c3616c756653c56b6c766b00527ac46c766b51527ac46c766b52527ac451616c75665fc56b6c766b00527ac46c766b51527ac46c766b52527ac46c766b53527ac4616c766b00c3c00114907c907c9e6311006c766b51c3c001149c009c620400516c766b57527ac46c766b57c3643e003754686520706172616d65746572732066726f6d20616e6420746f2053484f554c442062652032302d62797465206164647265737365732e6175f06c766b52c300a16c766b58527ac46c766b58c36433002c54686520706172616d6574657220616d6f756e74204d5553542062652067726561746572207468616e20302e6175f06c766b51c3616575f4009c6c766b59527ac46c766b59c3640e00006c766b5a527ac462a9016c766b00c36168184e656f2e52756e74696d652e436865636b5769746e6573736311006c766b00c36c766b53c39e620400006c766b5b527ac46c766b5bc3640e00006c766b5a527ac4625d016168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6542016c766b54527ac46c766b54c36c766b00c3617c6566016c766b55527ac46c766b55c36c766b52c39f6c766b5c527ac46c766b5cc3640e00006c766b5a527ac462f7006c766b00c36c766b51c39c6c766b5d527ac46c766b5dc3640e00516c766b5a527ac462d2006c766b55c36c766b52c39c6c766b5e527ac46c766b5ec36416006c766b54c36c766b00c3617c65560261621f006c766b54c36c766b00c36c766b55c36c766b52c39461527265dd01616c766b54c36c766b51c3617c65bd006c766b56527ac46c766b54c36c766b51c36c766b56c36c766b52c39361527265ab01616c766b00c36c766b51c36c766b52c36152726517fc61616c766b00c36c766b51c36c766b52c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5a527ac46203006c766b5ac3616c756653c56b6c766b00527ac46c766b51527ac4616152c5766c766b00c3007cc4766c766b51c3517cc46c766b52527ac46203006c766b52c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756653c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c68124e656f2e53746f726167652e44656c65746561616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c7566"
            },
            {
                "invocation": "404c53a9ca937470df9dcbbb71cf00e2b4d75761e4667ccfd820e40829887c4444c7911ed509e564b2bac30e41c92c43f7df2dd2a25ea1c8e2bc10aec3d3208251",
                "verification": "21037ebe29fff57d8c177870e9d9eecb046b27fc290ccbac88a0e3da8bac5daa630dac"
            }
        ],
        "script": "14e8e3ce08268d16d867101feaf8c0ea130a923aba51c106726566756e646776db3192722022eb7841038246dc8fa636dcf274f1",
        "gas": "0",
        "blockhash": "0xd04d56259a6c92e290ab009e2062fbd078c3c371036d74dd745b379a4d55a899",
        "confirmations": 14,
        "blocktime": 1536907058
    }
}

refund 1st step application log:

{
	"txid": "0x306daa4ab2b2ef73ff4fd8f9121fc926f5e21653080602b6841ad3f17f80777c",
	"vmstate": "HALT, BREAK",
	"gas_consumed": "5.582",
	"stack": [],
	"notifications": [{
		"contract": "0x74f2dc36a68fdc4682034178eb2220729231db76",
		"state": {
			"type": "Array",
			"value": [{
				"type": "ByteArray",
				"value": "7472616e73666572"
			}, {
				"type": "ByteArray",
				"value": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
			}, {
				"type": "ByteArray",
				"value": ""
			}, {
				"type": "Integer",
				"value": "500000000"
			}]
		}
	}, {
		"contract": "0x74f2dc36a68fdc4682034178eb2220729231db76",
		"state": {
			"type": "Array",
			"value": [{
				"type": "ByteArray",
				"value": "726566756e64"
			}, {
				"type": "ByteArray",
				"value": "7c77807ff1d31a84b60206085316e2f526c91f12f9d84fff73efb2b24aaa6d30"
			}, {
				"type": "ByteArray",
				"value": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
			}]
		}
	}]
}

refund 2nd step transaction:

[NOTE]

Type: ContractTransaction

Input: from CGAS contract address

Output: to user's address

Scripts: witness of CGAS

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x595b1dce00e6a7c72e2650573b8b82831128428bd445830f226c1390bca8b45d",
        "size": 6969,
        "type": "ContractTransaction",
        "version": 0,
        "attributes": [],
        "vin": [
            {
                "txid": "0x306daa4ab2b2ef73ff4fd8f9121fc926f5e21653080602b6841ad3f17f80777c",
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "5",
                "address": "Ad1HKAATNmFT5buNgSxspbW68f4XVSssSw"
            }
        ],
        "sys_fee": "0",
        "net_fee": "0",
        "scripts": [
            {
                "invocation": "520131",
                "verification": "012fc56b6c766b00527ac46c766b51527ac4616168164e656f2e52756e74696d652e47657454726967676572009c6c766b52527ac46c766b52c36418046161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b53527ac46c766b53c36168194e656f2e5472616e73616374696f6e2e476574496e707574736c766b54527ac46c766b53c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b55527ac4616c766b54c36c766b59527ac4006c766b5a527ac4622b016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168124e656f2e496e7075742e476574496e646578009c6c766b5c527ac46c766b5cc364de00616168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c6545176c766b5d527ac46c766b5dc36c766b5bc36168114e656f2e496e7075742e47657448617368617c6555176c766b5e527ac46c766b5ec3c000a06c766b5f527ac46c766b5fc3646f00616c766b54c3c051907c907c9e6310006c766b55c3c0519c009c620400516c766b60527ac46c766b60c3640f00006c766b0111527ac4620f076c766b55c300c36168184e656f2e4f75747075742e476574536372697074486173686c766b5ec39c6c766b0111527ac462dc0661616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63ccfe61682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b56527ac4006c766b57527ac4616c766b53c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b0112527ac4006c766b0113527ac462e9006c766b0112c36c766b0113c3c36c766b0114527ac4616c766b0114c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b0115527ac46c766b0115c3640f00006c766b0111527ac462d0056c766b0114c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b0116527ac46c766b0116c3642c006c766b57c36c766b0114c36168134e656f2e4f75747075742e47657456616c7565936c766b57527ac4616c766b0113c351936c766b0113527ac46c766b0113c36c766b0112c3c09f630cff006c766b58527ac4616c766b55c36c766b0117527ac4006c766b0118527ac4628b006c766b0117c36c766b0118c3c36c766b0119527ac4616c766b0119c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b011a527ac46c766b011ac3642c006c766b58c36c766b0119c36168134e656f2e4f75747075742e47657456616c7565936c766b58527ac4616c766b0118c351936c766b0118527ac46c766b0118c36c766b0117c3c09f636aff6c766b58c36c766b57c39c6c766b0111527ac4627c046168164e656f2e52756e74696d652e47657454726967676572609c6c766b011b527ac46c766b011bc3649e026161682b53797374656d2e457865637574696f6e456e67696e652e47657443616c6c696e67536372697074486173686c766b011c527ac46c766b00c30962616c616e63654f66876c766b011d527ac46c766b011dc36419006c766b51c300c36165f7036c766b0111527ac462e2036c766b00c308646563696d616c73876c766b011e527ac46c766b011ec3641200616570046c766b0111527ac462b3036c766b00c30f676574526566756e64546172676574876c766b011f527ac46c766b011fc36419006c766b51c300c361653b046c766b0111527ac46276036c766b00c3096765745478496e666f876c766b0120527ac46c766b0120c36419006c766b51c300c36165b1046c766b0111527ac4623f036c766b00c30a6d696e74546f6b656e73876c766b0121527ac46c766b0121c36412006165e6056c766b0111527ac4620e036c766b00c3046e616d65876c766b0122527ac46c766b0122c36412006165200a6c766b0111527ac462e3026c766b00c306726566756e64876c766b0123527ac46c766b0123c36419006c766b51c300c36165fc096c766b0111527ac462af026c766b00c30673796d626f6c876c766b0124527ac46c766b0124c36412006165f70e6c766b0111527ac46282026c766b00c312737570706f727465645374616e6461726473876c766b0125527ac46c766b0125c36412006165ca0e6c766b0111527ac46249026c766b00c30b746f74616c537570706c79876c766b0126527ac46c766b0126c36412006165bc0e6c766b0111527ac46217026c766b00c3087472616e73666572876c766b0127527ac46c766b0127c36441006c766b51c300c36c766b51c351c36c766b51c352c36c766b011cc361537951795572755172755279527954727552727565d60e6c766b0111527ac462b9016162a9016168164e656f2e52756e74696d652e47657454726967676572519c6c766b0128527ac46c766b0128c3647d016161682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b0129527ac461682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b012a527ac4616c766b012ac361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b012b527ac4006c766b012c527ac462bb006c766b012bc36c766b012cc3c36c766b012d527ac4616c766b012dc36168184e656f2e4f75747075742e476574536372697074486173686c766b0129c3907c907c9e6347006c766b012dc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e620400006c766b012e527ac46c766b012ec3640f00006c766b0111527ac4623d00616c766b012cc351936c766b012c527ac46c766b012cc36c766b012bc3c09f633aff516c766b0111527ac4620f00006c766b0111527ac46203006c766b0111c3616c756654c56b6c766b00527ac4616c766b00c3c001149c009c6c766b52527ac46c766b52c36439003254686520706172616d65746572206163636f756e742053484f554c442062652032302d62797465206164647265737365732e6175f06168164e656f2e53746f726167652e476574436f6e74657874056173736574617c652f0f6c766b51527ac46c766b51c36c766b00c3617c65530f6c766b53527ac46203006c766b53c3616c756600c56b58616c756654c56b6c766b00527ac4616c766b00c3c001209c009c6c766b52527ac46c766b52c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c657a0e6c766b51527ac46c766b51c36c766b00c3617c659e0e6c766b53527ac46203006c766b53c3616c756656c56b6c766b00527ac4616c766b00c3c001209c009c6c766b53527ac46c766b53c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c65cd0d6c766b51527ac46c766b51c36c766b00c3617c65f10d6c766b52527ac46c766b52c3c0009c6c766b54527ac46c766b54c3640e00006c766b55527ac4622c006c766b52c36168174e656f2e52756e74696d652e446573657269616c697a656c766b55527ac46203006c766b55c3616c756653c56b6c766b00527ac4616c766b00c361681a4e656f2e426c6f636b636861696e2e476574436f6e74726163746c766b51527ac46c766b51c36424006c766b51c36168164e656f2e436f6e74726163742e497350617961626c65620400516c766b52527ac46203006c766b52c3616c75660114c56b6161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b00527ac4006c766b51527ac46c766b00c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b52527ac4616c766b52c36c766b59527ac4006c766b5a527ac46210016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c6c766b5c527ac46c766b5cc36434006c766b51c376632400756c766b5bc36168184e656f2e4f75747075742e476574536372697074486173686c766b51527ac46c766b5bc36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689c6c766b5d527ac46c766b5dc3640e00006c766b5e527ac462dd02616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63e7fe6c766b00c36168174e656f2e5472616e73616374696f6e2e476574486173686165dafc00a06c766b5f527ac46c766b5fc3640e00006c766b5e527ac46280026c766b00c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b53527ac4006c766b54527ac4616c766b53c36c766b60527ac4006c766b0111527ac46203016c766b60c36c766b0111c3c36c766b0112527ac4616c766b0112c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e6753637269707448617368907c907c9e6347006c766b0112c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c620400006c766b0113527ac46c766b0113c3642e00616c766b54c36c766b0112c36168134e656f2e4f75747075742e47657456616c7565936c766b54527ac461616c766b0111c351936c766b0111527ac46c766b0111c36c766b60c3c09f63f3fe6168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c658b096c766b55527ac46c766b55c30b746f74616c537570706c79617c65030a6c766b56527ac46c766b56c36c766b54c3936c766b56527ac46c766b55c30b746f74616c537570706c796c766b56c361527265290a616168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6514096c766b57527ac46c766b57c36c766b51c3617c6538096c766b58527ac46c766b57c36c766b51c36c766b58c36c766b54c39361527265260a61006c766b51c36c766b54c36152726596046161006c766b51c36c766b54c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5e527ac46203006c766b5ec3616c756600c56b084e45503520474153616c75660111c56b6c766b00527ac4616c766b00c3c001149c009c6c766b59527ac46c766b59c36436002f54686520706172616d657465722066726f6d2053484f554c442062652032302d62797465206164647265737365732e6175f061682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b51527ac46c766b51c361681a4e656f2e5472616e73616374696f6e2e4765744f75747075747300c36c766b52527ac46c766b52c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b5a527ac46c766b5ac3640e00006c766b5b527ac46228036c766b52c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689e6c766b5c527ac46c766b5cc3640e00006c766b5b527ac462bd026168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c65d5066c766b53527ac46c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e47657448617368617c65df06c000a06c766b5d527ac46c766b5dc3640e00006c766b5b527ac4624b026c766b00c36168184e656f2e52756e74696d652e436865636b5769746e657373009c6c766b5e527ac46c766b5ec3640e00006c766b5b527ac4620f026168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6528066c766b54527ac46c766b54c36c766b00c3617c654c066c766b55527ac46c766b52c36168134e656f2e4f75747075742e47657456616c75656c766b56527ac46c766b55c36c766b56c39f6c766b5f527ac46c766b5fc3640e00006c766b5b527ac46287016c766b55c36c766b56c39c6c766b60527ac46c766b60c36416006c766b54c36c766b00c3617c653f0761621f006c766b54c36c766b00c36c766b55c36c766b56c39461527265c606616c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3615272654007616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c6524056c766b57527ac46c766b57c30b746f74616c537570706c79617c659c056c766b58527ac46c766b58c36c766b56c3946c766b58527ac46c766b57c30b746f74616c537570706c796c766b58c361527265c205616c766b00c3006c766b56c3615272658c0061616c766b00c3006c766b56c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961616c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3617c06726566756e6453c168124e656f2e52756e74696d652e4e6f7469667961516c766b5b527ac46203006c766b5bc3616c756656c56b6c766b00527ac46c766b51527ac46c766b52527ac46161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726168174e656f2e5472616e73616374696f6e2e476574486173686c766b53527ac46153c5766c766b00c3007cc4766c766b51c3517cc4766c766b52c3527cc46c766b54527ac46168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c6587036c766b55527ac46c766b55c36c766b53c36c766b54c36168154e656f2e52756e74696d652e53657269616c697a6561527265470561616c756600c56b0443474153616c756600c56b1c7b224e45502d35222c20224e45502d37222c20224e45502d3130227d616c756652c56b616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c65f3026c766b00527ac46c766b00c30b746f74616c537570706c79617c656b036c766b51527ac46203006c766b51c3616c756653c56b6c766b00527ac46c766b51527ac46c766b52527ac451616c75665fc56b6c766b00527ac46c766b51527ac46c766b52527ac46c766b53527ac4616c766b00c3c00114907c907c9e6311006c766b51c3c001149c009c620400516c766b57527ac46c766b57c3643e003754686520706172616d65746572732066726f6d20616e6420746f2053484f554c442062652032302d62797465206164647265737365732e6175f06c766b52c300a16c766b58527ac46c766b58c36433002c54686520706172616d6574657220616d6f756e74204d5553542062652067726561746572207468616e20302e6175f06c766b51c3616575f4009c6c766b59527ac46c766b59c3640e00006c766b5a527ac462a9016c766b00c36168184e656f2e52756e74696d652e436865636b5769746e6573736311006c766b00c36c766b53c39e620400006c766b5b527ac46c766b5bc3640e00006c766b5a527ac4625d016168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6542016c766b54527ac46c766b54c36c766b00c3617c6566016c766b55527ac46c766b55c36c766b52c39f6c766b5c527ac46c766b5cc3640e00006c766b5a527ac462f7006c766b00c36c766b51c39c6c766b5d527ac46c766b5dc3640e00516c766b5a527ac462d2006c766b55c36c766b52c39c6c766b5e527ac46c766b5ec36416006c766b54c36c766b00c3617c65560261621f006c766b54c36c766b00c36c766b55c36c766b52c39461527265dd01616c766b54c36c766b51c3617c65bd006c766b56527ac46c766b54c36c766b51c36c766b56c36c766b52c39361527265ab01616c766b00c36c766b51c36c766b52c36152726517fc61616c766b00c36c766b51c36c766b52c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5a527ac46203006c766b5ac3616c756653c56b6c766b00527ac46c766b51527ac4616152c5766c766b00c3007cc4766c766b51c3517cc46c766b52527ac46203006c766b52c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756653c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c68124e656f2e53746f726167652e44656c65746561616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c7566"
            }
        ],
        "blockhash": "0x41590a481d67f2f52c2aaa6ca4942c17b1afc36e30cf417e7980011cd75ce905",
        "confirmations": 1,
        "blocktime": 1536907793
    }
}

refund 2nd step application log:

refund 2nd step is a ContractTransaction, so no application log.

合约说明:

CGAS 是由 NGD(NEO Global Development)发布的符合 NEP-5 规范的合约资产,CGAS 可由 GAS 一比一地对换,并且支持退回操作。该合约的目的是将 GAS 进行全局资产的合约映射,使全局资产 GAS 可以方便地在合约内部流转,支持由合约调用转账。

技术介绍:

NEP-5 规范中的方法:

方法 参数 返回值 描述
balanceOf byte[] account int 获得某个账户 CGAS 的余额,返回结果为真实值 × 10⁸
decimals --- int 获得 CGAS 精度,返回值为常量 8
name --- string 获得合约名称,返回值为常量 NEP5 GAS
symbol --- string 获得合约符号,返回值为常量 CGAS
totalSupply --- int 获得 CGAS 总发行量,返回结果为真实值 × 10⁸。因为 CGAS 与 GAS 为一比一兑换,所以合约地址中 GAS 的数量等于 CGAS 的总发行量
transfer byte[] from, byte[] to, int amount bool 转账方法,将 CGAS 从发送者(from)账户,转到接收者(to)账户,转账金额为 amount;from 与 to 为 Script Hash,amount 为实际转账金额 × 10⁸。该方法同时支持用户调用和合约调用。

该合约为了支持 GAS 与 CGAS 互换,除了满足 NEP-5 规范中的方法其它方法:

方法 参数 返回值 描述
getRefundTarget byte[] txId byte[] 获得某个 UTXO 是谁待退回的,参数为 UTXO 中的交易 ID(确定一个 UTXO 由 txId 和 output 索引共同完成,这里 output 索引默认为 0),返回值为这个 UTXO 的退回者,他可以将这个 UTXO 作为交易输入,将 GAS 从 CGAS 地址中取走。
getTxInfo byte[] txId TransferInfo 获得某个交易 ID 的详细转账信息,在以下 4 种情况中可记录 TxInfo:mintTokens, Refund, transfer, transferAPP。
mintTokens --- bool CGAS 的铸币方法。用户通过发起 InvocationTransaction,将 GAS 转给 CGAS 合约地址,并且调用 mintTokens 完成 GAS 到 CGAS 的转换工作。合约调用成功后,用户资产中将会增加与兑换的 GAS 数额相等的 CGAS。注意事项
refund byte[] from bool 用户将 CGAS 提取,变成 GAS 总共分两步。第一步,发起一笔 InvocationTransaction 其中包含一笔从 CGAS 地址到 CGAS 地址的 GAS 转账(转账金额为用户想退回的 GAS 的数量),并调用 refund 方法(参数为退回者的 Script Hash)。合约调用成功后,将自动销毁与退回数量相等的 CGAS,并把该交易的第 0 号 output 标记为所属于该用户。第二步,用户构造一个交易将第一步标记过的 UTXO 作为交易输入,交易输出为用户自己的地址,从而将 GAS 从 CGAS 地址中取走。
supportedStandards --- string NEP-10 规范,返回合约所支持的 NEP 标准,返回值为常量:"{"NEP-5", "NEP-7", "NEP-10"}"

NEP-5 规范中的通知:

通知 参数 描述
transfer byte[] from, byte[] to, int value 通知中包含转账的 3 个要素,发送者 (from),接收者 (to) ,转账金额 (value), 转账资产默认为 CGAS

该合约实现的其它通知:

通知 参数 描述
refund byte[] txid, byte[] who 通知中包含转账的 2 个要素,待退回的 UTXO(txid),退回者的 Script Hash(who)

[注意]

在 mintTokens 的时候请注意,InvocationTransaction 的 Inputs 和 Output 加起来不应该超过60个,否则在执行时所需的手续费会超过 10 GAS 的免费额度。如果有大量 GAS 的 UTXO 需要换成 CGAS,建议先进行一个普通转账,将 UTXO 合并,然后再进行 mintTokens 操作。

示例

以下是 mintTokensrefund 的交易结构以及 Application Log,供开发者参考。

mintTokens 交易结构:

[说明]

Type: InvocationTransaction

Input: 来自用户的地址

Output: CGAS 合约地址

Script: 调用 CGAS 合约的 mintTokens 方法

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x48bd784d0ed6000cba64d0e303117e4c10081e3268afcf3b07e8b353a7594772",
        "size": 246,
        "type": "InvocationTransaction",
        "version": 1,
        "attributes": [],
        "vin": [
            {
                "txid": "0x5918258bb67ee292358f8780d6b86e8fcd825bdde623429e4e547a2f9e496cf8",
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "10",
                "address": "AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM"
            }
        ],
        "sys_fee": "0",
        "net_fee": "0",
        "scripts": [
            {
                "invocation": "408e13fc267d69ca1c8463ac8bc3f266343ee0661ef85e9fa66fe986dc787f14fc6c13279bc90883297e186ca65d918ccdcf407497c0de1de9573e9a519a4f9aa5",
                "verification": "21037ebe29fff57d8c177870e9d9eecb046b27fc290ccbac88a0e3da8bac5daa630dac"
            }
        ],
        "script": "000a6d696e74546f6b656e736776db3192722022eb7841038246dc8fa636dcf274f16658600e9b9af88bcb",
        "gas": "0",
        "blockhash": "0xafb5b19021e1b57e7d64deb9d99bedabb0e40fdc3393d6c58c324730c0061aae",
        "confirmations": 2,
        "blocktime": 1536906512
    }
}

mintTokens application log:

{
	"txid": "0x48bd784d0ed6000cba64d0e303117e4c10081e3268afcf3b07e8b353a7594772",
	"vmstate": "HALT, BREAK",
	"gas_consumed": "4.648",
	"stack": [],
	"notifications": [{
		"contract": "0x74f2dc36a68fdc4682034178eb2220729231db76",
		"state": {
			"type": "Array",
			"value": [{
				"type": "ByteArray",
				"value": "7472616e73666572"
			}, {
				"type": "ByteArray",
				"value": ""
			}, {
				"type": "ByteArray",
				"value": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
			}, {
				"type": "Integer",
				"value": "1000000000"
			}]
		}
	}]
}

refund 第一步时的交易结构:

[说明]

Type: InvocationTransaction

Input: 来自 CGAS 合约地址

Output: 转到 CGAS 合约地址 (与 input 相同)

Script: 调用 refund 方法,设置参数为退回者的 Script Hash

Scripts: 需要两个 witness: 1、CGAS 合约的 witness; 2、用户的 witness(附加见证人)

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x306daa4ab2b2ef73ff4fd8f9121fc926f5e21653080602b6841ad3f17f80777c",
        "size": 7205,
        "type": "InvocationTransaction",
        "version": 0,
        "attributes": [
            {
                "usage": "Script",
                "data": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
            }
        ],
        "vin": [
            {
                "txid": "0x48bd784d0ed6000cba64d0e303117e4c10081e3268afcf3b07e8b353a7594772",
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "5",
                "address": "AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM"
            },
            {
                "n": 1,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "5",
                "address": "AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM"
            }
        ],
        "sys_fee": "0",
        "net_fee": "0",
        "scripts": [
            {
                "invocation": "520131",
                "verification": "012fc56b6c766b00527ac46c766b51527ac4616168164e656f2e52756e74696d652e47657454726967676572009c6c766b52527ac46c766b52c36418046161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b53527ac46c766b53c36168194e656f2e5472616e73616374696f6e2e476574496e707574736c766b54527ac46c766b53c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b55527ac4616c766b54c36c766b59527ac4006c766b5a527ac4622b016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168124e656f2e496e7075742e476574496e646578009c6c766b5c527ac46c766b5cc364de00616168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c6545176c766b5d527ac46c766b5dc36c766b5bc36168114e656f2e496e7075742e47657448617368617c6555176c766b5e527ac46c766b5ec3c000a06c766b5f527ac46c766b5fc3646f00616c766b54c3c051907c907c9e6310006c766b55c3c0519c009c620400516c766b60527ac46c766b60c3640f00006c766b0111527ac4620f076c766b55c300c36168184e656f2e4f75747075742e476574536372697074486173686c766b5ec39c6c766b0111527ac462dc0661616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63ccfe61682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b56527ac4006c766b57527ac4616c766b53c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b0112527ac4006c766b0113527ac462e9006c766b0112c36c766b0113c3c36c766b0114527ac4616c766b0114c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b0115527ac46c766b0115c3640f00006c766b0111527ac462d0056c766b0114c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b0116527ac46c766b0116c3642c006c766b57c36c766b0114c36168134e656f2e4f75747075742e47657456616c7565936c766b57527ac4616c766b0113c351936c766b0113527ac46c766b0113c36c766b0112c3c09f630cff006c766b58527ac4616c766b55c36c766b0117527ac4006c766b0118527ac4628b006c766b0117c36c766b0118c3c36c766b0119527ac4616c766b0119c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b011a527ac46c766b011ac3642c006c766b58c36c766b0119c36168134e656f2e4f75747075742e47657456616c7565936c766b58527ac4616c766b0118c351936c766b0118527ac46c766b0118c36c766b0117c3c09f636aff6c766b58c36c766b57c39c6c766b0111527ac4627c046168164e656f2e52756e74696d652e47657454726967676572609c6c766b011b527ac46c766b011bc3649e026161682b53797374656d2e457865637574696f6e456e67696e652e47657443616c6c696e67536372697074486173686c766b011c527ac46c766b00c30962616c616e63654f66876c766b011d527ac46c766b011dc36419006c766b51c300c36165f7036c766b0111527ac462e2036c766b00c308646563696d616c73876c766b011e527ac46c766b011ec3641200616570046c766b0111527ac462b3036c766b00c30f676574526566756e64546172676574876c766b011f527ac46c766b011fc36419006c766b51c300c361653b046c766b0111527ac46276036c766b00c3096765745478496e666f876c766b0120527ac46c766b0120c36419006c766b51c300c36165b1046c766b0111527ac4623f036c766b00c30a6d696e74546f6b656e73876c766b0121527ac46c766b0121c36412006165e6056c766b0111527ac4620e036c766b00c3046e616d65876c766b0122527ac46c766b0122c36412006165200a6c766b0111527ac462e3026c766b00c306726566756e64876c766b0123527ac46c766b0123c36419006c766b51c300c36165fc096c766b0111527ac462af026c766b00c30673796d626f6c876c766b0124527ac46c766b0124c36412006165f70e6c766b0111527ac46282026c766b00c312737570706f727465645374616e6461726473876c766b0125527ac46c766b0125c36412006165ca0e6c766b0111527ac46249026c766b00c30b746f74616c537570706c79876c766b0126527ac46c766b0126c36412006165bc0e6c766b0111527ac46217026c766b00c3087472616e73666572876c766b0127527ac46c766b0127c36441006c766b51c300c36c766b51c351c36c766b51c352c36c766b011cc361537951795572755172755279527954727552727565d60e6c766b0111527ac462b9016162a9016168164e656f2e52756e74696d652e47657454726967676572519c6c766b0128527ac46c766b0128c3647d016161682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b0129527ac461682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b012a527ac4616c766b012ac361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b012b527ac4006c766b012c527ac462bb006c766b012bc36c766b012cc3c36c766b012d527ac4616c766b012dc36168184e656f2e4f75747075742e476574536372697074486173686c766b0129c3907c907c9e6347006c766b012dc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e620400006c766b012e527ac46c766b012ec3640f00006c766b0111527ac4623d00616c766b012cc351936c766b012c527ac46c766b012cc36c766b012bc3c09f633aff516c766b0111527ac4620f00006c766b0111527ac46203006c766b0111c3616c756654c56b6c766b00527ac4616c766b00c3c001149c009c6c766b52527ac46c766b52c36439003254686520706172616d65746572206163636f756e742053484f554c442062652032302d62797465206164647265737365732e6175f06168164e656f2e53746f726167652e476574436f6e74657874056173736574617c652f0f6c766b51527ac46c766b51c36c766b00c3617c65530f6c766b53527ac46203006c766b53c3616c756600c56b58616c756654c56b6c766b00527ac4616c766b00c3c001209c009c6c766b52527ac46c766b52c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c657a0e6c766b51527ac46c766b51c36c766b00c3617c659e0e6c766b53527ac46203006c766b53c3616c756656c56b6c766b00527ac4616c766b00c3c001209c009c6c766b53527ac46c766b53c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c65cd0d6c766b51527ac46c766b51c36c766b00c3617c65f10d6c766b52527ac46c766b52c3c0009c6c766b54527ac46c766b54c3640e00006c766b55527ac4622c006c766b52c36168174e656f2e52756e74696d652e446573657269616c697a656c766b55527ac46203006c766b55c3616c756653c56b6c766b00527ac4616c766b00c361681a4e656f2e426c6f636b636861696e2e476574436f6e74726163746c766b51527ac46c766b51c36424006c766b51c36168164e656f2e436f6e74726163742e497350617961626c65620400516c766b52527ac46203006c766b52c3616c75660114c56b6161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b00527ac4006c766b51527ac46c766b00c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b52527ac4616c766b52c36c766b59527ac4006c766b5a527ac46210016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c6c766b5c527ac46c766b5cc36434006c766b51c376632400756c766b5bc36168184e656f2e4f75747075742e476574536372697074486173686c766b51527ac46c766b5bc36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689c6c766b5d527ac46c766b5dc3640e00006c766b5e527ac462dd02616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63e7fe6c766b00c36168174e656f2e5472616e73616374696f6e2e476574486173686165dafc00a06c766b5f527ac46c766b5fc3640e00006c766b5e527ac46280026c766b00c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b53527ac4006c766b54527ac4616c766b53c36c766b60527ac4006c766b0111527ac46203016c766b60c36c766b0111c3c36c766b0112527ac4616c766b0112c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e6753637269707448617368907c907c9e6347006c766b0112c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c620400006c766b0113527ac46c766b0113c3642e00616c766b54c36c766b0112c36168134e656f2e4f75747075742e47657456616c7565936c766b54527ac461616c766b0111c351936c766b0111527ac46c766b0111c36c766b60c3c09f63f3fe6168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c658b096c766b55527ac46c766b55c30b746f74616c537570706c79617c65030a6c766b56527ac46c766b56c36c766b54c3936c766b56527ac46c766b55c30b746f74616c537570706c796c766b56c361527265290a616168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6514096c766b57527ac46c766b57c36c766b51c3617c6538096c766b58527ac46c766b57c36c766b51c36c766b58c36c766b54c39361527265260a61006c766b51c36c766b54c36152726596046161006c766b51c36c766b54c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5e527ac46203006c766b5ec3616c756600c56b084e45503520474153616c75660111c56b6c766b00527ac4616c766b00c3c001149c009c6c766b59527ac46c766b59c36436002f54686520706172616d657465722066726f6d2053484f554c442062652032302d62797465206164647265737365732e6175f061682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b51527ac46c766b51c361681a4e656f2e5472616e73616374696f6e2e4765744f75747075747300c36c766b52527ac46c766b52c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b5a527ac46c766b5ac3640e00006c766b5b527ac46228036c766b52c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689e6c766b5c527ac46c766b5cc3640e00006c766b5b527ac462bd026168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c65d5066c766b53527ac46c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e47657448617368617c65df06c000a06c766b5d527ac46c766b5dc3640e00006c766b5b527ac4624b026c766b00c36168184e656f2e52756e74696d652e436865636b5769746e657373009c6c766b5e527ac46c766b5ec3640e00006c766b5b527ac4620f026168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6528066c766b54527ac46c766b54c36c766b00c3617c654c066c766b55527ac46c766b52c36168134e656f2e4f75747075742e47657456616c75656c766b56527ac46c766b55c36c766b56c39f6c766b5f527ac46c766b5fc3640e00006c766b5b527ac46287016c766b55c36c766b56c39c6c766b60527ac46c766b60c36416006c766b54c36c766b00c3617c653f0761621f006c766b54c36c766b00c36c766b55c36c766b56c39461527265c606616c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3615272654007616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c6524056c766b57527ac46c766b57c30b746f74616c537570706c79617c659c056c766b58527ac46c766b58c36c766b56c3946c766b58527ac46c766b57c30b746f74616c537570706c796c766b58c361527265c205616c766b00c3006c766b56c3615272658c0061616c766b00c3006c766b56c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961616c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3617c06726566756e6453c168124e656f2e52756e74696d652e4e6f7469667961516c766b5b527ac46203006c766b5bc3616c756656c56b6c766b00527ac46c766b51527ac46c766b52527ac46161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726168174e656f2e5472616e73616374696f6e2e476574486173686c766b53527ac46153c5766c766b00c3007cc4766c766b51c3517cc4766c766b52c3527cc46c766b54527ac46168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c6587036c766b55527ac46c766b55c36c766b53c36c766b54c36168154e656f2e52756e74696d652e53657269616c697a6561527265470561616c756600c56b0443474153616c756600c56b1c7b224e45502d35222c20224e45502d37222c20224e45502d3130227d616c756652c56b616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c65f3026c766b00527ac46c766b00c30b746f74616c537570706c79617c656b036c766b51527ac46203006c766b51c3616c756653c56b6c766b00527ac46c766b51527ac46c766b52527ac451616c75665fc56b6c766b00527ac46c766b51527ac46c766b52527ac46c766b53527ac4616c766b00c3c00114907c907c9e6311006c766b51c3c001149c009c620400516c766b57527ac46c766b57c3643e003754686520706172616d65746572732066726f6d20616e6420746f2053484f554c442062652032302d62797465206164647265737365732e6175f06c766b52c300a16c766b58527ac46c766b58c36433002c54686520706172616d6574657220616d6f756e74204d5553542062652067726561746572207468616e20302e6175f06c766b51c3616575f4009c6c766b59527ac46c766b59c3640e00006c766b5a527ac462a9016c766b00c36168184e656f2e52756e74696d652e436865636b5769746e6573736311006c766b00c36c766b53c39e620400006c766b5b527ac46c766b5bc3640e00006c766b5a527ac4625d016168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6542016c766b54527ac46c766b54c36c766b00c3617c6566016c766b55527ac46c766b55c36c766b52c39f6c766b5c527ac46c766b5cc3640e00006c766b5a527ac462f7006c766b00c36c766b51c39c6c766b5d527ac46c766b5dc3640e00516c766b5a527ac462d2006c766b55c36c766b52c39c6c766b5e527ac46c766b5ec36416006c766b54c36c766b00c3617c65560261621f006c766b54c36c766b00c36c766b55c36c766b52c39461527265dd01616c766b54c36c766b51c3617c65bd006c766b56527ac46c766b54c36c766b51c36c766b56c36c766b52c39361527265ab01616c766b00c36c766b51c36c766b52c36152726517fc61616c766b00c36c766b51c36c766b52c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5a527ac46203006c766b5ac3616c756653c56b6c766b00527ac46c766b51527ac4616152c5766c766b00c3007cc4766c766b51c3517cc46c766b52527ac46203006c766b52c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756653c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c68124e656f2e53746f726167652e44656c65746561616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c7566"
            },
            {
                "invocation": "404c53a9ca937470df9dcbbb71cf00e2b4d75761e4667ccfd820e40829887c4444c7911ed509e564b2bac30e41c92c43f7df2dd2a25ea1c8e2bc10aec3d3208251",
                "verification": "21037ebe29fff57d8c177870e9d9eecb046b27fc290ccbac88a0e3da8bac5daa630dac"
            }
        ],
        "script": "14e8e3ce08268d16d867101feaf8c0ea130a923aba51c106726566756e646776db3192722022eb7841038246dc8fa636dcf274f1",
        "gas": "0",
        "blockhash": "0xd04d56259a6c92e290ab009e2062fbd078c3c371036d74dd745b379a4d55a899",
        "confirmations": 14,
        "blocktime": 1536907058
    }
}

refund 第一步的 application log:

{
	"txid": "0x306daa4ab2b2ef73ff4fd8f9121fc926f5e21653080602b6841ad3f17f80777c",
	"vmstate": "HALT, BREAK",
	"gas_consumed": "5.582",
	"stack": [],
	"notifications": [{
		"contract": "0x74f2dc36a68fdc4682034178eb2220729231db76",
		"state": {
			"type": "Array",
			"value": [{
				"type": "ByteArray",
				"value": "7472616e73666572"
			}, {
				"type": "ByteArray",
				"value": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
			}, {
				"type": "ByteArray",
				"value": ""
			}, {
				"type": "Integer",
				"value": "500000000"
			}]
		}
	}, {
		"contract": "0x74f2dc36a68fdc4682034178eb2220729231db76",
		"state": {
			"type": "Array",
			"value": [{
				"type": "ByteArray",
				"value": "726566756e64"
			}, {
				"type": "ByteArray",
				"value": "7c77807ff1d31a84b60206085316e2f526c91f12f9d84fff73efb2b24aaa6d30"
			}, {
				"type": "ByteArray",
				"value": "e8e3ce08268d16d867101feaf8c0ea130a923aba"
			}]
		}
	}]
}

refund 第二步的交易结构:

[说明]

Type: ContractTransaction

Input: 来自 CGAS 合约地址

Output: 转到用户自己的地址

Scripts: CGAS 合约的 witness

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "txid": "0x595b1dce00e6a7c72e2650573b8b82831128428bd445830f226c1390bca8b45d",
        "size": 6969,
        "type": "ContractTransaction",
        "version": 0,
        "attributes": [],
        "vin": [
            {
                "txid": "0x306daa4ab2b2ef73ff4fd8f9121fc926f5e21653080602b6841ad3f17f80777c",
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "asset": "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "value": "5",
                "address": "Ad1HKAATNmFT5buNgSxspbW68f4XVSssSw"
            }
        ],
        "sys_fee": "0",
        "net_fee": "0",
        "scripts": [
            {
                "invocation": "520131",
                "verification": "012fc56b6c766b00527ac46c766b51527ac4616168164e656f2e52756e74696d652e47657454726967676572009c6c766b52527ac46c766b52c36418046161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b53527ac46c766b53c36168194e656f2e5472616e73616374696f6e2e476574496e707574736c766b54527ac46c766b53c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b55527ac4616c766b54c36c766b59527ac4006c766b5a527ac4622b016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168124e656f2e496e7075742e476574496e646578009c6c766b5c527ac46c766b5cc364de00616168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c6545176c766b5d527ac46c766b5dc36c766b5bc36168114e656f2e496e7075742e47657448617368617c6555176c766b5e527ac46c766b5ec3c000a06c766b5f527ac46c766b5fc3646f00616c766b54c3c051907c907c9e6310006c766b55c3c0519c009c620400516c766b60527ac46c766b60c3640f00006c766b0111527ac4620f076c766b55c300c36168184e656f2e4f75747075742e476574536372697074486173686c766b5ec39c6c766b0111527ac462dc0661616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63ccfe61682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b56527ac4006c766b57527ac4616c766b53c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b0112527ac4006c766b0113527ac462e9006c766b0112c36c766b0113c3c36c766b0114527ac4616c766b0114c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b0115527ac46c766b0115c3640f00006c766b0111527ac462d0056c766b0114c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b0116527ac46c766b0116c3642c006c766b57c36c766b0114c36168134e656f2e4f75747075742e47657456616c7565936c766b57527ac4616c766b0113c351936c766b0113527ac46c766b0113c36c766b0112c3c09f630cff006c766b58527ac4616c766b55c36c766b0117527ac4006c766b0118527ac4628b006c766b0117c36c766b0118c3c36c766b0119527ac4616c766b0119c36168184e656f2e4f75747075742e476574536372697074486173686c766b56c39c6c766b011a527ac46c766b011ac3642c006c766b58c36c766b0119c36168134e656f2e4f75747075742e47657456616c7565936c766b58527ac4616c766b0118c351936c766b0118527ac46c766b0118c36c766b0117c3c09f636aff6c766b58c36c766b57c39c6c766b0111527ac4627c046168164e656f2e52756e74696d652e47657454726967676572609c6c766b011b527ac46c766b011bc3649e026161682b53797374656d2e457865637574696f6e456e67696e652e47657443616c6c696e67536372697074486173686c766b011c527ac46c766b00c30962616c616e63654f66876c766b011d527ac46c766b011dc36419006c766b51c300c36165f7036c766b0111527ac462e2036c766b00c308646563696d616c73876c766b011e527ac46c766b011ec3641200616570046c766b0111527ac462b3036c766b00c30f676574526566756e64546172676574876c766b011f527ac46c766b011fc36419006c766b51c300c361653b046c766b0111527ac46276036c766b00c3096765745478496e666f876c766b0120527ac46c766b0120c36419006c766b51c300c36165b1046c766b0111527ac4623f036c766b00c30a6d696e74546f6b656e73876c766b0121527ac46c766b0121c36412006165e6056c766b0111527ac4620e036c766b00c3046e616d65876c766b0122527ac46c766b0122c36412006165200a6c766b0111527ac462e3026c766b00c306726566756e64876c766b0123527ac46c766b0123c36419006c766b51c300c36165fc096c766b0111527ac462af026c766b00c30673796d626f6c876c766b0124527ac46c766b0124c36412006165f70e6c766b0111527ac46282026c766b00c312737570706f727465645374616e6461726473876c766b0125527ac46c766b0125c36412006165ca0e6c766b0111527ac46249026c766b00c30b746f74616c537570706c79876c766b0126527ac46c766b0126c36412006165bc0e6c766b0111527ac46217026c766b00c3087472616e73666572876c766b0127527ac46c766b0127c36441006c766b51c300c36c766b51c351c36c766b51c352c36c766b011cc361537951795572755172755279527954727552727565d60e6c766b0111527ac462b9016162a9016168164e656f2e52756e74696d652e47657454726967676572519c6c766b0128527ac46c766b0128c3647d016161682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173686c766b0129527ac461682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b012a527ac4616c766b012ac361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b012b527ac4006c766b012c527ac462bb006c766b012bc36c766b012cc3c36c766b012d527ac4616c766b012dc36168184e656f2e4f75747075742e476574536372697074486173686c766b0129c3907c907c9e6347006c766b012dc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e620400006c766b012e527ac46c766b012ec3640f00006c766b0111527ac4623d00616c766b012cc351936c766b012c527ac46c766b012cc36c766b012bc3c09f633aff516c766b0111527ac4620f00006c766b0111527ac46203006c766b0111c3616c756654c56b6c766b00527ac4616c766b00c3c001149c009c6c766b52527ac46c766b52c36439003254686520706172616d65746572206163636f756e742053484f554c442062652032302d62797465206164647265737365732e6175f06168164e656f2e53746f726167652e476574436f6e74657874056173736574617c652f0f6c766b51527ac46c766b51c36c766b00c3617c65530f6c766b53527ac46203006c766b53c3616c756600c56b58616c756654c56b6c766b00527ac4616c766b00c3c001209c009c6c766b52527ac46c766b52c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c657a0e6c766b51527ac46c766b51c36c766b00c3617c659e0e6c766b53527ac46203006c766b53c3616c756656c56b6c766b00527ac4616c766b00c3c001209c009c6c766b53527ac46c766b53c3643d003654686520706172616d6574657220747849642053484f554c442062652033322d62797465207472616e73616374696f6e20686173682e6175f06168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c65cd0d6c766b51527ac46c766b51c36c766b00c3617c65f10d6c766b52527ac46c766b52c3c0009c6c766b54527ac46c766b54c3640e00006c766b55527ac4622c006c766b52c36168174e656f2e52756e74696d652e446573657269616c697a656c766b55527ac46203006c766b55c3616c756653c56b6c766b00527ac4616c766b00c361681a4e656f2e426c6f636b636861696e2e476574436f6e74726163746c766b51527ac46c766b51c36424006c766b51c36168164e656f2e436f6e74726163742e497350617961626c65620400516c766b52527ac46203006c766b52c3616c75660114c56b6161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b00527ac4006c766b51527ac46c766b00c361681d4e656f2e5472616e73616374696f6e2e4765745265666572656e6365736c766b52527ac4616c766b52c36c766b59527ac4006c766b5a527ac46210016c766b59c36c766b5ac3c36c766b5b527ac4616c766b5bc36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c6c766b5c527ac46c766b5cc36434006c766b51c376632400756c766b5bc36168184e656f2e4f75747075742e476574536372697074486173686c766b51527ac46c766b5bc36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689c6c766b5d527ac46c766b5dc3640e00006c766b5e527ac462dd02616c766b5ac351936c766b5a527ac46c766b5ac36c766b59c3c09f63e7fe6c766b00c36168174e656f2e5472616e73616374696f6e2e476574486173686165dafc00a06c766b5f527ac46c766b5fc3640e00006c766b5e527ac46280026c766b00c361681a4e656f2e5472616e73616374696f6e2e4765744f7574707574736c766b53527ac4006c766b54527ac4616c766b53c36c766b60527ac4006c766b0111527ac46203016c766b60c36c766b0111c3c36c766b0112527ac4616c766b0112c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e6753637269707448617368907c907c9e6347006c766b0112c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609c620400006c766b0113527ac46c766b0113c3642e00616c766b54c36c766b0112c36168134e656f2e4f75747075742e47657456616c7565936c766b54527ac461616c766b0111c351936c766b0111527ac46c766b0111c36c766b60c3c09f63f3fe6168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c658b096c766b55527ac46c766b55c30b746f74616c537570706c79617c65030a6c766b56527ac46c766b56c36c766b54c3936c766b56527ac46c766b55c30b746f74616c537570706c796c766b56c361527265290a616168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6514096c766b57527ac46c766b57c36c766b51c3617c6538096c766b58527ac46c766b57c36c766b51c36c766b58c36c766b54c39361527265260a61006c766b51c36c766b54c36152726596046161006c766b51c36c766b54c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5e527ac46203006c766b5ec3616c756600c56b084e45503520474153616c75660111c56b6c766b00527ac4616c766b00c3c001149c009c6c766b59527ac46c766b59c36436002f54686520706172616d657465722066726f6d2053484f554c442062652032302d62797465206164647265737365732e6175f061682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726c766b51527ac46c766b51c361681a4e656f2e5472616e73616374696f6e2e4765744f75747075747300c36c766b52527ac46c766b52c36168154e656f2e4f75747075742e476574417373657449646120e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c609e6c766b5a527ac46c766b5ac3640e00006c766b5b527ac46228036c766b52c36168184e656f2e4f75747075742e4765745363726970744861736861682d53797374656d2e457865637574696f6e456e67696e652e476574457865637574696e67536372697074486173689e6c766b5c527ac46c766b5cc3640e00006c766b5b527ac462bd026168164e656f2e53746f726167652e476574436f6e7465787406726566756e64617c65d5066c766b53527ac46c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e47657448617368617c65df06c000a06c766b5d527ac46c766b5dc3640e00006c766b5b527ac4624b026c766b00c36168184e656f2e52756e74696d652e436865636b5769746e657373009c6c766b5e527ac46c766b5ec3640e00006c766b5b527ac4620f026168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6528066c766b54527ac46c766b54c36c766b00c3617c654c066c766b55527ac46c766b52c36168134e656f2e4f75747075742e47657456616c75656c766b56527ac46c766b55c36c766b56c39f6c766b5f527ac46c766b5fc3640e00006c766b5b527ac46287016c766b55c36c766b56c39c6c766b60527ac46c766b60c36416006c766b54c36c766b00c3617c653f0761621f006c766b54c36c766b00c36c766b55c36c766b56c39461527265c606616c766b53c36c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3615272654007616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c6524056c766b57527ac46c766b57c30b746f74616c537570706c79617c659c056c766b58527ac46c766b58c36c766b56c3946c766b58527ac46c766b57c30b746f74616c537570706c796c766b58c361527265c205616c766b00c3006c766b56c3615272658c0061616c766b00c3006c766b56c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961616c766b51c36168174e656f2e5472616e73616374696f6e2e476574486173686c766b00c3617c06726566756e6453c168124e656f2e52756e74696d652e4e6f7469667961516c766b5b527ac46203006c766b5bc3616c756656c56b6c766b00527ac46c766b51527ac46c766b52527ac46161682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726168174e656f2e5472616e73616374696f6e2e476574486173686c766b53527ac46153c5766c766b00c3007cc4766c766b51c3517cc4766c766b52c3527cc46c766b54527ac46168164e656f2e53746f726167652e476574436f6e74657874067478496e666f617c6587036c766b55527ac46c766b55c36c766b53c36c766b54c36168154e656f2e52756e74696d652e53657269616c697a6561527265470561616c756600c56b0443474153616c756600c56b1c7b224e45502d35222c20224e45502d37222c20224e45502d3130227d616c756652c56b616168164e656f2e53746f726167652e476574436f6e7465787408636f6e7472616374617c65f3026c766b00527ac46c766b00c30b746f74616c537570706c79617c656b036c766b51527ac46203006c766b51c3616c756653c56b6c766b00527ac46c766b51527ac46c766b52527ac451616c75665fc56b6c766b00527ac46c766b51527ac46c766b52527ac46c766b53527ac4616c766b00c3c00114907c907c9e6311006c766b51c3c001149c009c620400516c766b57527ac46c766b57c3643e003754686520706172616d65746572732066726f6d20616e6420746f2053484f554c442062652032302d62797465206164647265737365732e6175f06c766b52c300a16c766b58527ac46c766b58c36433002c54686520706172616d6574657220616d6f756e74204d5553542062652067726561746572207468616e20302e6175f06c766b51c3616575f4009c6c766b59527ac46c766b59c3640e00006c766b5a527ac462a9016c766b00c36168184e656f2e52756e74696d652e436865636b5769746e6573736311006c766b00c36c766b53c39e620400006c766b5b527ac46c766b5bc3640e00006c766b5a527ac4625d016168164e656f2e53746f726167652e476574436f6e74657874056173736574617c6542016c766b54527ac46c766b54c36c766b00c3617c6566016c766b55527ac46c766b55c36c766b52c39f6c766b5c527ac46c766b5cc3640e00006c766b5a527ac462f7006c766b00c36c766b51c39c6c766b5d527ac46c766b5dc3640e00516c766b5a527ac462d2006c766b55c36c766b52c39c6c766b5e527ac46c766b5ec36416006c766b54c36c766b00c3617c65560261621f006c766b54c36c766b00c36c766b55c36c766b52c39461527265dd01616c766b54c36c766b51c3617c65bd006c766b56527ac46c766b54c36c766b51c36c766b56c36c766b52c39361527265ab01616c766b00c36c766b51c36c766b52c36152726517fc61616c766b00c36c766b51c36c766b52c3615272087472616e7366657254c168124e656f2e52756e74696d652e4e6f7469667961516c766b5a527ac46203006c766b5ac3616c756653c56b6c766b00527ac46c766b51527ac4616152c5766c766b00c3007cc4766c766b51c3517cc46c766b52527ac46203006c766b52c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c680f4e656f2e53746f726167652e4765746c766b53527ac46203006c766b53c3616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c756653c56b6c766b00527ac46c766b51527ac4616c766b00c351c301007e6c766b51c37e6c766b52527ac46c766b00c300c36c766b52c3617c68124e656f2e53746f726167652e44656c65746561616c756654c56b6c766b00527ac46c766b51527ac46c766b52527ac4616c766b00c351c301007e6c766b51c37e6c766b53527ac46c766b00c300c36c766b53c36c766b52c3615272680f4e656f2e53746f726167652e50757461616c7566"
            }
        ],
        "blockhash": "0x41590a481d67f2f52c2aaa6ca4942c17b1afc36e30cf417e7980011cd75ce905",
        "confirmations": 1,
        "blocktime": 1536907793
    }
}

refund 第二步的 application log:

refund 第二步为普通的合约交易,没有 application log.