Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Amrit Kumar
    @AmritKumar
    prepend active_chain with chain.
    And it should work
    So, params = active_chain.build_transaction_params(my_key, **payload) should be params = chain.active_chain.build_transaction_params(my_key, **payload)
    and active_chain.api.CreateTransaction(params) should be chain.active_chain.api.CreateTransaction(params)
    @kishankumar258
    Amrit Kumar
    @AmritKumar
    @jeremyid We have been discussing discord internally for a long time. Maybe we should push it.
    kishankumar258
    @kishankumar258
    @AmritKumar Thanks
    kishankumar258
    @kishankumar258

    @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

    evesnow91
    @evesnow91
    @kishankumar258 Do you know how to code in python?
    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?
    image.png
    @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
    image.png
    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.
    image.png
    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="**")

    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)

    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 .
    Please help.
    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
    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.