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

"eosio_assert_message assertion failure" during account creation #96

Open
dev-dantealighieri opened this issue Jan 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dev-dantealighieri
Copy link

when I'm trying to create an account using wharfkit/antelope library, I get the following response from the transaction broadcast.

{
  transaction_id: '41e2edec3278acba808ee6d9b761786be3862af336dc17f6732319ec893d2a01',
  processed: {
    id: '41e2edec3278acba808ee6d9b761786be3862af336dc17f6732319ec893d2a01',
    block_num: 351244143,
    block_time: '2024-01-09T15:44:49.000',
    producer_block_id: null,
    receipt: null,
    elapsed: 403,
    net_usage: 165,
    scheduled: false,
    action_traces: [ [Object], [Object] ],
    account_ram_delta: null,
    except: {
      code: 3050003,
      name: 'eosio_assert_message_exception',
      message: 'eosio_assert_message assertion failure',
      stack: [Array]
    },
    error_code: '10000000000000000000'
  }
}

I can't figure out what's the problem. I'm using an account with R1 public/private key.

I can send money transactions successfully, but account creation fails like this.

following shows how I create new account action:

contract.action(
    "newaccount",
    {
      creator: creatorUsername,
      name: newAccountName,
      owner: {
        threshold: 1,
        keys: [
          {
            key: publicKey,
            weight: 1,
          },
        ],
        accounts: [],
        waits: [],
      },
      active: {
        threshold: 1,
        keys: [
          {
            key: publicKey,
            weight: 1,
          },
        ],
        accounts: [],
        waits: [],
      },
    },
    {
      authorization: [
        {
          actor: creatorUsername,
          permission: "owner",
        },
      ],
    },
  );

and the following shows how I create buy ram action

contract.action(
    "buyrambytes",
    {
      payer: payerUsername,
      receiver: receiverUsername,
      bytes: ramBytes,
    },
    {
      authorization: [
        {
          actor: payerUsername,
          permission: "owner",
        },
      ],
    },
  );

the contract here is coming from import { Contract } from '@wharfkit/contract';

@dev-dantealighieri dev-dantealighieri added the bug Something isn't working label Jan 9, 2024
@aaroncox
Copy link
Member

Sorry it took me a bit to get around to this. I managed to basically reproduce what you were trying to do and it appears that it was successful.

https://jungle4.eosq.eosnation.io/tx/94eb6df9111305ce986254b1670b79e42e084e34226d9cbdbb9c89cf6809d795

My best guess is something inside one of the variables in the code above, whether it be the account name, public key, bytes received or something else is at fault here. The code itself should be working properly but the inputs are mixed up somehow.

Below is the code that I just used to successfully create the account above.

const creatorUsername = 'wharfkittest'
const session = new Session({
    chain: Chains.Jungle4,
    walletPlugin: new WalletPluginPrivateKey(
        'PRIVATE_KEY_HERE'
    ), // or use a wallet plugin
    actor: creatorUsername,
    permission: 'active',
})
const newAccountName = 'test2334test'
const newPrivateKey = PrivateKey.generate('R1')
const newPublicKey = newPrivateKey.toPublic()
const action1 = systemContract.action(
    'newaccount',
    {
        creator: creatorUsername,
        name: newAccountName,
        owner: {
            threshold: 1,
            keys: [
                {
                    key: newPublicKey,
                    weight: 1,
                },
            ],
            accounts: [],
            waits: [],
        },
        active: {
            threshold: 1,
            keys: [
                {
                    key: newPublicKey,
                    weight: 1,
                },
            ],
            accounts: [],
            waits: [],
        },
    },
    {
        authorization: [
            {
                actor: creatorUsername,
                permission: 'active',
            },
        ],
    }
)
const action2 = systemContract.action('buyrambytes', {
    payer: creatorUsername,
    receiver: newAccountName,
    bytes: 4000,
})
const result = await session.transact({actions: [action1, action2]})
console.log(result)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants