Skip to content

Instantly share code, notes, and snippets.

@iamonuwa
Created November 6, 2019 20:29
Show Gist options
  • Select an option

  • Save iamonuwa/483c097b50f6e1f2b677a9111b49c40b to your computer and use it in GitHub Desktop.

Select an option

Save iamonuwa/483c097b50f6e1f2b677a9111b49c40b to your computer and use it in GitHub Desktop.

Revisions

  1. iamonuwa created this gist Nov 6, 2019.
    18 changes: 18 additions & 0 deletions arweave.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    const tx = await arweave.createTransaction(
    { data: JSON.stringify(data) },
    key
    );

    console.log(tx);
    tx.addTag("App-Name", "demo");
    tx.addTag("App-Version", "0.0.1");
    tx.addTag("Unix-Time", Math.round(new Date().getTime() / 1000));
    tx.addTag("Type", "publish");

    console.log(tx);

    await arweave.transactions.sign(tx, key);
    console.log(tx.id);

    let { status } = await arweave.transactions.post(tx);