Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues transferring genesis funds #254

Closed
ixje opened this issue Oct 17, 2022 · 8 comments · Fixed by #312
Closed

issues transferring genesis funds #254

ixje opened this issue Oct 17, 2022 · 8 comments · Fixed by #312

Comments

@ixje
Copy link
Contributor

ixje commented Oct 17, 2022

  • first attempt

    erik$ neoxp show balances NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8
    GAS (0xd2a4cff31913016155e38e474a2c06d08be276cf)
      balance: 52000000
    NEO (0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5)
      balance: 100000000
    erik$ neoxp transfer NEO all NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8 NRHqGZzJ1cfb9E6yxhjbwCHXTgz9mjQ1Kq
    enter password for NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8 ***
    System.Exception: NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8 sender not found.
    
  • after some googling I found an example which became the inspiration for my second attempt

    erik$ neoxp show balances NYmX663cBH2gnLSE71eeRPDvK9rNFEKBaG
    GAS (0xd2a4cff31913016155e38e474a2c06d08be276cf)
      balance: 361
    NEO (0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5)
      balance: 0
    erik$ neoxp show balances NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8
    GAS (0xd2a4cff31913016155e38e474a2c06d08be276cf)
      balance: 52000000
    NEO (0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5)
      balance: 100000000
    erik$ neoxp transfer all NEO genesis NRHqGZzJ1cfb9E6yxhjbwCHXTgz9mjQ1Kq
    Transfer Transaction 0x41b743167452625f8864e618e06a317fac18422cefd7c56617141791576e03c1 submitted
    erik$ neoxp transfer all GAS genesis NRHqGZzJ1cfb9E6yxhjbwCHXTgz9mjQ1Kq
    Transfer Transaction 0xabbb44730cb155c226a3ccc3feaecd4921e42e086ad87fa1c260982e1677de4e submitted
    

seems like it is working but, when reading the application log via show transaction I get a FAULT result and no balances moved

eriks-MBP:shared erik$ neoxp show transaction 0xabbb44730cb155c226a3ccc3feaecd4921e42e086ad87fa1c260982e1677de4e
{
  "transaction": {
    "hash": "0xabbb44730cb155c226a3ccc3feaecd4921e42e086ad87fa1c260982e1677de4e",
    "size": 308,
    "version": 0,
    "nonce": 1542406571,
    "sender": "NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8",
    "sysfee": "3073890",
    "netfee": "1291580",
    "validuntilblock": 87370,
    "signers": [
      {
        "account": "0x55fea2875ed9d07515613792dfb190935e30a199",
        "scopes": "CalledByEntry"
      }
    ],
    "attributes": [],
    "script": "DBSZoTBek5Cx35I3YRV10Nleh6L+VRHAHwwJYmFsYW5jZU9mDBTPduKL0AYsSkeO41VhARMZ88+k0kFifVtSC1AMFDr7K9ns2rx3T0WvvcUoc6usj/uSDBSZoTBek5Cx35I3YRV10Nleh6L+VRTADAh0cmFuc2ZlcgwUz3bii9AGLEpHjuNVYQETGfPPpNJBYn1bUg==",
    "witnesses": [
      {
        "invocation": "DECCWFF+cxTJtrKh899GbMowe37Nl9wTCrY8XKEJ8BGGGkL0vJ8Q712nlBhHjAiQh03eqrgAlY4FjBpS4h4BrQyl",
        "verification": "EQwhA0+ip0a7eL6Vivc6eloGddqMBs76mEqZqSlyZoJKDMeWEUGe0Nw6"
      }
    ]
  },
  "application-log": {
    "txid": "0xabbb44730cb155c226a3ccc3feaecd4921e42e086ad87fa1c260982e1677de4e",
    "executions": [
      {
        "trigger": "Application",
        "vmstate": "FAULT",
        "gasconsumed": "3073890",
        "exception": "Specified cast is not valid.",
        "stack": [],
        "notifications": []
      }
    ]
  }
}

neo-express file

{
  "magic": 1614787581,
  "address-version": 53,
  "consensus-nodes": [
    {
      "tcp-port": 50013,
      "ws-port": 50014,
      "rpc-port": 50012,
      "wallet": {
        "name": "node1",
        "accounts": [
          {
            "private-key": "320e1d1d9260e8aef2bfac93e83e92d9bc5abc9fd0fbee072fc71ca6a4f8ffbb",
            "script-hash": "NYmX663cBH2gnLSE71eeRPDvK9rNFEKBaG",
            "label": null,
            "is-default": true,
            "contract": {
              "script": "0c21034fa2a746bb78be958af73a7a5a0675da8c06cefa984a99a9297266824a0cc7964156e7b327",
              "parameters": [
                "Signature"
              ]
            }
          },
          {
            "private-key": "320e1d1d9260e8aef2bfac93e83e92d9bc5abc9fd0fbee072fc71ca6a4f8ffbb",
            "script-hash": "NZvHfi95au9zPqNXrVDm3USetTrk8pyaY8",
            "label": "Consensus MultiSigContract",
            "is-default": false,
            "contract": {
              "script": "110c21034fa2a746bb78be958af73a7a5a0675da8c06cefa984a99a9297266824a0cc79611419ed0dc3a",
              "parameters": [
                "Signature"
              ]
            }
          }
        ]
      }
    }
  ],
  "settings": {
    "chain.SecondsPerBlock": "1"
  }
}
erik$neoxp --version
3.4.18+f8b893e693
@ixje
Copy link
Contributor Author

ixje commented Oct 17, 2022

same behaviour for version 3.3.27

@ixje
Copy link
Contributor Author

ixje commented Oct 17, 2022

Found the issue. all doesn't work anymore, despite the documentation saying

the quantity to transfer as an integer or all to transfer all assets of the specified type

@robliou
Copy link

robliou commented Mar 21, 2023

@ixje,

Just looking at the docs, the syntax for transfer is:

Usage: neoxp transfer [options] <Quantity> <Asset> <Sender> <Receiver>

In your first example, you had 'Quantity' and 'Asset' reversed, but looks like you fixed it in your second example.

@cschuchardt88
Copy link
Member

cschuchardt88 commented Nov 7, 2023

Its the way the build script is bring made. if someone could help me validate this script.

Script: DBTe/jt7UUarApFmqICyKibu/6eg1xHAHwwJYmFsYW5jZU9mDBTPduKL0AYsSkeO41VhARMZ88+k0kFifVtSC1AMFKhh7nmBUaCl5Q8BmSKwnKER+hTxDBTe/jt7UUarApFmqICyKibu/6eg1xTADAh0cmFuc2ZlcgwUz3bii9AGLEpHjuNVYQETGfPPpNJBYn1bUg==

using var sb = new ScriptBuilder();
// balanceOf operation places current balance on eval stack
sb.EmitDynamicCall(asset, "balanceOf", senderHash);
// transfer operation takes 4 arguments, amount is 3rd parameter
// push data parameter onto the stack then switch positions of the top
// two items on eval stack so data is 4th arg and balance is 3rd
sb.EmitPush(data);
sb.Emit(OpCode.SWAP);
sb.EmitPush(receiverHash);
sb.EmitPush(senderHash);
sb.EmitPush(4);
sb.Emit(OpCode.PACK);
sb.EmitPush("transfer");
sb.EmitPush(asset);
sb.EmitSysCall(ApplicationEngine.System_Contract_Call);

@Ashuaidehao
Copy link
Collaborator

Ashuaidehao commented Nov 8, 2023

Its the way the build script is bring made. if someone could help me validate this script.

Script: DBTe/jt7UUarApFmqICyKibu/6eg1xHAHwwJYmFsYW5jZU9mDBTPduKL0AYsSkeO41VhARMZ88+k0kFifVtSC1AMFKhh7nmBUaCl5Q8BmSKwnKER+hTxDBTe/jt7UUarApFmqICyKibu/6eg1xTADAh0cmFuc2ZlcgwUz3bii9AGLEpHjuNVYQETGfPPpNJBYn1bUg==

using var sb = new ScriptBuilder();
// balanceOf operation places current balance on eval stack
sb.EmitDynamicCall(asset, "balanceOf", senderHash);
// transfer operation takes 4 arguments, amount is 3rd parameter
// push data parameter onto the stack then switch positions of the top
// two items on eval stack so data is 4th arg and balance is 3rd
sb.EmitPush(data);
sb.Emit(OpCode.SWAP);
sb.EmitPush(receiverHash);
sb.EmitPush(senderHash);
sb.EmitPush(4);
sb.Emit(OpCode.PACK);
sb.EmitPush("transfer");
sb.EmitPush(asset);
sb.EmitSysCall(ApplicationEngine.System_Contract_Call);

Miss a "CallFlag" parameter.

using var sb = new ScriptBuilder();
// balanceOf operation places current balance on eval stack
sb.EmitDynamicCall(asset, "balanceOf", senderHash);
// transfer operation takes 4 arguments, amount is 3rd parameter
// push data parameter onto the stack then switch positions of the top
// two items on eval stack so data is 4th arg and balance is 3rd
sb.EmitPush(data);
sb.Emit(OpCode.SWAP);
sb.EmitPush(receiverHash);
sb.EmitPush(senderHash);
sb.EmitPush(4);
sb.Emit(OpCode.PACK);
sb.EmitPush(CallFlags.All);//here
sb.EmitPush("transfer");
sb.EmitPush(asset);
sb.EmitSysCall(ApplicationEngine.System_Contract_Call);

@cschuchardt88
Copy link
Member

cschuchardt88 commented Nov 8, 2023

@Ashuaidehao
Ty, that fixed it.

@ixje
PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show transaction 0xd84454503f753c73e48c19ea44b0c8e61d0ddc663fa8c3afa7d943a021959f08

{
  "transaction": {
    "hash": "0xd84454503f753c73e48c19ea44b0c8e61d0ddc663fa8c3afa7d943a021959f08",
    "size": 309,
    "version": 0,
    "nonce": 1279174231,
    "sender": "NgF3kiTq2gSYbFPPjPhtxmV2bYBTBUWaq6",
    "sysfee": "12006110",
    "netfee": "1292580",
    "validuntilblock": 5793,
    "signers": [
      {
        "account": "0xd7a0a7ffee262ab280a8669102ab46517b3bfede",
        "scopes": "CalledByEntry"
      }
    ],
    "attributes": [],
    "script": "DBTe/jt7UUarApFmqICyKibu/6eg1xHAHwwJYmFsYW5jZU9mDBT1Y+pAvCg9TQ4FxI6jBbPyoHNA70FifVtSC1AMFKhh7nmBUaCl5Q8BmSKwnKER+hTxDBTe/jt7UUarApFmqICyKibu/6eg1xTAHwwIdHJhbnNmZXIMFPVj6kC8KD1NDgXEjqMFs/Kgc0DvQWJ9W1I=",
    "witnesses": [
      {
        "invocation": "DEB1qWe0SEGjb2vkpPci2vMbwmOlJE/sUSTqJNvP7dIJPKL15mtx3ZkRqylR3xynIC03R2U7xM51ayleJSRrX0d2",
        "verification": "EQwhAiSY7d6PY7PYtaRDsnwe2pax7Wfr+z7tV8e9+rQ9lUt3EUGe0Nw6"
      }
    ]
  },
  "application-log": {
    "txid": "0xd84454503f753c73e48c19ea44b0c8e61d0ddc663fa8c3afa7d943a021959f08",
    "executions": [
      {
        "trigger": "Application",
        "vmstate": "HALT",
        "gasconsumed": "12006110",
        "exception": null,
        "stack": [
          {
            "type": "Boolean",
            "value": true
          }
        ],
        "notifications": [
          {
            "contract": "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
            "eventname": "Transfer",
            "state": {
              "type": "Array",
              "value": [
                {
                  "type": "ByteString",
                  "value": "3v47e1FGqwKRZqiAsiom7v+noNc="
                },
                {
                  "type": "ByteString",
                  "value": "qGHueYFRoKXlDwGZIrCcoRH6FPE="
                },
                {
                  "type": "Integer",
                  "value": "100000000"
                }
              ]
            }
          },
          {
            "contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
            "eventname": "Transfer",
            "state": {
              "type": "Array",
              "value": [
                {
                  "type": "Any"
                },
                {
                  "type": "ByteString",
                  "value": "3v47e1FGqwKRZqiAsiom7v+noNc="
                },
                {
                  "type": "Integer",
                  "value": "1700000000"
                }
              ]
            }
          }
        ]
      }
    ]
  }
}

@ixje
Copy link
Contributor Author

ixje commented Nov 8, 2023

@Ashuaidehao Ty, that fixed it.

@ixje PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show transaction 0xd84454503f753c73e48c19ea44b0c8e61d0ddc663fa8c3afa7d943a021959f08

{
  "transaction": {
    "hash": "0xd84454503f753c73e48c19ea44b0c8e61d0ddc663fa8c3afa7d943a021959f08",
    "size": 309,
    "version": 0,
    "nonce": 1279174231,
    "sender": "NgF3kiTq2gSYbFPPjPhtxmV2bYBTBUWaq6",
    "sysfee": "12006110",
    "netfee": "1292580",
    "validuntilblock": 5793,
    "signers": [
      {
        "account": "0xd7a0a7ffee262ab280a8669102ab46517b3bfede",
        "scopes": "CalledByEntry"
      }
    ],
    "attributes": [],
    "script": "DBTe/jt7UUarApFmqICyKibu/6eg1xHAHwwJYmFsYW5jZU9mDBT1Y+pAvCg9TQ4FxI6jBbPyoHNA70FifVtSC1AMFKhh7nmBUaCl5Q8BmSKwnKER+hTxDBTe/jt7UUarApFmqICyKibu/6eg1xTAHwwIdHJhbnNmZXIMFPVj6kC8KD1NDgXEjqMFs/Kgc0DvQWJ9W1I=",
    "witnesses": [
      {
        "invocation": "DEB1qWe0SEGjb2vkpPci2vMbwmOlJE/sUSTqJNvP7dIJPKL15mtx3ZkRqylR3xynIC03R2U7xM51ayleJSRrX0d2",
        "verification": "EQwhAiSY7d6PY7PYtaRDsnwe2pax7Wfr+z7tV8e9+rQ9lUt3EUGe0Nw6"
      }
    ]
  },
  "application-log": {
    "txid": "0xd84454503f753c73e48c19ea44b0c8e61d0ddc663fa8c3afa7d943a021959f08",
    "executions": [
      {
        "trigger": "Application",
        "vmstate": "HALT",
        "gasconsumed": "12006110",
        "exception": null,
        "stack": [
          {
            "type": "Boolean",
            "value": true
          }
        ],
        "notifications": [
          {
            "contract": "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
            "eventname": "Transfer",
            "state": {
              "type": "Array",
              "value": [
                {
                  "type": "ByteString",
                  "value": "3v47e1FGqwKRZqiAsiom7v+noNc="
                },
                {
                  "type": "ByteString",
                  "value": "qGHueYFRoKXlDwGZIrCcoRH6FPE="
                },
                {
                  "type": "Integer",
                  "value": "100000000"
                }
              ]
            }
          },
          {
            "contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
            "eventname": "Transfer",
            "state": {
              "type": "Array",
              "value": [
                {
                  "type": "Any"
                },
                {
                  "type": "ByteString",
                  "value": "3v47e1FGqwKRZqiAsiom7v+noNc="
                },
                {
                  "type": "Integer",
                  "value": "1700000000"
                }
              ]
            }
          }
        ]
      }
    ]
  }
}

what was the command to invoke this?

@cschuchardt88
Copy link
Member

transfer all NEO genesis NbGJ2PMcd7DeVYCnAf3neEuEqgLdaGX6rP

@Jim8y Jim8y closed this as completed in #312 Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants