vechain / thor-sync

Deprecated - Try New Version
https://env.vechain.org
19 stars 5 forks source link

Deploy Contract #1

Closed erwan973 closed 6 years ago

erwan973 commented 6 years ago

Hi, with Thor-sync, I can transfer an amount of VET to another account. But to deploy contract, when I submit, no nothing happen. How can I deploy contract from this software? Even if with the package "thorify" , I have error. How can I deploy contract with this package. I see this from the github Vechain, but they don't explain very well. I think you have more details. Thanks

XJWX89 commented 6 years ago

Normally it should return the Txid when you submit the transaction . Below are the required parameters for deploy a contract :

  1. Deployer : selecte an account which create in account module
  2. Input the data of contract in hex format
  3. if the contract payable set as true you can transfer the VET to the contract ,otherwise leave it empty
  4. Input the gas for transaction (for now the minimum of gas for deploy a contract is 68000,but it subject to the cost in evm calculation, so I will suggest give a little bit more on it )
  5. Gaspricecoef is set by 128 as default value .Transaction fee explaination

We are working some manual for the sync , it should be release really soon . Moreover, in next version we will add the feature for estimate the gas .

Could you please tell us your OS version ? ?

erwan973 commented 6 years ago

Thank you for your answer, I am on windows 7.

XJWX89 commented 6 years ago

@erwan973 we tried sync on windows 7 , but it seems everything goes well . can you give us more info to figure out the issue ? ex . transaction body , Sync version or anything related

Many thanks

erwan973 commented 6 years ago

When I am on contract deployment: Contract deployer: 0x5f0a41dac8193d813f2ee51586a45ab44fb1a432 Data: 0x6060604052341561000f57600080fd5b60e08061001d6000396000f3006060604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c55699c14604e578063bc64b76d14607c575b600080fd5b3415605857600080fd5b605e60a0565b60405180826000191660001916815260200191505060405180910390f35b3415608657600080fd5b609e60048080356000191690602001909190505060a6565b005b60005481565b8060008160001916905550505600a165627a7a723058201a09e890d0c668b986891e77c4bb7ea8f75e1e8bae8557db58a7ba1afe418c870029

This is the smart contract when I want to deploy: pragma solidity ^0.4.19;

contract Test1 {

bytes32 public x;

function setX(bytes32 _x) public { 
    x = _x; 
}

}

Gas: 108000 I didn't fill the value and expiration field

I have a question, after deploy the smart contract on Thor-sync, can we interact the smart contract with some package like web3 ? Thanks a lot

XJWX89 commented 6 years ago

@erwan973 thanks for the details , I notice that 0.3.1 preview version has a bug when you trying to deploy a contract but this bug has been fixed in 0.6.0 . so i 'm curious which version are you using ... if you still using preview version please download the latest one

erwan973 commented 6 years ago

Yes I download the last version, it works. So now, how can I retrieve the address of the smart contract ?

libotony commented 6 years ago

Use insight enter the txID,you can find contract address in transaction receipt part

erwan973 commented 6 years ago

Hi, when I submit the txID on Insight, I don't see the address of the contract, I just see the gas payer, Paid(VTHO), Tx Reward, but for the outputs there are nothing.

AsbertMa commented 6 years ago

I think the gas not enough, the transaction was reverted. In next version we will add the feature for estimate the gas.

erwan973 commented 6 years ago

Yes thank you @AsbertMa, it works now