The Penny Oracle on Theta

The Penny Oracle for Tfuel is now auto-updated. When the price changes more then 3% over 4 hours, the blockchain gets updated.

Been wanting to write this update for a long time. The Penny Oracle that I launched on the Theta blockchain is now auto-updated. In other words, I no longer have to manually update the price for minting any of my NFTs in any of my projects. This automation is a huge psychological win for me. Kinda makes me feel like the code is actually doing something useful.

Note that all the projects that use the Selene Network (distributed sales network) NFT functionality use a Penny Oracle. And, in order for a creator to stay in charge of their project pricing, they would either launch their own, or use a trusted Penny Oracle. If they use my official one, the price is kept current (automagically).

What is a Penny Oracle?

The Penny Oracle provides the amount of Wei that represents a penny’s worth of Tfuel.

Why is it useful?

People that visit my projects think in dollar terms. The Penny Oracle is used by the smart contracts so that they have a current ‘close enough’ representation of the amount of tfuel that it takes to buy their NFT.

By having a relatively accurate price for my NFTs, the value exchange that I’m looking for can be stated in dollar terms rather than Tfuel Wei.

How does this magic work?

The first step comes from a little program that makes API calls to a number of different exchanges that allow for the trading of different Tfuel pairs. From that, the software determines the average price at that current moment. If the code determines that the price has change enough, (three percent from the previous recorded price,) it signs a transaction and posts it to the block chain.

How can you view this?

Well, here is the contract address for the Penny Oracle Version 1:

0x945c5b985a0d4ba6c42a88c1330bded9cd442389

If you look at it’s transactions, you can see that the automation has just recently started. Each time the smart contract is updated, the price averaging code sends the current dollar price of Tfuel and the Wei that represents a penny’s worth of Tfuel.

If you want to view the values that are reported by the smart contract, you can do so by visiting the Interact with a Smart Contract page on ThetaScan.io and use the following ABI to go with the contract address above.

ABI:

[{“inputs”: [],”name”: “pennyPriceTfuel”,”outputs”: [{“internalType”: “uint256″,”name”: “_pennyTfuelWei”,”type”: “uint256”},{“internalType”: “string”,”name”: “_priceOfTfuel”,”type”: “string”}],”stateMutability”: “view”,”type”: “function”}]

When you read this function (pennyPriceTfuel) you’ll see that it returns two items: _pennyTfuelWei and _priceOfTfuel.

How robust is this?

Would like to say that it’s failsafe, but nothing is.

In order for the Penny Oracle to get updated, the software on my machine has to run. With means, if the power grid goes down for me, the Penny Oracle will still report the older update.

The current design limits the number of updates to no more than 1 time every four hours and only if the price has moved more than 3% from the last recorded time. Simulation testing has shown that on average, the price will get updated about every 14 hours.

It shouldn’t take long before there will be enough transactions on chain to confirm this average update period.

The best news is that I’m motivated to make sure that this Penny Oracle stays current for the price it reports is what all my projects use.

What’s next?

Now that this automation is running, it’s time to refocus on smart contract functionality. It’s time to have a little fun with things. 

A Theta Hackathon project – Selene Network

Today, I officially entered the blockchain based distributed sales network(dsn) in the Theta Hackathon as the SeleneNet project. I’m going to call is SelNet for short.

Here is a link: https://devpost.com/software/amorstyle-distributed-sales-network-selnet

If you missed my previous blog post, this dsn is flexible opt-in sales system that empowers creators to incentivize sales through influencers bypassing standard centralized marketing approaches.

In this system, creators determine the sales commission and influencers determine if it is worth talking about. Settlement happens at the time of minting and as long as the sales goals are met, there is no restriction on capturing the rewards.  

In really simple terms, if you are an influencer and you like talking about cool NFT projects, this is a way to get paid if people mint based on your endorsement as long as the NFT project build to this protocol.

Support my work!

In order to show off how it works, I created a time limited mintable NFT that can be minted throughout the Hackathon (last mintable block number: 26243000 ). This NFT pays 50% of the mint Tfuel to any Agent that makes the sale. It also pays 5% to any website that offers access to the network.

To qualify for this commission, you have to get registered as an Agent or a website. If you want to build a sales force, you mint an Agent NFT. If you just want to endorse projects and capture the commission, you need to find someone that is willing to register your MetaMask compatible Theta Network address into the Agent system.

To learn more about becoming an Agent, check out the Agent information that I’ve linked too on my website.

Agent project overview

If you have a server and you want to provide access to SeleneNet compatible NFT contracts, talk to me about getting a Website NFT.

Website project overview

Mint: Hack it 2024

Second NFT in project

I’ve added a second Selene Network compatible NFT to the project. This one is a NFT that demonstrates how to display secret information after signature verification. In this case, the server protects a file and once the signature validation has occurred, the user is presented with a link to the document.

To read the whitepaper or get a better understanding for what it offers, visit the minting link.

Mint: DRM Anything NFT

I want to support you!

The other part about this project is that it needs people to build and deploy projects that are SeleneNet compatible. For most people, this can be technically challenging or, even worse, daunting. I’m here to help simplify this. The infrastructure that I’ve created takes a lot of the complexity out of the process.

If you already know that creating a simple NFT is something that you need, pitch me your idea and I can help you realize the benefits of this decentralized sales network infrastructure.

If you are an influencer, getting setup as an Agent is another option. Nothing better than getting paid to talk about things that you already love.

Minimum requirements

It should be obvious, but the smart contracts and NFTs are all built on the Theta blockchain and require that anyone interacting with the network use MetaMask. It’s pretty easy to setup, search for the official MetaMask website and download the browser extension that works for you.

Once you install, you’ll need to make your MetaMask wallet Theta blockchain aware. After doing that, you’ll need to acquire some Tfuel, most likely through a decentralized exchange.

Unfortunately, when it comes to using the technology, the customer has to show this basic level of technical understanding. This is one of the reasons why the network checks for the Participant NFT in the connecting wallet. The thinking is, if the customer can’t get this far, they will not be able to use the NFT as designed by the creator.

The good news is that MetaMask currently have over a million customers and they are working to solve that onboarding issue. As they solve that issue, more customers will be available to use the network.

What’s Next?

If participating in a network like this appeals to you, feel free to contact me. Best way is via my twitter handle: @AmorStyleYoga.

If you’re an influencer and you love the Theta blockchain or NFT projects on the Theta blockchain, let the creators know that this network is available so they can drive sales through the people that teach people about the projects. It’s an Opt-In system!

AmorStyle Distributed Sales Network NFTs

The next thing that I would like to introduce is a collection smart contracts that work together to handle settlement for a distributed sales network on the Theta blockchain. I’ve been calling it The AmorStyle Distributed Sales Network.

The idea is to incentivize more people to want to get involved in NFT projects. The incentive comes from NFT project creators providing a cut of the NFT mint. The NFT project creator offers that cut based on what they determine is reasonable for their project. The smart contract publishes that cut so that agents of the network can determine if talking about that project is worth the effort.

When a customer mints an NFT in the creator’s project, the smart contract carves up the mint funds as stated by the creator. Effectively, the NFT manages the cuts for the different agents and allows only that agent to claim the commissions.

As more creators learn that cool functionality can be enabled, or leveraged, using smart contracts, more of them will want to offer their services in an online fashion like this.

How does it all work?

First and foremost, this is a network of people that are all agreeing to work together in a semi-trustless way and the quality of what is offered is directly related to the amount of effort that different players offer to the network.

This network assumes there are Content Creators, Influencers, Technical people and Customers.

The Content Creators are the NFT projects. They offer up commissions to the agents and technical people to support their projects. They publish the minting cuts in order to incentivize the influencers to talk about their projects.

The Influencers are the Agents of the network. When you are a registered agent, any time someone mints using your Agent Id, you get the cut stated by the Content Creator. It’s handled by the smart contract.

The Technical people are those that provide websites and smart contract services for Content Creators. In order to talk to Smart Contracts, it needs to be handled by a website. And, because this is a network, would be better if multiple websites offer access to the content.

Can I see the code?

All the code for this project is currently published on this website. And, I’ve created the Gallery TestUI V1 project as a live demo.

Here are links to more info:

The Participant NFT

The Website NFT

The Agent NFT

The Gallery Project

Note that The Gallery is where I’m demonstrating this project. Please visit that link.

More Info

Even though this project is published and available for anyone to read or implement. I will be fielding questions in the TraderPunk discord. If you want to know the gritty details or get help as a Content Creator, please look me up.

Membership Demo newFunctionaliTee

Have you heard about Kalamazoo? If not, have I got a story for you!

For this demo project, I wrote a little JavaScript to go along with the two new NFTs that are now on the Theta blockchain.

And, even though the mint is unlimited, there will only be 42 winners awarded! It’s a first come, first served winning spree, so once you understand the concept, make sure you read how to win! (below at claim prize).

Kalamazoo

The main NFT is the Kalamazoo membership demo. This NFT simulates buying a club membership that costs a penny an hour. When a member signs up, there is a joining fee of $0.25 and the requirement that the purchaser funds at least 100 hours’ worth of membership time.

To do this, I wrote some ‘treasury’ code in the smart contract that allows the NFT owner to manage his Tfuel balance. Anyone can add Tfuel to an NFT, but only the owner of that NFT can withdraw the balance. At any time, anyone can query in order to determine how much tfuel balance is left. If there is a balance, the membership is considered active. If funds backing the token run dry, the owner of the NFT (or anyone else) can reactivate the NFT by placing funds on that account.

The fee associated with minting, reactivation and membership is credited to “The Titled” person (or account). The contract has the idea that there is a project owner and an IT owner. The project owner is considered the property owner, thus is credited the funds associated with the project. The IT owner is allowed to operate admin functionality in the smart contract on behalf of the property owner but can’t claim any funds.

Said differently, funds are managed by token Id. If you put 50 Tfuel on your token that will be used to pay your membership balance over time. But, if you transfer your token to someone else, they will now have ownership of that Tfuel balance which effectively gives them the hours that you just bought. In a way, the Token now has intrinsic value based on the number of hours of membership time it can buy.

Penny Oracle V1

I also created a contract that can be used to provide the current cost of a penny’s worth of Tfuel. The Kalamazoo contract uses the Penny Oracle V1 in order to determine the dollar price for membership.

This means that the value in the treasury buys more or less time as the price of Tfuel fluctuates. If tfuel goes to a dollar, the Kalamazoo membership will only charge a penny’s worth of tfuel per hour.

(* There is also a concept of claiming which cements the running calculations. If you want to learn the details, find me in the TraderPunks discord.)

Summary

If I were to spin this contract up again, there are some things that I would do differently. The most obvious thing is to write fewer functions in the smart contract.

Why? Well, Solidity and JavaScript allow for returning multiple values on a call. When loading a page for a website, each call adds to the load time. Thus, rather then call a bunch of small routines to get the ‘status’ of the NFT, it makes more sense to call a getStatus() type routine that returns everything at once.

So, how to you take a closer look?

Kalamazoo Membership

The best way to get involved is to visit the minting page:

Mint Page Here

Oh, and read the whitepaper.

Also, this is a demo, so cut it some slack. The best thing you can do is copy the project and put out something better. If not, help me make it better. 

Claim Prize

To win the prize, you have to follow a specific set of steps in order to be allowed to claim a winning position. These steps are designed to show you how to mint, withdraw your balance, reactivate and monitor your remaining hours.

Basically, when there are 15 hours left on your membership balance, the Claim Prize button will activate on the minting page. If there is still a position open, you will be assigned that position and the token will enter the winner’s circle.

The easiest way to get there is to mint, withdraw your balance and then reactivate with enough Tfuel to cover the $0.10 reactivation fee and another $0.15 to enable 15 hours’ worth of membership time. If you get that correct, the minting page will enable the Claim Prize button and you can ‘win’ if you want.

SendLock newFunctionaliTee

Mint Link Below

Mint

As NFTs evolve to provide more services, the loss of that resource (or what that NFT grants access too) could cause significant emotional or even financial hardship.

This next Theta blockchain based NFT introduces a modification to the standard transfer design in 721 contracts that can be employed by NFT creators that will help protect the NFT resource in the case of the account being hacked.

When websites offer functionality that requires a ‘hot’ wallet (one that is always connected, or wallets where the user remains logged in for extended periods of time (like Metamask)) it opens up situations where family members or co-workers could find ways to access your resources.

Or, regardless of the wallet state, if someone else gets a copy of your private keys, they have complete access to your resources. If multiple people hold the same private keys, both people have full access to the resources of that wallet. If one is a hacker, chances are high you will lose everything you store in that wallet.

To help mitigate the damage done by less secure crypto wallets (and environments), the SendLock newFunctionaliTee contract allows the resource owner to register (or cash) the next transfer operation for the NFT before any damage can be done by a hacker.

The idea is like this:

  • Mint the NFT
  • Put the NFT in the wallet where you’ll use it
  • Perform a sendLockRegister() call giving it your backup wallet

Now, the next time a send operation is executed on this NFT, the contract will move it to the cashed location – NOT the requested location. And, once it’s been set, it can’t be unset. Thus, the hacker will not be able to override this functionality.

I encourage you to give it a try with this sample NFT. It cost 5 tfuel to mint, 3 tfuel to ‘flip’ the coin and 1 tfuel to register the SendLock wallet.

Here are some links to the SendLock NFT.

Contract Address: 0x738acc1ecf2339079c54a8bf8fc47aa3535bb65f

Minting Page

Whitepaper

Metadata Hash – newFunctionaliTee

Tada!

In celebration of my ’24 New Years goals, I’ve launched my first ‘official’ New Functionali-Tee smart contract on the Theta blockchain. I’m calling it the Metadata Hash NFT which shows a technique by which an NFT project author can demonstrate file authenticity while using a private server.
Mint Here!

Why?

Well, I’ve put some thought into the whole InterPlanetary File System (IPFS) idea and it doesn’t really make sense to store somethings forever. Imagine if the concert you went to in ’84 was an NFT and the ticket was an NFT that was issued and redeemed within a couple months. Would it make sense to have that digital garbage still hanging around 40 years later? Probably not. Seems like a waste of global resources.

But, if you were the chairman of the band’s fanclub you would probably want to save all that original data. If you do, the cost of ownership is local and most likely manageable.

The complication comes when proving you hold the original data.

Blockchains help with this. If you hash a file and then store that hash on the blockchain, it doesn’t matter who owns the file or where it is stored, if you have the original file you can prove it by generating the original hash.

This project takes advantage of this functionality by hashing all the files used to build this NFT and writing those hashes into a project file which is intern hashed. That final hash is stored on the blockchain.

If someone gets a copy of the root file (which holds all the hashes) they can prove that they have an original by hashing it. If the hash matches the blockchain value the file is unaltered. Then, all the hashes stored within that project file can be used to validate that all the other files (images, whitepaper, etc) are also unaltered.

This allows a level of verification that allows project creators to change servers and still prove they have the original files. This might allow an artist to sell his creation to a different company and that new owner can serve the project in a verifiable way.

In the end, the public cost is a hash on the blockchain.

The NewFunctionaliTee

Contract: 0x3af8d9df292ba083fb37d71df813f6d5ab0ad450

Whitepaper: https://amorstyle.com/nfts/metadatahash/whitepaper.pdf

Project: https://amorstyle.com/nfts/metadatahash/metadatahash.json

And, if you’d like to mint one of these NFTs, click HERE!

Example Sending coin via MetaMask

Here is an example of how to use Metamask to send some coin on the Theta network.

ChainId:
From:
BlockHeight:
Balance:

Amount of tfuel:
To:

Status:

Here is a downloadable ZIP file that contains the WordPress plugin code that integrates with Metamask.

This plugin installs just like any other WordPress plugin.

When you review the code, you’ll find a csendtobutton.js file that contains the class that handles the above shortcode.

Note that this is the next version of my tweb3mmexplore plugin. All the old functionality should continue to work as should this new ‘send’ functionality.

WP Plugin to Connect to MetaMask

As you might have noticed, this website now has the ability to connect to MetaMask. That functionality is implemented within a WordPress plugin that I provide the download link to below.

At this point, the plugin demonstrates two different functionalities.

  • The ability to dynamically connect to MetaMask, and
  • How to Sign a transaction.

The connect functionality is demonstrated via the button on the top right part of the website. Feel free to give that a try.

The Signing functionality is demonstrated here:

Sign Typed Data V4

Note that the phrase “Describe what’s being signed here” and the secret is placed in the page HTML by the server, thus it can be custom designed.

Why MetaMask?

MetaMask is a 3rd party crypto wallet application that empowers the users of a smart contract based blockchain to interact with websites in new and unique ways. Users create accounts in MetaMask and then link in MetaMask friendly websites. The linked website as the ability to ask for information from the wallet to allow interactions on the blockchain without the website needing to know anything about the user’s private keys.

When a website is ‘connected’ to MetaMask, the user is effectively ‘white listing’ the website with regards to it’s public address and balance.

When a connected website asks for something to be signed, the website calls MetaMask with the information to be signed and awaits the signature. Signatures can only be generated by wallets for it requires the knowledge of private keys. Thus, the website can get proof that you are the owner of a public address by asking for a signature.

Please note that it’s good practice to keep little or no crypto in the MetaMask wallet that you connect to random websites. Yes, any interaction that occurs from the website to MetaMask will require your response to complete, but common sense would say to reduce your risks by only keeping what is needed on that wallet.

About the Code

As with the other plugins that I create and share, this one is built off a template generated from https://wppb.me/. If you generate your own copy using my tag strings, you’ll be able to see the lines/files of code that I added.

One thing that I would really like to point out is that when I went looking for samples that would provide the ‘connect’ functionality, the sample plugins typically included dozens of additional add-in files or libraries that seemed overly complex to me. My coding philosophy is, if you don’t intellectually understand the code, you’re dependent upon some other person to make forward progress. Thus, I’ve made it a point to reduce the sample down to what is functionally needed.

A word of caution here, this is my first JavaScript code example. In the process of trying to figure out how to debug and use the MetaMask sample code, I ended up reading through the JavaScript manual online in order to get the higher-level understandings upon which I built upon.

Out of this, one of the more important features empowered by coders is the ability to use libraries or incorporate classes that have been created from other projects. Thus here, you’ll see I import code from ‘modules’.

The Plugin

Here is a downloadable link to the WordPress plugin.

Please read through the code before using to make sure you understand what’s going on. If you have feedback, please let me know.