Giter Site home page Giter Site logo

harpagon210 / steemsmartcontracts Goto Github PK

View Code? Open in Web Editor NEW
45.0 7.0 25.0 1.6 MB

javascript blockchain/sidechain powered by Steem

Home Page: https://github.com/harpagon210/steemsmartcontracts/wiki

License: MIT License

JavaScript 99.91% Shell 0.09%
steem blockchain sidechain smart-contracts

steemsmartcontracts's People

Contributors

bt-cryptomancer avatar harpagon210 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

steemsmartcontracts's Issues

[Question] Integrate with VSC

Is there anyway to integrate with Visual Studio Code for suggestions? Regarding smart contract available APIs. Is there an npm package that contains the definitions for available APIs?

Full Sidechain Replay Polling Times

As a private node operator, I would like to build the sidechain with my own local steemd node (without a third party blocks.log file), so that I can verify the sidechain.

The problem is that, by default, it now takes about three days to rebuild the sidechain using nothing but steemd as a source for transactions. This will only get longer over time.

It is possible to reduce the replay time from three days to about 8 hours if you modify the source code:

constructor(nodeUrl, currentBlock, antiForkBufferMaxSize = 2, pollingTime = 200) {

blockPoller = setTimeout(() => getBlock(reject), 100);

So, normally, when it's all caught up, 200 (libs) and 100 (plugins) seems fine (as addressed in issue: #18). But when rebuilding the entire sidechain from steemd, pooling takes too long.

For example, if the polling time is modified to 20/10, this significantly reduces the time it takes to rebuild the sidechain from steemd. However, I am not suggesting that we change these polling times to something static. Instead, I'm recommending that it become calculated, based on how far behind main chain streaming is.

Normal SIGTERM Shutdown Fails (on ^C)

As a private node operator, I would like to be able to stop my node cleanly, so I don't have to worry that config.json is wrong.

Most of the time, when a node is running perfectly normal for hours or days (npm run start), when using ^C to stop the node, config.json is not saved with the correct value in startSteemBlock. If the node operator does not catch this situation, they're likely to start the node again and end up with duplicate blocks.

Contract Action Batch

As a token issuer, I would like to be able to express a batch of contract actions, so that I can get around one-block-per-account-per-custom-json.

The condition in question is:

if (contractName && typeof contractName === 'string'
&& contractAction && typeof contractAction === 'string'
&& contractPayload && typeof contractPayload === 'object') {

E.g., a second case for when contractPayload === 'list' (I think?). Or just make single-actions become one-element batches directly outside this condition.

Preferred example:

{
   "required_auths":[
      "inertia"
   ],
   "required_posting_auths":[

   ],
   "id":"ssc-00000000000000000002",
   "json":"[{\"contractName\":\"tokens\",\"contractAction\":\"issue\",\"contractPayload\":{\"symbol\":\"SPAMMY\",\"to\":\"mack-bot\",\"quantity\":0.00139503,\"memo\":\"@chucha530/6o2xgq\"}},{\"contractName\":\"tokens\",\"contractAction\":\"issue\",\"contractPayload\":{\"symbol\":\"SPAMMY\",\"to\":\"prowler\",\"quantity\":8.4e-07,\"memo\":\"@chucha530/6o2xgq\"}},{\"contractName\":\"tokens\",\"contractAction\":\"issue\",\"contractPayload\":{\"symbol\":\"SPAMMY\",\"to\":\"spaminator\",\"quantity\":0.9972102,\"memo\":\"@chucha530/6o2xgq\"}}]"
}

Notice, I'm passing an array ([]) to json that contains three actions, instead of a single object ({}) with a single action.

Full Sidechain Replay Memory Usage

As a private node operator, I would like to build the sidechain with my own local steemd node (without a third party blocks.log file), so that I can verify the sidechain.

The problem is that, by default, it will currently take about 60 hours to rebuild the sidechain using nothing but steemd as a source for transactions. This will only get longer over time.

This is complicated by the fact that we run out of memory after 24 hours, if we attempt to leave the node running that long. I believe there's a problem setting both of the following to 100 milliseconds ...

constructor(nodeUrl, currentBlock, antiForkBufferMaxSize = 2, pollingTime = 100) {

.
.
.
this.poller = setTimeout(() => {
this.stream(reject);
}, this.pollingTime);

blockPoller = setTimeout(() => getBlock(reject), 100);

The problem is, if libs/Streamer.js manages to get ahead of plugins/Streamer.js, it will take more and more memory until it runs out.

I agree with the intent of 775f20a to speed up streaming. But making the two equal introduces a complication.

One might think, there's no way they could get ahead of each other because they both wait 100 milliseconds. But if plugins/Streamer.js processing takes even 1 millisecond longer than libs/Streamer.js, libs/Streamer.js will start to retain more and more blocks in its queue, over time.

If we are only 10,000 blocks behind, that's no problem. But if we are 30,000,000 blocks behind, after 24 hours, the node will crash.

I propose that libs/Streamer.js polling time should always be twice as long as plugins/Streamer.js polling time.

Non numeric value in Tables -> balances -> balance

Steem Engine's RPC server returns a non numeric value (ends with carriage return) in the field 'balance' for my account and token 'GEEK':

isNaN( "10000\r" ) returns false in JS, so it must go through parseFloat and then be converted to string on the server side to prevent this.

Issue generating Genesis block

Trying to do a school project and I notice no way generate genesis block into blocks.log other than getting the blocks log file from you. Why can it not by default generate in the file.

Deletion and stacking issue on replay.

When running replay it will stack the data in the data folder if you already have a data folder.

Something should be added to clear the data folder on replay. That or added to the guide to tell people to remove the data folder every time they replay.

Edit: Actually it should cycle through for duplicates and ignore the duplicates and only submit the data for missing blocks.

580905c80d6184d2e8ba78b285cbb31c

Checkpoint Immutability

As a private ssc node operator, I would like to ensure that all block numbers have the same hash on all nodes, so that I can ensure each node has deterministically built the same sidechain (for a given chain-id).

The tender project has a rake task to verify the blockchain and build a list of block numbers and corresponding block hashes. An example of this can be seen here:

https://steem-engine.rocks/checkpoints

image

The checkpoints in the above screen capture were built on a private node running b4885fd.

However, when checking if these checkpoints match against another node, they do not always match. In this example, they match block zero, but after block 10000, they no longer match.

When running this check on a block-by-block granularity, checkpoints diverge at block 4999 where my private node has trx_id 1c57afb2574791e5564c2394b7532cb7d8730a7e but the public node has trx_id 1c57afb2574791e5564c2394b7532cb7d8730a7e-0.

AC

  • All checkpoints match when comparing between different nodes on the same chain-id.

Contract Action for Enabling Deploy/Edit

As a token issuer that has the ability to deploy/edit contracts, I would like SSC to reject deploy/edit attempts unless I have also provided a custom_json that unlocks this ability, so that if my posting key is compromised, my contracts cannot be vanalized.

History

When steemd introduced unlimited comment edit, the blockchain engineers considered adding a way to enable this feature for accounts that broadcasted a special op to enable edits, signed by the active key (see: steemit/steem#1017). This idea was later dropped.

In HF18, the witness plugin had a custom operation called enable_content_editing that allowed a user to signal they want to edit their content. By consensus, content was editable indefinitely, but was soft forked to be frozen after payout. This operation required an active key and was designed to prevent vandalism if a posting key was compromised.

Today

Now, we have SSC with the ability to deploy/edit contracts using the posting key. I believe some kind of lock/unlock action would be useful to allow token issuers to secure their contracts.

The token issuer could broadcast the custom_json using the active key with a timestamp to indicate 10 minutes in the future, 3 days in the future, or whatever time makes sense for contract deploy. After that, contracts are locked until another custom_json using the active key unlocks it for later deploy/edits.

Urgency

In my opinion, the urgency is low for the moment, because Steem Engine does not support general contract deployment. As long as Steem Engine properly secures their posting key, there's no danger in contract vandalism.

But in the future, when an SSC product like Steem Engine does open up general contract deployment, I believe a solution like this should be in place.

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.