## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
kishankumar258
@kishankumar258
@evesnow91 Yes, but I am using these blockchain related things first time in python.
李大狗
@leeduckgo
Is there any describe about rules of calculate fee in transaction?gas_limit * gas_price == fee?
李大狗
@leeduckgo
There is "for change" in Ethereum, but I haven't saw it in Zilliqa yet.
Edison Lim
@edisonljh
To calculate fees, take the gas cost.
gas cost * gas price = total price (in zils)
Convert the gas cost to actual cost by multiplying that by current zil price.
李大狗
@leeduckgo
thx a lot, but the response of rpc request has only "gas price" and "gas limit" but not "gas cost" field?
@edisonljh
Edison Lim
@edisonljh
It's not there, you have to calculate that yourself.
李大狗
@leeduckgo
how can I calculate it, I just want to know the fee of a transaction pull from chain🤣
Edison Lim
@edisonljh

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)

李大狗
@leeduckgo
I knew it, but I want to get the "Gas" I used by RPC, the response only contain the "gas_limit" filed.
does "gas_limit" == "gas I spent"?
Meai1
@Meai1
which wallet is official? they all look unofficial to me: https://chrome.google.com/webstore/search/zilliqa
evesnow91
@evesnow91
We operate similar to Ethereum. There is no official wallet. I will recommend Moonlet, it’s akin to Metamask.
Meai1
@Meai1
what's the fastest way to develop locally? I tried using kaya rpc server but it doesnt seem to work together with the javascript SDK as far as I can tell. I want to deploy contracts quickly (much quicker than 1min blocktime)
evesnow91
@evesnow91
For contract development, I recommend following the contract testing methodology in Scilla binary via easyrun. For dapps testing, Kaya rpc will be revamped soon so they can work together. Please make do with the dev testnet for now.
李大狗
@leeduckgo
for example: the field in the return of api of ethereum is "gas". it's make sense, because this is the gas actually used in transaction.
But the return of zilliqa, there is only "gas limit" and "gas price".
That is confusing.
kishankumar258
@kishankumar258

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="**")

"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)

I understand I could use this way " new_api = ZilliqaAPI(endpoint="http://localhost:4201") " but in the github file of pyzil I did not get the script for creating transaction locally.
I have raised a github issue for the same at deepgully/pyzil#4 .
evesnow91
@evesnow91
You have to pack the bytes for VERSION I think
This is how you do transaction @kishankumar258
https://github.com/deepgully/pyzil#zils-transaction
One way is to add localhost yourself after MainNet here:
https://github.com/deepgully/pyzil/blob/c712f5f0dac382ca2ee038343ef2a4cccc154437/pyzil/zilliqa/chain.py#L113
evesnow91
@evesnow91
LocalNet = BlockChain("http://localhost:4201",
version= 131073, network_id= 2)
Then:
chain.set_active_chain(chain.LocalNet)
kishankumar258
@kishankumar258
Should not the network id be "2" as received as the output of "new_api.GetNetworkId()"
evesnow91
@evesnow91
Yep
Changed it
kishankumar258
@kishankumar258
Thanks
evesnow91
@evesnow91
packed bytes of (2,1) is 131073
gas in Ethereum is gasLimit*gasPrice
@albertschr
kishankumar258
@kishankumar258

@evesnow91 After doing this I get this error
chain.set_active_chain(chain.LocalNet)
AttributeError: module 'pyzil.zilliqa.chain' has no attribute 'LocalNet'

I had forked the pyzil repo made changes and then setup pyzil.

neeboo
@neeboo
@albertschr cumulative_gas is the gas amount that consumed.
Edison Lim
@edisonljh
@albertschr This might help. Just implemented yesterday. https://dev-wallet.zilliqa.com/calculate
李大狗
@leeduckgo
thxs a lot
unostore
@unostore
hi, love this project and trying to understand the code. In the new mainnet, they use bech32 for the address. Can someone point out to me in which file they appended the zil prefix to the address. thanks!
Amrit Kumar
@AmritKumar
unostore
@unostore
@AmritKumar thank you so much!
kishankumar258
@kishankumar258
What is the checksum address in zilliqa local network?
I am able to get the address of a node from the zilliqa logs in the local run folder and also able to check balance ( using GetBalance) for this addresss associated with a node, but, while sending transactions it shows as an invalid checksum address .I tried prepending "0x" to the address but that also shows as an invalid address. Is it something else for the local network, or do I need to do something else in this case. I am using the python client pyzil.
evesnow91
@evesnow91
# to_addr must be bech32 address or 20 bytes checksum address
to_addr = “zil1k5xzgp8xn87eshm3ktplqvs9nufav4pmcm52xx"