Draft quick README, use ENV var for passing configuration.

This commit is contained in:
KtorZ 2023-01-06 13:44:20 +01:00
parent 1b7be32d74
commit 193792b48f
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 61 additions and 28 deletions

View File

@ -0,0 +1,33 @@
# Hello, World!
An example of an Hello, World! contract using Aiken and [Lucid](https://github.com/spacebudz/lucid).
See the [full tutorial on aiken-lang.org](https://aiken-lang.org/getting-started/hello-world).
## Building
```
aiken build
```
## Generating Credentials
```
deno run --allow-net --allow-write generate-credentials.ts
```
## Locking Funds
> **Warning** Require `BLOCKFROST_API_KEY` environment variable to be set.
```
deno run --allow-net --allow-read hello_world-lock.ts
```
## Unlocking Funds
> **Warning** Require `BLOCKFROST_API_KEY` environment variable to be set.
```
deno run --allow-net --allow-read hello_world-unlock.ts -- TRANSACTION_ID_FROM_LOCK
```

View File

@ -13,7 +13,7 @@ import * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
const lucid = await Lucid.new(
new Blockfrost(
"https://cardano-preview.blockfrost.io/api/v0",
/* BLOCKFROST API KEY */
Deno.env.get('BLOCKFROST_API_KEY'),
),
"Preview",
);

View File

@ -9,21 +9,21 @@ import {
toHex,
utf8ToHex
} from "https://deno.land/x/lucid@0.8.3/mod.ts";
import * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
import * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
const lucid = await Lucid.new(
new Blockfrost(
"https://cardano-preview.blockfrost.io/api/v0",
/* BLOCKFROST API KEY */
Deno.env.get('BLOCKFROST_API_KEY'),
),
"Preview",
);
);
lucid.selectWalletFromPrivateKey(await Deno.readTextFile("./key.sk"));
const validator = await readValidator("./assets/hello_world/spend/script.cbor");
const utxo = { txHash: '/* Tx ID from hello_world_lock */', outputIndex: 0 };
const utxo = { txHash: Deno.args[0], outputIndex: 0 };
const redeemer = Data.to(new Constr(0, [ utf8ToHex("Hello, World!")]) );