vechain / thor

A general purpose blockchain highly compatible with Ethereum's ecosystem
GNU Lesser General Public License v3.0
797 stars 247 forks source link

How to create raw tranasaction for VTHO in golang #83

Closed wupeaking closed 6 years ago

wupeaking commented 6 years ago

I want to use golang to sign raw VTHO transaction , but I do not find some example to show how to crate data for the contarct.

我想离线创建VTHO的原始交易, 但是我没有找到示例去构造调用这个VTHO智能合约转账的方法。 我只看到了java相关的SDK,那么用go怎么做呢?

期待你们的回复。 谢谢!

wupeaking commented 6 years ago

我大致看了一下代码, 发现你们使用了以太坊的虚拟机。是不是可以理解为构造data的过程和以太坊一样。

比如在以太坊智能合约转账中: (向0x1062a747393198f70f71ec65a582423dba7e5ab3转入0x6d4680a9b2ef5a7000/10^18个VEN) Function: transfer(address _to, uint256 _amount) MethodID: 0xa9059cbb

其data为: "0xa9059cbb0000000000000000000000001062a747393198f70f71ec65a582423dba7e5ab300000000000000000000000000000000000000000000006d4680a9b2ef5a7000"

那么在VTHO转账过程中,可以使用这样的data吗?

libotony commented 6 years ago

see github.com/vechain/thor/abi see github.com/vechain/thor/tx

VTHO is an ERC-20 compatible smart contract, the source code is located at link

libotony commented 6 years ago

@wupeaking 是的,调用合约的input data的编码方式跟以太坊是一样的,但是thor的交易模型跟以太坊是不一样的,可以参考wiki来了解

wupeaking commented 6 years ago

@libotony tks! I have sent VTHO successfully .