Skip to content

Need help to interact with a contract #212

@GuillaumeFerreira

Description

@GuillaumeFerreira

Hello, I've seen a lot of documentation, I think it's very good but unfortunately I still can't sign a transaction. I've come here in the hope that someone will be able to help me. I'll try to describe my problem as fully as possible.

archethic
  .connect()
  .then(async () => {

    const secretKey = Crypto.deriveAddress(userSeed, 0)
    const cipher = Crypto.aesEncrypt(secretKey, seed);


    const authorizedKeys = [
      {
        publicKey: seed,
        encryptedSecretKey: Crypto.ecEncrypt(secretKey, seed),
      },
    ];
    const originPrivateKey = Utils.originPrivateKey;

    const tx = archethic.transaction
      .new()
      .setType('transfer')
      .addUCOTransfer(poolAddressesUcoAeETH, Utils.toBigInt(1))
      .addOwnership(cipher, authorizedKeys)
      .build(seed,0)
      .originSign(originPrivateKey);

    tx.on('confirmation', (nbConf, maxConf) => console.log(nbConf, maxConf))
      .on('error', (_, err) => console.log(err))
      .on('timeout', (_) => console.log('timeout'))
      .send();
  })
  .catch((a) => {
    console.error(a);
  });

my userseed looks like this : "pirate bateau chimie .... "
my seed looks like this : "0000FD163D0CAD7CF62A6239A037EDABC27AD8467AD2898F899A88C7F9B52D771792"

I know that this code is not at all correct, and that I don't understand all these different keys, if anyone can help me.

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