See https://pencilflip.medium.com/how-to-use-arweave-to-store-and-access-nft-metadata-823552293f62 for a more in-depth walkthrough.
In order to run this code, you need to generate a new Arweave wallet. Follow https://docs.arweave.org/info/wallets/arweave-web-extension-wallet#new-users-generating-your-wallet in order to do this. Once you do it, create a .env
file and set KEY=YOUR_KEY
.
There are five scripts.
yarn readAccount
—this is a simple example of how to read basic data about your Arweave wallet.yarn readTx TX_ID
—reads the data of a transaction.yarn txStatus TX_ID
—this gets the status of a single transaction.yarn submitTx
—shows how to submit a transaction usingarweave.transactions.post
and read the data back.yarn arbundles
—shows how to submit a transaction usingarbundles
(which is more robust thanarweave.transactions.post
) and read the data back.
Useful sites:
- https://viewblock.io/arweave/address/YOUR_ADDRESS. You can go here to view all your confirmed and mined transactions.