https://cookbook_ao.g8way.io/tutorials/begin/preparations.html
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
sudo npm i -g https://get_ao.g8way.io
aos
- This Create a main and unique aos Proccess ID for you
- Press Ctrl+C twice to exit aos chat
https://cookbook_ao.g8way.io/welcome/testnet-info/cred-and-quests.html
.load-blueprint chat
List()
Join("Quests")
- you can replace nickname
Join("Getting-Started", "nickname")
Say("/Quests", "Quests")
Say("/Quests:1", "Quests")
- Press Ctrl+C twice to exit aos chat
https://cookbook_ao.g8way.io/tutorials/begin/messaging.html
aos
Send({ Target = "process ID", Data = "Hello World!" })
Morpheus = "wu_tAUDUveetQZpcN8UxHt51d9dyUkI4Z-MfQV8LnUU"
Morpheus
Send({ Target = Morpheus, Data = "Morpheus?" })
- when you send a message to the bots, you get a message in your inbox
Inbox[#Inbox].Data
Send({ Target = Morpheus, Data = "Code: rabbithole", Action = "Unlock" })
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 +
nano chatroom.lua
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
- Go back to aos terminal
.load chatroom.lua
Handlers.list
Send({ Target = ao.id, Action = "Register" })
Members
- You see your proccess ID joined the chat
Send({Target = ao.id, Action = "Broadcast", Data = "Broadcasting My 1st Message" })
Send({ Target = Morpheus, Action = "Join" })
Members
- when you invited Morpheus to the Chatroom he sent you Trinity ID in your Inbox
Inbox[#Inbox].Data
- Copy Trinity Proccess ID
- Paste Trinity Process ID in the command below first then store it
Trinity = "Paste_your_Proccess_ID"
Send({ Target = Trinity, Action = "Join" })
Members
- Now you should have 3 Proccess IDs in the members
https://cookbook_ao.g8way.io/tutorials/begin/token.html
.load-blueprint token
Handlers.list
- You should see a new list of handlers that have been loaded into your aos process
Send({ Target = ao.id, Action = "Info" })
Send({ Target = ao.id, Action = "Transfer", Recipient = Trinity, Quantity = "1000"})
https://cookbook_ao.g8way.io/tutorials/begin/tokengating.html
- 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
- Go back to aos terminal
.load chatroom.lua
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.
- 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?" })
- 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
- Join Construct Chat
- Download arconnect wallet and import .aos.json
- Conncet wallet and twitter to https://vouch-twitter.arweave.dev
- Send your discord-ID to Trinityz
- Post your main aos Proccess ID in #q1-claims discord channel
Send({Target = "jg2Duezl68c8lHU5RiV8kHZrZ-7MJSVyyfQDhz5nJqQ", Action = "Register"})
- ArWallet
- if you are using WSL the .aos.json is located here: \wsl.localhost\Ubuntu\home\
Send({ Target = Trinity, Action = "Claim", Data = "Your-Discord-Username" })
Send({ Target = "Sa0iBLPNyJQrwpTTG-tWLQU-1QeUAJA73DdxGGiKoJc", Action = "Balance" })
- it sends 6 CRED to WALLET_ADDRESS
Send({ Target = "Sa0iBLPNyJQrwpTTG-tWLQU-1QeUAJA73DdxGGiKoJc", Action = "Transfer", Recipient = "WALLET_ADDRESS", Quantity = "6000"})