Programmatic Faucet

Programmatic Faucet

We have deployed some updates to the Teztnets platform that include a long-requested feature: the programmatic faucet.

With the npm package @oxheadalpha/get-tez, you can now programatically fund an address using Javascript/Typescript or using the CLI. See the package details for more for info on installing and using.

Proof of Work

To prevent spam, we’ve also introduced the need to solve PoW challenges before receiving your Tez. The number of challenges given depends on the network and the amount of Tez requested. Less challenges are required when requesting Tez via a faucet’s web interface compared to when doing so programmatically.

It is relatively easy to get large amount of Tez on an ephemeral network such as mondaynet and dailynet. Meanwhile, ghostnet is getting large (600Gi for an archive node) and we want to keep this network useful for some time. Therefore we made getting tokens for this network just a little bit harder - you have to crunch numbers for approximately one hour to get enough Tez to become a ghostnet baker.

Usage

Using the package is as simple as the following:

JS/TS:

import getTez from "@oxheadalpha/get-tez"

(async () => {
    const txHash = await getTez({
      address: "tz1...",
      amount: 10,
      network: "ghostnet",
    })
    // txHash: ooaEskbj...
})()

CLI:

npx @oxheadalpha/get-tez tz1... --amount 10 --network ghostnet

Special thanks to Nicolas Ochem

1 Like

If I resume : you opened an API on your backend to give free tez
Is it correct ?

Yes, please see the the Tezos Faucet Backend readme’s API Endpoints section for more information.

With the npm package @oxheadalpha/get-tez , you can now programatically fund an address using Javascript/Typescript or using the CLI.

Awesome! We’ll ensure that Taqueria makes use of this in an upcoming update.

Thanks for the great work.

Cheers.

1 Like

Update: You can now provide a local address alias instead of a raw public key hash! See the readme for more details.

JS:

const txHash = await getTez({
  address: "alice",
  amount: 10,
  network: "ghostnet",
})

CLI:
npx @oxheadalpha/get-tez@latest alice -a 1 -n ghostnet.

❯ npx @oxheadalpha/get-tez@latest --help
CLI Usage: npx @oxheadalpha/get-tez [options] <address>

<address>:
  The address where Tez should be sent. This can be either a standard Tezos public key hash (e.g. tz1234abc...)
  or a local alias. If an alias is provided (e.g., 'alice'), the program will attempt to resolve it to a public
  key hash by looking it up in the specified client directory (set by --client-dir or by the TEZOS_CLIENT_DIR
  environment variable). If neither is set, the default lookup location is $HOME/.tezos-client/public_key_hashes.
...
1 Like