Skip to content

Why do we need to add 4 bytes of random characters when interacting with contracts? #107

@lucky1024

Description

@lucky1024

When I looked at the source code, I found the following snippet:

async function createTx(
  arweave: Arweave,
  wallet: JWKInterface | 'use_wallet',
  contractId: string,
  input: any,
  tags: { name: string; value: string }[],
  target: string = '',
  winstonQty: string = '0',
  reward?: string,
): Promise<Transaction> {
  const options: Partial<CreateTransactionInterface> = {
    data: Math.random().toString().slice(-4),                                // Why need this?
    reward,
  };

Does anyone know why we need the random string?

data: Math.random().toString().slice(-4),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions