From bcf97516bf1d926c975fad0624756a904d8fa249 Mon Sep 17 00:00:00 2001 From: Tom Wilson Date: Tue, 14 Nov 2023 17:25:10 +0000 Subject: [PATCH] feat: add guide to publish atomic assets using ardrive cli --- docs/languages/strings/en.json | 6 +- docs/src/.vuepress/sidebar.js | 4 + docs/src/guides/README.md | 2 + .../smartweave/atomic-assets/ardrive-cli.md | 101 ++++++++++++++++++ .../guides/smartweave/atomic-assets/index.md | 12 +++ 5 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 docs/src/guides/smartweave/atomic-assets/ardrive-cli.md create mode 100644 docs/src/guides/smartweave/atomic-assets/index.md diff --git a/docs/languages/strings/en.json b/docs/languages/strings/en.json index fa7a9e3d..92c2083a 100644 --- a/docs/languages/strings/en.json +++ b/docs/languages/strings/en.json @@ -1,6 +1,5 @@ { "cookbook-meetup-notification": "Cookbook Community Meetup - 12pm ET / 5pm GMT every week on Wednesdays", - "edit": "Edit", "language": "Language", "docs": "Docs", @@ -8,12 +7,10 @@ "last-updated": "Last Updated", "featured-contributors": "Featured Contributors", "featured-contributors-action": "See All Contributors", - "onboarding-title": "Build on the Permaweb.", "onboarding-desc": "A curated collection of developer guides & more to build on the Permaweb. All in one place.", "get-started": "Get Started", "first-time": "First Time?", - "hello-world": "Hello World", "hello-world-card-desc": "Getting started with the Permaweb", "hello-world-card-action": "Let's Go", @@ -26,9 +23,7 @@ "contribute": "Contribute", "contribute-card-desc": "Share your knowledge", "contribute-card-action": "Go to Github repo", - "documentation": "Documentation", - "getting-started": "Getting Started", "getting-started-welcome": "Welcome", "getting-started-hw-cli": "Hello World (CLI)", @@ -54,6 +49,7 @@ "guides-server-side": "Server Side", "guides-spheron": "Spheron", "guides-atomic-token": "Atomic Tokens", + "guides-atomic-asset": "Atomic Assets", "guides-deploying-apps": "Deploying Apps", "guides-github-action": "Github Action", "guides-deploying-manifests": "Deploying PathManifests", diff --git a/docs/src/.vuepress/sidebar.js b/docs/src/.vuepress/sidebar.js index 1c86b450..c6fe1dfe 100644 --- a/docs/src/.vuepress/sidebar.js +++ b/docs/src/.vuepress/sidebar.js @@ -293,6 +293,10 @@ const getI18NSidebar = (langCode) => [ text: "SmartWeave", collapsible: true, children: [ + { + text: get_i18n_str(langCode, "guides-atomic-asset"), + link: get_i18n_link(langCode, "/guides/smartweave/atomic-assets/index") + }, { text: get_i18n_str(langCode, "guides-atomic-token"), link: get_i18n_link(langCode, "/guides/atomic-tokens/intro"), diff --git a/docs/src/guides/README.md b/docs/src/guides/README.md index 512a537b..42ef02a9 100755 --- a/docs/src/guides/README.md +++ b/docs/src/guides/README.md @@ -24,6 +24,8 @@ Snack-sized guides for the building blocks of the Permaweb - [ar-gql](querying-arweave/ar-gql.md) - [Search Service](querying-arweave/search-indexing-service.md) - SmartWeave + - [Atomic Assets](smartweave/atomic-assets/index.md) + - [using ArDrive CLI](smartweave/atomic-assets/ardrive-cli.md) - [Atomic Tokens](atomic-tokens/intro.md) - [Vouch](vouch.md) - Warp Contracts diff --git a/docs/src/guides/smartweave/atomic-assets/ardrive-cli.md b/docs/src/guides/smartweave/atomic-assets/ardrive-cli.md new file mode 100644 index 00000000..0885b69e --- /dev/null +++ b/docs/src/guides/smartweave/atomic-assets/ardrive-cli.md @@ -0,0 +1,101 @@ +# Deploy and Register Atomic Assets using ArDrive CLI + +Atomic Assets need to be registered to be capable of being traded on the Permaweb. You can upload your assets using services like `ardrive-cli` and give the asset the proper data tags, then use this cli to register the asset. + +## Guide to publish an atomic asset using ArDrive-cli and `asset-registar` cli. + +### Setup + +> Requires NodeJS - https://nodejs.org and jq - https://jqlang.github.io/jq/download/ + +``` +npm i -g ardrive-cli +npm i -g asset-registar +``` + +### Create Atomic Assets Tags + +Using a text editor, we want to create a new file called `data.json` and in this new file add the following: + +```json +{ + "dataGqlTags": { + "Type": "ASSET_TYPE_HERE", + "Title": "TITLE_HERE", + "Description": "DESCRIPTION_HERE", + "License": "yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8", + "App-Name": "SmartWeaveContract", + "App-Version": "0.3.0", + "Contract-Src": "Of9pi--Gj7hCTawhgxOwbuWnFI1h24TTgO5pw8ENJNQ", + "Indexed-By": "ucm", + "Init-State": "{ \"ticker\": \"ATOMIC\", \"name\": \"ASSET_NAME_HERE\", \"balances\": { \"YOUR_WALLET_ADDRESS\": UNITS_HERE }, \"claimable\": [] }" + } +} +``` + +Now that you have your tags initialized you need to take every uppercase word and replace it with the values that are unique to your asset. + +ASSET_TYPE_HERE: + +This should be a one word description of your asset, "image", "audio", "video". etc. + +TITLE_HERE: + +A title that describes your asset, it should not be longer than 150 characters. + +DESCRIPTION_HERE: + +A description that you want to show up in search results or list results for your asset. + +ASSET_NAME_HERE: + +The name of your asset, in one word or connected with dashes ex. "AA-ALIEN-WITH-BEER". + +YOUR_WALLET_ADDRESS: + +The wallet address you want to give ownership too. + +UNITS_HERE: + +The number of fractional units you want to provide for this asset, if there can only be one owner then the replace with 1, if you want 100 owners replace with 100. + +save the file as `data.json` + +### Copy the asset you want to publish to this directory. + +--- + +### Uploading with new arweave wallet. + +Create a wallet or copy your wallet.json here. + +```sh +ardrive generate-seedphrase +# copy the seed phrase that is in the output and include in the next command where the `...` are. +# generate wallet +ardrive generate-wallet -s "..." > wallet.json +``` + +Using `ardrive-cli` we are going to create a drive and a folder. + +```sh +# create drive and folder +export FOLDER=$(ardrive create-drive -w ./wallet.json -n "My Atomic Assets" --turbo | jq -r '.created[] | select(.type == "folder").entityId') +# upload atomic asset +export ASSET=$(ardrive upload-file -w ./wallet.json -F ${FOLDER} --metadata-file ./data.json -l ASSET_FILE_HERE --turbo | jq -r '.created[] | select(.type == "file").dataTxId') +``` + +> NOTE: if your file is larger than 500k, you will need to add credits to your ardrive wallet, you can do this by going to https://ardrive.io and logging in with your wallet file. + + +### Register asset + +Once the asset is uploaded with the Atomic Asset Tags, now all you have to do is call `asset-register ` + +```sh +asset-registar ${ASSET} +``` + +### CONGRATS! + +You should be able to find your asset on ar://bazar by typing in the contractId in the search bar. \ No newline at end of file diff --git a/docs/src/guides/smartweave/atomic-assets/index.md b/docs/src/guides/smartweave/atomic-assets/index.md new file mode 100644 index 00000000..0bc65780 --- /dev/null +++ b/docs/src/guides/smartweave/atomic-assets/index.md @@ -0,0 +1,12 @@ +# Atomic Assets + +An atomic asset is a unique package that includes data, labels (also known as tags), and a specific agreement, all under a single, unchangeable identifier. This allows applications and users to access the data, labels, and agreement by using just this one identifier. + +To enable trading of the Atomic Asset, we must connect it to something called a SmartWeave Token. This connection transforms the asset into what's known as an Atomic Token and allows it to be exchanged or traded. + +The SmartWeave Token has a special feature called a balances object that keeps track of who owns the tokens related to that particular asset. This ensures that ownership and trades are recorded and managed accurately. + +## Deploying Atomic Assets + + +* [using ArDrive CLI](ardrive-cli) \ No newline at end of file