For all Zilliqa protocol and tools related topics. For more information, visit https://zilliqa.com/for-developers.html
params = active_chain.build_transaction_params(my_key, **payload)
should be params = chain.active_chain.build_transaction_params(my_key, **payload)
active_chain.api.CreateTransaction(params)
should be chain.active_chain.api.CreateTransaction(params)
@AmritKumar I ran the script by prepending chain to active chain as said but now I am getting this error
File "zil.py", line 17, in <module>
params = chain.active_chain.build_transaction_params(my_key, **payload)
TypeError: build_transaction_params() missing 1 required positional argument: 'nonce'
The code is exactly same as before just adding the chain before active chain
My message above.
So example:
If your transaction costs 1000 Gas according to the interpreter, and the gas price that you placed was 1,000 Li, then the gas cost to you for the transaction will be
1,000 * 1,000 * 10^-6 = 1 Zil.
That's the mathematical way to go around it. If you want it to be simpler, send a transaction on the devnet. The viewblock will show you the cost breakdown (in both Zils and USD)
Hi, In the python api scripts for zilliqa to create transaction what do I set the chain to in "set _active _chain" if I am running a local network .
from pyzil.crypto import zilkey
from pyzil.zilliqa import chain
chain.set_active_chain(chain.MainNet)
my_key = zilkey.ZilKey(private_key="**")
payload = {
"to_addr": "4baf5fada8e5db92c3d3242618c5b47133ae003c",
"amount": "1000000000000",
"gas_price": "1000000000",
"gas_limit": 1,
"code": "",
"data": "",
"priority": False,
}
params = chain.active_chain.build_transaction_params(my_key, **payload)
txn_info = chain.active_chain.api.CreateTransaction(params)
print(txn_info)
MainNet
here:gas
in Ethereum is gasLimit
*gasPrice