Utxos are objects used to represent ownership of value within a VAnchor instance. The input Utxos to a VAnchor transaction represent the spending a previously created Utxo.

  • Therefore, input Utxos should have a privkey configured on the given Utxo's keypair. The output Utxos to a VAnchor transaction represent the creation of new Utxos.
  • Therefore, output Utxos don't need to have a privkey configured on the given Utxo's keypair.

Hierarchy

Constructors

  • Initialize a new UTXO - unspent transaction output or input. Note, a full TX consists of 2/16 inputs and 2 outputs

    Parameters

    • inner: JsUtxo

      The wasm representation of a utxo

    Returns Utxo

Properties

inner: JsUtxo
keypair: Keypair = ...
originChainId: undefined | string

Accessors

  • get commitment(): Uint8Array
  • Returns commitment for this UTXO

    Returns

    the poseidon hash of [chainId, amount, pubKey, blinding]

    Returns Uint8Array

  • get index(): undefined | number
  • Returns

    the index configured on this UTXO. Output UTXOs generated before they have been inserted in a tree.

    Utxos used as inputs are expected to have the index

    Returns undefined | number

  • get nullifier(): string
  • Returns

    the nullifier: hash of [commitment, index, signature] where signature = hash([secret key, commitment, index])

    Returns string

  • get public_key(): string
  • Returns

    the public key used for generating the commitment. If the utxo is configured with a secret_key, this value should be poseidonHash(secret_key)

    Returns string

  • get secret_key(): string
  • Returns

    the secret_key AKA private_key used in the nullifier.

    Returns string

  • get wasm(): Promise<{
        ExtData: any;
        JsLeaf: any;
        JsNote: any;
        JsNoteBuilder: any;
        JsProofInput: any;
        JsProofInputBuilder: any;
        JsProofOutput: any;
        JsProvingKeys: any;
        JsUtxo: any;
        LeavesMapInput: any;
        MTBn254X5: any;
        MixerProof: any;
        OperationError: any;
        VAnchorProof: any;
        default: any;
        generate_proof_js: any;
        js_note_of_jsval: any;
        js_utxo_of_jsval: any;
        main: any;
        setupKeys: any;
        verify_js_proof: any;
    }>
  • Returns Promise<{
        ExtData: any;
        JsLeaf: any;
        JsNote: any;
        JsNoteBuilder: any;
        JsProofInput: any;
        JsProofInputBuilder: any;
        JsProofOutput: any;
        JsProvingKeys: any;
        JsUtxo: any;
        LeavesMapInput: any;
        MTBn254X5: any;
        MixerProof: any;
        OperationError: any;
        VAnchorProof: any;
        default: any;
        generate_proof_js: any;
        js_note_of_jsval: any;
        js_utxo_of_jsval: any;
        main: any;
        setupKeys: any;
        verify_js_proof: any;
    }>

Methods

  • Encrypt UTXO data using the current keypair. This is used in the externalDataHash calculations so the funds for this deposit can only be spent by the owner of this.keypair.

    Returns

    0x-prefixed hex string with data

    Returns string

  • Returns

    secrets - an array of secret values represented in the utxo

    Returns string[]

  • Parameters

    • originChainId: undefined | string

    Returns void

  • Decrypt a UTXO

    Returns

    a UTXO object

    Parameters

    • keypair: Keypair

      keypair used to decrypt

    • data: string

      hex string with data

    Returns Promise<Utxo>

  • Returns

    The Utxo object with appropriately configured inner wasm instance.

    Parameters

    • utxoString: string

      A string representation of the parts that make up a utxo, split by '&'.

      • All values are represented as hex-encoded byte strings.
      • Relevant values will be interpreted as encoded in BigEndian
      • Optional values are represented as the empty string if not present, meaning the split call will always be an array of length "parts".

      parts[0] - Curve value, e.g. Bn254, Bls381, Ed25519, etc. parts[1] - Backend value, e.g. arkworks or circom parts[2] - Amount in atomic units, e.g. ETH in wei amounts or DOT in 10^12 decimals parts[3] - TypedChainId, the hex value of the calculated typed chain id parts[4] - Blinding, secret random value parts[5] - PublicKey, the "publicKey = hash(privateKey)" value which indicates ownership for a utxo. parts[6] Optional - EncryptionKey, the public key of "publicKey = encryptionScheme(privateKey)" value used for messaging. parts[7] Optional - PrivateKey, the secret key component correlated to the above values. parts[8] Optional - Index, the leaf index if the utxo has been inserted in a merkle tree

    Returns Promise<Utxo>

Generated using TypeDoc