An experimental script for running ICO-like events on Steem

in #steem-dev7 years ago (edited)

With a lot of talk happening around UIA (User Issued Assets) on Steem, I decided to spend a day experimenting with how we could use some of the existing data storage here on the Steem blockchain to actually run an ICO-like event. Without actually having smart contracts like ETH, the service itself I wrote is a sort of "fake" smart contract that runs much like a bot would, using steem-python. It's no where near as secure as a real smart contract however, as you actually have to trust the user running the script to do you right.

The source code is available here.

At this early of a stage, it's only function is to process incoming transactions, ensure they're valid, and make an trail of transactions that could then be audited to prove participation. The goal is to explore how we (as a community and as developers working with Steem) can raise funds to help kickstart projects without having to tap into the rewards pool so much. Imagine how much it would contribute to Steem's success if we had a dozen teams all working on their own individual (and funded) Steem platforms!

As a note, no one should expect to download this script and use it as is :)

Concepts & Theories

Channeling between two accounts

The current model I have setup uses two accounts, a donation account and a processed account. Each transaction between donation account sending to the processed account is considered as a "valid" donation for the purposes of these fake ICOs. Any funds that are just sent to the donation account while the script isn't running (to process it) or any donations send directly to the processed account would not be considered valid for the ICO, and would end up being purely untracked donations.

The donation account is a funnel which receives all donations for the project and processes their validity based on:

  • start block
  • end block
  • currency type (steem/sbd)

It also is the account that stores the state of the event within it's json_metadata. The donation account's goal is to never actually hold onto funds for more than a minute or so (while waiting for irreversible blocks), so that if it gets compromised, there are no funds within it.

The processed account is the final destination of all valid funds, and only funds sent from the donation account are considered valid. This account should have it's keys locked up tight (not in a script like this), and probably using multi-sig for it's owner/active keys.

State storage & persistence

Currently to maintain an index of donors, the script updates it's own state to the json_metadata of the donation account upon activity, at most once a minute. Any block explorer will show this data, and it would be very easy to build a live updating webpage for an ICO that just continually reloads the donation account and parses it's json_metadata. This provides an easy way to see who has donated and how much without having to replay the entire sequence of blocks to build an index.

Ideally, that's what should be done though, building an index that monitors the start and end blocks, then builds a donor list based on the transactions between the donation and processed accounts.

The json_metadata field has limitations, mainly related to the maximum block size on Steem. Quick estimates show that approximately 2000 account could donate using this method before the json_metadata field for the account fills up. So that's a challenge to overcome. Luckily since the transfer between the donation and processed accounts is the actual operation of record, the overall donation log could be audited and rebuilt even if it filled.

Bandwidth(gas) for transfers

The script is intelligent enough to queue/batch all transfers, and upon a failure to send, reports the failure within the console and retains the operation for when enough SP is available. Every 10-15 seconds it attempts to process all ops within the queue, and will process as many as it's currently allowed with it's bandwidth.

If the account itself see's a massive amount of transactions during the ICO - more SP may need to be delegated to the account in order to allow processing of all of the transactions.

Transferability & Tokens

This setup currently doesn't support the ability to transfer ownership of tokens OR even the existence of tokens.

The hope is that if UIA's end up coming to Steem, this workflow model could be adapted to actually issue tokens upon creation, thus solving both of these challenges.

Expanding into custom_json ops

Things could get very interesting with more work on this concept and the expansion into custom_json ops within the blockchain. The ops themselves are still bound to the limitations of the block size, but these ops could be used for transferring ownership (before UIAs), maintaining state, and setting parameters of the event.

Future Plans

I'm planning on continuing the exploration of these ideas, and am looking forward to seeing what sorts of ideas the community has around this concept. Making an announcement post and simply asking for donations works to some degree, but having a real system where we could run crowdfunding events for projects within the blockchain would be an incredible step forward.

Once I have a little more stable version of the script, I'll probably setup a test to stress-test the bot and it's performance to see how it does. Priorities are elsewhere for the time being though, so I'm not sure when I'll revisit the concept.

Sort:  

cool meanwhile project :) I can´t wait to play with the real deal, is gonna be awesome!!

... steemit

He obviously meant steam.

Can't wait for first successful ICO on Steemit.

bro I follow you and you follow me---

Why not just let people send funds to the donation account, and then lookup transaction history to determine which deposits were valid or not?
What problems does icomanager attempt to solve? I'm not sure I understand the concept.

You could definitely do that, and then by hand return all of the invalid funds and record which ones were valid into some sort of data store.

The goal here was to automate it like most smart contracts would do - sort of like an ERC20 token sale on ETH would.

I don't know that it specifically solves a problems though. It doesn't have to, it's an experiment and it was fun to write :)

Kudos to you for your work on steem-python, I've been enjoyin writing things like this in it!

You don't have to do anything by hand, you can just auto-refund invalid ones with a script.

Furthermore, if you want to have 2 accounts, you can pass references by including original deposit's trx_id, into a transfer's memo. Thus, you can move funds from donation to cold address without losing a reference to whom paid what.

In any case, these solutions are off-chain, and I think that mimicking a smart contract is an engineering overkill.

The things you outlined are exactly what this does... ? It's a script that auto refunds and auto transfers.

These solutions can absolutely be off chain - which I also outlined in my post. I didn't want to setup a database for this experiment so I choose to store the data on chain. I even outlined that these should be stored in an external index for scalability.

In any case, these solutions are off-chain, and I think that mimicking a smart contract is an engineering overkill.

Overkill is fun to do some times :)

I prefaced this whole thing stating this was an experiment and that I'm not even running the script for anything. I'm looking to spur discussion on how people could use the blockchain to accomplish fund raising, and provide some example scripts that might get peoples brains thinking. Nothin more!

Am I missing something her? @jesta do you work for Steemit inc? Seriously. Your work is becoming pretty fundamental to the survival and the success of this network and site.

I can not thank you enough and even though I'm actually short on cash, I would happily power down and donate half of my account holdings to you at this point.

You're changing the game. You're revolutionary.

I am not employed by Steemit Inc :)

I think within the Steem ecosystem there's room for potentially dozens/hundreds of individual businesses to operate. Look how many companies revolve and build services around BTC! It's my hope to eventually be one of those other companies, operating under some of the visions I have for Steem, and to continue building great community based platforms.

Thank you though! I'm just one cog in this grand machine. There's dozens of other people who's work I rely upon to enable me to build these sorts of things.

That's what I was hoping and I agree!

@jesta, I will openly admit I barely understand many of the technical items you discuss as it is out of my realm. But what I do recognize is the value you have provided the steemit community in the 11 months I have been here. Steemstats (which I use everyday) is big value add, along with everything else.

I thank you for it.

If you ever have any questions about personal finance, real estate or investing feel free to ask as that is what I am knowledgeable in. Least I could do after all you have done for the community. Steem on.

Just voted you for witness as well, didn't realize I hadn't already. Thanks again!

Thank you as well! It makes me pretty happy to know so many people find value and usefulness in the projects I put time into :)

Why do I follow you again? Oh, that's right, you educate me.
Thanks for the post.

Just quickly perusing the article and without looking at the code, one question arises: why don't you use the native escrow function of the blockchain? And then using the custom_json layers for further meta-data, if need will be? Just curious.

Anyway, kudoz and thanks for all your hardwork here, @jesta!

Honestly I didn't even think about it. That'd be a pretty interesting use case for escrow.

Yeap, that's what I thought too. Btw, sent you a DM in chat, maybe you'll have time to look. Thanks.

This is huge, again! What a great idea and you are making it all happen. You rock!!!

Thanks for sharing the wealth of information with us and keeping us up-to-date with the news. Namaste :)

Fuck yeah! Building the foundation of Steem v2. I envy your skills.