Closed ikamran closed 1 year ago
I want to know if code below in the section .sign(priv_key) is it sign the transaction locally offline and just broadcast it or not? what is the safe way to send trc20 token>?
`from tronpy import Tron from tronpy.keys import PrivateKey
client = Tron(network='nile')
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))
txn = ( client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000) .memo("test memo") .build() .inspect() .sign(priv_key) .broadcast() )
print(txn)
print(txn.wait())
is it sign the transaction locally offline and just broadcast it or not
.sign() signs locally, in general I think there's no full node API to sign. All done locally via cryptography functions
I want to know if code below in the section .sign(priv_key) is it sign the transaction locally offline and just broadcast it or not? what is the safe way to send trc20 token>?
`from tronpy import Tron from tronpy.keys import PrivateKey
client = Tron(network='nile')
Private key of TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))
txn = ( client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000) .memo("test memo") .build() .inspect() .sign(priv_key) .broadcast() )
print(txn)
> {'result': True, 'txid': '5182b96bc0d74f416d6ba8e22380e5920d8627f8fb5ef5a6a11d4df030459132'}
print(txn.wait())
> {'id': '5182b96bc0d74f416d6ba8e22380e5920d8627f8fb5ef5a6a11d4df030459132', 'blockNumber': 6415370, 'blockTimeStamp': 1591951155000, 'contractResult': [''], 'receipt': {'net_usage': 283}}`