Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Alexander Cyon
    @Sajjon
    Download it from Testflight and after you have created (or restored) a Wallet request a payment and send me the link and I can send you some Staging testnet ZILs
    Jake Lin
    @JakeLin
    Have we changed the get balance in https://api.zilliqa.com . before, it returned a zero balance if I check an account without any Tx. But now it returns error: code: -5 data: null message: "Account is not created"
    Micky Socaci
    @mickys
    yes it seems to have been changed to return an error if the account does not have a balance
    Jake Lin
    @JakeLin
    thanks, Seems not quite right for a blockchain account for that behaviour
    evesnow91
    @evesnow91
    If the account state is not initialised, it will return that error code. This error code is mainly for debugging purposes. But Say if I had 1000 ZILs and I spent all 1000 ZILs, it will return me 0 balance.
    Jake Lin
    @JakeLin
    thanks for clarify that. In the other chain, e.g. Ethereum, it will return 0 balance without error. I will add some logic to handle that. Will it return 'code:-5' for that case? I need to use it to check and treat it as a OK case with no balance. thanks @evesnow91
    Micky Socaci
    @mickys
    @JakeLin yeah it returns an error if the account has no state, but 0 if it has 0 balance :)
    so just try / catch that
    evesnow91
    @evesnow91
    We thought it might be necessary for some applications in future.
    Jake Lin
    @JakeLin
    Hi guys, I have handled the 0 balance case, I am having another issue: when I try to send Zil using const tx = await zilliqa.blockchain.createTransaction( zilliqa.transactions.new({ version: 1, toAddr: sendTo, amount: new BN(sendAmount), gasPrice: new BN(sendGasPrice), gasLimit: Long.fromNumber(sendGasLimit), }) );
    I always got error: {code: -26, data: null, message: "CHAIN_ID incorrect"} id: 1 jsonrpc: "2.0"
    can someone give me some hint?
    I have seen this on Zilliqa-JS repo
    // These are set by the core protocol, and may vary per-chain. // These numbers are JUST AN EXAMPLE. They will NOT WORK on the public testnet // or mainnet. Please check what they are before proceeding, or your // transactions will simply be rejected. const CHAIN_ID = 88; const MSG_VERSION = 8; const VERSION = bytes.pack(88, 8);
    Jake Lin
    @JakeLin
    but don't know how to put the VERSION number
    evesnow91
    @evesnow91
    Hey @JakeLin version is a decimal conversion of the binary concatenation of both CHAIN_ID and MSG_VERSION. You will need to pack them together. You can use the Zilliqa-js util package to do so.
    const { BN, Long, bytes, units } = require('@zilliqa-js/util’);
    …
    const CHAIN_ID = 62;
    const MSG_VERSION = 1;
    const VER = bytes.pack(CHAIN_ID, MSG_VERSION);
    …
        let tx = zilliqa.transactions.new({
            version: VER,
            toAddr: 'f8c429e096abaabf43257728894d88f1142501a1',
            // Note all transactional values has to be converted to Qa (the smallest accounting unit) when using the Zilliqa protocol.
            // 1 Qa is 10^-12 Zil.
            amount: units.toQa('1000000', units.Units.Zil),  // Sending an amount in Zil and converting the amount to Qa.
            gasPrice: units.toQa('1000', units.Units.Li), // Minimum gasPrice in Li. Convert to Qa.
            gasLimit: Long.fromNumber(1),
          });
    Implementation in JS can follow @mickys format if you do not wish to use zilliqa-js utils package:
    const CHAIN_ID = 1 // MainNet ID
    const MSG_VERSION = 1 // First transaction payload version
    const version = (( CHAIN_ID << 16 ) + MSG_VERSION).toString(); // returns 65537
    Jake Lin
    @JakeLin
    I am using zilliqa-js utils package
    Jake Lin
    @JakeLin
    @evesnow91 I have follow the example you provided above, I am able to tend Zil now, but I think the example is not right, because units.toQa('1000000', units.Units.Zil) will convert a huge number
    for example, I try to send 1 zil, after amount: units.toQa(sendAmount, units.Units.Zil), it becomes 1000000000000, it means I send out 1000000000000 zil
    evesnow91
    @evesnow91
    Hey it’s fine jake this is the unit account for zilliqa. Please see this forum post: https://forum.zilliqa.com/t/gas-accounting-in-zilliqa/199
    Jake Lin
    @JakeLin
    Here is one of the payload in transactions
    {"id":1,"jsonrpc":"2.0","method":"CreateTransaction","params":[{"version":4063233,"toAddr":"399667D8c48cefBF1972F0C12eB49c8Ab995dd97","nonce":4,"pubKey":"0325304d408cf4b3e0eb9bba264c7eb78a2f54de65b608d07872f827af2d0a9b4b","amount":"1000000000000","gasPrice":"1000000000","gasLimit":"1","code":"","data":"","signature":"1d36bf20aea6cb59e224291d4cc2a07bdbe6d0c220ed3525d31bea0162f0bf1c764ed4f020c7036272059f5378aa86beac21eef4cdabe2ae90b91384eae9a227"}]}
    evesnow91
    @evesnow91
    They are in the smallest unit Qa, similar to ethereum Wei
    Jake Lin
    @JakeLin
    I understand the usage of Qa, but when I send out "amount":"1000000000000" in the payload, I send out 1000000000000 zil not 1 zil
    Micky Socaci
    @mickys
    amount: units.toQa('1', units.Units.Zil) << you send 1 zil, that is 1 000 000 LI ( 10 pow 6 ) or 1 000 000 000 000 QA ( 10 ** 12 ) :)
    Jake Lin
    @JakeLin
    I understand that
    evesnow91
    @evesnow91
    No you are sending out that amount in Qa not Zil Jake
    Jake Lin
    @JakeLin
    I am thinking the unit of amount is Qa
    evesnow91
    @evesnow91
    Yes
    Jake Lin
    @JakeLin
    But my balance deducts 1000000000000 zil
    evesnow91
    @evesnow91
    Everything to do with the protocol level is denominated in Qa. Only the users see ZILs
    Your balance is denominated in QA too
    You have to convert to zil
    Jake Lin
    @JakeLin
    Got it
    thanks
    So it is similar to Eth now using wei as default.
    The balance used to be zil before, but I can convert it to from Qa to Zil, thanks a lot
    evesnow91
    @evesnow91
    No problem :smile:
    Jake Lin
    @JakeLin
    sorry guys, I got another issue here, when I try to convert Qa to Zil using units.Units.Zil like const balanceInZil = units.fromQa('1', units.Units.Zil); I am getting an error TypeError: qa.abs is not a function in var fraction = qa.abs().mod(base).toString(10); // prepend 0s to the fraction half
    I am using the latest version "@zilliqa-js/zilliqa": "^0.3.4"
    evesnow91
    @evesnow91
    @JakeLin When you are converting from Qa, you input a BN, not String. fromQa returns a String:
    const balanceInZil = units.fromQa(new BN(1), units.Units.Zil);
    console.log(balanceInZil);
    Jake Lin
    @JakeLin
    thanks, it works
    Rinat
    @lich666dead
    Hello everybody, try ZilPay cover, it's very convenient to test, it can work with dapp as a metamask, there are examples of dapp in the cough repository!
    github: https://github.com/lich666dead/zil-pay
    chrome store: https://chrome.google.com/webstore/detail/zilpay/klnaejjgbibmhlephnhpmaofohgkpgkd
    evesnow91
    @evesnow91
    :thumbsup: great initiative
    It's so colourful haha
    Asindu
    @as1ndu
    Hi guys can I submit 2 applications for the zilliqa grant?
    For wave 4?
    Amrit Kumar
    @AmritKumar
    Yes, you can. @as1ndu
    MBakhshi96
    @MBakhshi96
    Hi guys, When is the deadline for submissions of wave 4?
    evesnow91
    @evesnow91
    @MBakhshi96 It is end of June.