The Pay with crypto demo v1

In this latest Selene Network NFT project, I’m demonstrating how a project can accept one currency and then mint an NFT on the Theta blockchain.

The basic idea is built around the following fictitious scenario.

Scenarios

A musician wants to tokengate his discord channel so that only paying fans are allowed in. The musician downloads this demo code and launches his own version of the contract on the Theta blockchain. Because it provides all the interfaces needed for the Selene Network code, it displays perfectly fine for his fans. He knows that a few of his fans are Agents in the network so he pays 15% commissions on a $250 NFT. Knowing that a bulk of the people what support his music are also huge Ethereum fans, he chooses to accept ETH for minting (along with the standard Tfuel). He then funds the Theta blockchain account that performs the minting and the buttons are enabled in the webpage. At this point, the musician announces to the world that his fan-club NFTs can be minted using Metamask.

Details

At this point, the demonstration of this end-to-end solution is in action. Please go mint all the different versions of the NFT.

The complication is that the minting is done by an off-chain oracle that runs on a 15-minute heartbeat. The environment needed to run this local server is unique to developing web-based projects, thus my system is the only one currently setup to perform this background processing which results in the mint.

It wouldn’t take much to develop that backend solution, but that work won’t be done unless people like the direction of this project. You know, if there is a need, there is a solution.

So, if you like where this project is going, but the NFT and tell a friend. If enough people like this functionality, I might be motivated to develop the backend into something anyone could run and use.

Take a look at the Project

Pay with Crypto Demo V1

One last thing

I’ve designed this demo so that when you mint the NFT, you get a different image based upon the currency that you use to pay. And, if I add new payment methods, I can add new payment images to reflect that additional functionality. Thus, collect them all!

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 can you help?

The wallet that broadcasts the updates for the Penny Oracle is projected to burn through 125 Tfuel per year. Because this is publicly accessible for any smart contract on chain, if you find it valuable, please support the project.

The Wallet that performs the broadcast updates would be gracious for you Tfuel love:

0x5673DdA6820E986F6fC77087504873B116A4D52c

If I can raise more than one thousand Tfuel, I’ll see about modifying this code to update other crypto currencies too.

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. 

Marketplace Solutions for the NFT Creator

The old-school brick-&-mortar approach of forcing a creator to ‘fit the mold’ with regards to content creation and distribution is quickly becoming a thing of the past. As technology advances, more creators are going to find that there are alternative paths for content distribution that don’t involve large, centralized organizations.

Ultimately, I’d love to see more creators leverage the power of blockchain to incentivize perfectly good strangers to sell their project for them. This is why I put together the Selene Network (DSN). The network protocols allow creators to own and manage their content while also incentivizing others in a trustless manner.

The latest addition to my Selene Network collection of demos is the ‘NFT with Marketplace demo Version 1’ (see the display section on this page). This NFT has a built-in secondary marketplace.

Imagine being a creator and offering a NFT collection that represents 100 pieces of something unique. Say, every day the creator posts something new to the collection. If this demo code is used (and slightly modified), not only would the creator be able to incentivize sales, but they would have a built-in marketplace where the unique items could trade.

No need for a third party centralized website. Instead, the functionality can be served right off the creator’s own website where there is a high level of trust in the content (and means to the content).

Take a look

MarketPlace Demo V1

So, install MetaMask and instruct it to connect to the Theta Network. Once you have, connect it to this website (AmorStyle.com) and visit the links in the display block above.

If you would like to see other examples built on the Selene Network core code, visit the Gallery.

Contacts

Feel free to tag me on Twitter @AmorStyleYoga. Every sample that I create is available for download and review. See the project JSON file for details.