EOS系列 - 使用eosc(golang)發起裸包交易

2020-10-13 11:00:46

run eosc

1. go get -u -v github.com/eoscanada/eosc/eosc
2. cd $GOPATH/src/github.com/eoscanada/eosc/eosc
3. go build main.go
4. cp main $GOPATH/bin/eosc

transaction signature

1. import private key (offline)

eosc vault create --import --comment "Airtight wallet"
  • use eosio default key :
    • private key: 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
    • public key: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
  • use passphrase: 123456
  • Wallet file 「./eosc-vault.json」 written to disk.

2. create transaction (online)

#主網
eosc transfer airtight11111 cancancan123 1.0000 -m "Can't say I haven't paid you now" --write-transaction transaction.json --skip-sign --expiration 3600
#測試網
eosc transfer <your_account> eosio 0.0100 -m "Can't say I haven't paid you now" --write-transaction transaction.json --skip-sign --expiration 3600 -u https://api.jungle.alohaeos.com

3. sign (offline)

#主網
eosc tx sign ./transaction.json --offline-sign-key EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV --offline-chain-id=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906 --write-transaction signedtx.json
#測試網
eosc tx sign ./transaction.json --offline-sign-key EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV --offline-chain-id=e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473 --write-transaction signedtx.json

4. send (online)

#主網
eosc tx push signedtx.json
#測試網
eosc tx push signedtx.json -u https://api.jungle.alohaeos.com