Coder Social home page Coder Social logo

aothecomputer's Introduction

Official Links

Preparations

https://cookbook_ao.g8way.io/tutorials/begin/preparations.html

Installing Dependecies

sudo apt-get update && sudo apt-get install wget ca-certificates
NODE_MAJOR=18
sudo apt-get update
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs

Installing aos

sudo npm i -g https://get_ao.g8way.io

Run aos

aos
  • This Create a main and unique aos Proccess ID for you
  • Press Ctrl+C twice to exit aos chat

CRED and Quests

https://cookbook_ao.g8way.io/welcome/testnet-info/cred-and-quests.html

Join Dev chat

.load-blueprint chat

List Rooms

List()

Join Quests room

Join("Quests")

Create a nickname

  • you can replace nickname
Join("Getting-Started", "nickname")

Check Quests and CRED lists

Say("/Quests", "Quests")

Check Details of a Quest

Say("/Quests:1", "Quests")
  • Press Ctrl+C twice to exit aos chat

"Quest 1 : Begin" Guide


Messaging

https://cookbook_ao.g8way.io/tutorials/begin/messaging.html

Run aos

aos

Send a Message

Send({ Target = "process ID", Data = "Hello World!" })

Store Morpheus's Process ID

Morpheus = "wu_tAUDUveetQZpcN8UxHt51d9dyUkI4Z-MfQV8LnUU"

Check the Morpheus Variable

Morpheus

Send a Message to Morpheus

Send({ Target = Morpheus, Data = "Morpheus?" })

Check your Inbox

  • when you send a message to the bots, you get a message in your inbox
Inbox[#Inbox].Data

Send a Message to Morpheus with tags

Send({ Target = Morpheus, Data = "Code: rabbithole", Action = "Unlock" })

Create lua Chatroom

https://cookbook_ao.g8way.io/tutorials/begin/chatroom.html

  • We have to create a file so better you not exit the aos and open a new terminal tab with +

Create a file for lua Chatroom

nano chatroom.lua

Paste these codes to the files

Members = Members or {}
Handlers.add(
    "Register",
    Handlers.utils.hasMatchingTag("Action", "Register"),
    function (msg)
      table.insert(Members, msg.From)
      Handlers.utils.reply("registered")(msg)
    end
  )
  Handlers.add(
    "Broadcast",
    Handlers.utils.hasMatchingTag("Action", "Broadcast"),
    function (msg)
      for _, recipient in ipairs(Members) do
        ao.send({Target = recipient, Data = msg.Data})
      end
      Handlers.utils.reply("Broadcasted.")(msg)
    end
  )

Ctrl + X / Y / Enter

Reload Lua Chatroom

  • Go back to aos terminal
.load chatroom.lua

Check your lua Chatroom

 Handlers.list

Register our proccess ID to lua Chatroom

 Send({ Target = ao.id, Action = "Register" })

Check lua Chatroom members

 Members
  • You see your proccess ID joined the chat

Broadcast your first massage to the chatroom

  Send({Target = ao.id, Action = "Broadcast", Data = "Broadcasting My 1st Message" })

Invite Morpheus to the Chatroom

Send({ Target = Morpheus, Action = "Join" })

Check lua Chatroom members (Morpheus Added)

 Members

Check your Inbox

  • when you invited Morpheus to the Chatroom he sent you Trinity ID in your Inbox
Inbox[#Inbox].Data
  • Copy Trinity Proccess ID

Store Trinity's Process ID

  • Paste Trinity Process ID in the command below first then store it
Trinity = "Paste_your_Proccess_ID"

Invite Trinity to the Chatroom

Send({ Target = Trinity, Action = "Join" })

Check lua Chatroom members (Trinity Added)

 Members
  • Now you should have 3 Proccess IDs in the members

Build a Token

https://cookbook_ao.g8way.io/tutorials/begin/token.html

Join Token Chatroom

.load-blueprint token

Verify the Chat is loaded

Handlers.list
  • You should see a new list of handlers that have been loaded into your aos process

Testing the Token

Send({ Target = ao.id, Action = "Info" })

Sending 1000 Tokens to Trinity

Send({ Target = ao.id, Action = "Transfer", Recipient = Trinity, Quantity = "1000"})

TokenGating

https://cookbook_ao.g8way.io/tutorials/begin/tokengating.html

Edit your Broadcast handler

  • Open a new terminal without aos
nano chatroom.lua
  • Delete all the lines and paste the code below into it
Members = Members or {}
Handlers.add(
    "Register",
    Handlers.utils.hasMatchingTag("Action", "Register"),
    function (msg)
      table.insert(Members, msg.From)
      Handlers.utils.reply("registered")(msg)
    end
  )
Handlers.add(
    "Broadcast",
    Handlers.utils.hasMatchingTag("Action", "Broadcast"),
    function(m)
        if Balances[m.From] == nil or tonumber(Balances[m.From]) < 1 then
            print("UNAUTH REQ: " .. m.From)
            return
        end
        local type = m.Type or "Normal"
        print("Broadcasting message from " .. m.From .. ". Content: " .. m.Data)
        for i = 1, #Members, 1 do
            ao.send({
                Target = Members[i],
                Action = "Broadcasted",
                Broadcaster = m.From,
                Data = m.Data
            })
        end
    end
)

Ctrl+X / Y / Enter

Reload the chatroom.lua file

  • Go back to aos terminal
.load chatroom.lua

Test the Tokengate

Send({ Target = ao.id , Action = "Broadcast", Data = "Hello" })

Expected Results:

message added to outbox
New Message From [Your Process ID]: Action = Broadcasted
Broadcasting message from [Your Process ID]. Content: Hello.

Testing from another Process ID

  • Create a new Terminal to make a new proccess ID
aos chatroom-no-token
.load chatroom.lua
Send({ Target = ao.id, Action = "Register" })
Send({ Target = ao.id , Action = "Broadcast", Data = "Hello?" })

Tell Trinity "It is done"

  • Go back to your main aos terminal
Send({ Target = ao.id , Action = "Broadcast", Data = "It is done" })
  • Wait 30 seconds and Trinity will send you a messege saying "I guess Morpheus was right. You are the one. Consider me impressed. You are now ready to join The Construct, an exclusive chatroom available to only those that have completed this tutorial. Now, go join the others by using the same tag you used Register, with this process ID: jg2Duezl68c8lHU5RiV8kHZrZ-7MJSVyyfQDhz5nJqQ Good luck. -Trinity". Additionally, a footer will follow the message.

You Are done now you have to

  1. Join Construct Chat
  2. Download arconnect wallet and import .aos.json
  3. Conncet wallet and twitter to https://vouch-twitter.arweave.dev
  4. Send your discord-ID to Trinityz
  5. Post your main aos Proccess ID in #q1-claims discord channel

1) Join Construct Chat

Send({Target = "jg2Duezl68c8lHU5RiV8kHZrZ-7MJSVyyfQDhz5nJqQ", Action = "Register"})

2) Download arconnect wallet and import .aos.json

  • ArWallet
  • if you are using WSL the .aos.json is located here: \wsl.localhost\Ubuntu\home\

3) Conncet wallet and twitter and submit a vouch

4) Send your discord-ID to Trinity

Send({ Target = Trinity, Action = "Claim", Data = "Your-Discord-Username" })

Check Your CRED Balance to see if your received CRED reward

Send({ Target = "Sa0iBLPNyJQrwpTTG-tWLQU-1QeUAJA73DdxGGiKoJc", Action = "Balance" })

Send your CRED from your process ID (Contract) to the wallet

  • it sends 6 CRED to WALLET_ADDRESS
Send({ Target = "Sa0iBLPNyJQrwpTTG-tWLQU-1QeUAJA73DdxGGiKoJc", Action = "Transfer", Recipient = "WALLET_ADDRESS", Quantity = "6000"})

aothecomputer's People

Contributors

0xmoei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.