GithubHelp home page GithubHelp logo

swswsw / predictionmkt Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 2.0 6.52 MB

prediction market on lotionjs with tendermint

License: MIT License

JavaScript 8.09% CSS 80.19% HTML 11.73%
blockchain tendermint lotionjs cosmos prediction-market

predictionmkt's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

predictionmkt's Issues

specify balances in state in big number string so it can handle larger amount

balances in state is currently a js number. it has limitation on how large the number can be.
we cannot store js BigNumber in state, doing so cause various problems.
so we should store the number as string in the state.
everytime we use it, we should remember to convert it to bignumber.
evertime we store balance in state, we should remember to convert it to string representation.

allow user to use string to specify amount in input so big number can be used.

eg.

curl -X POST http://localhost:3000/txs -d '{"type": "bet", "marketId": "market2", "outcome": 1, "amount": 10, "user": "5wvwWgKP3Qfw1akQoXWg4NtKmzx5v4dTj"}'

change the amount to string.

curl -X POST http://localhost:3000/txs -d '{"type": "bet", "marketId": "market2", "outcome": 1, "amount": "2000000000000", "user": "5wvwWgKP3Qfw1akQoXWg4NtKmzx5v4dTj"}'

everytime we read the amount, we should use
let amount = new BigNumber(inputAmount);
to make sure we convert it to bignumber.

enforce minimum challenge amount

there should be a minimum staking amount for challenge. if the challenge staking amount is lower than that, the challege is ignored

signature scheme for tx

to make sure the tx is coming from the user with the valid authority for the action (eg. he can only move his own fund), the system will require the user to provide the signature.

the tx will have this kind of scheme:
{"type": "bet", "amount": 10}
the signature will sign the entire thing + seq.
seq is sequence number. it must be increasing. the system will not accept the same sequence number or a lower sequence number, so the old tx cannot be replayed.

think of a way to allow the result to be used as oracle for other chains

it might be possible for one chain to act as oracle for the main chain.
so we should think of a way to allow main chain to use the prediction market result as oracle.
perhaps make the result into a token so that it can be transferred to main chain. token can be transferred on cosmos across chain. so perhaps we can use tokenized result as a way to use prediction market result from this chain.

should the people who run full node be rewarded?

some bitcoin people are worried that people are not going to run full node as there is no incentive to run full node.

zencash seems to make rewarding node works. zencash has a masternode system where the masternode gets paid. you need to stake certain amount of tokens to run masternode, but masternode get paid.
zencash has ~8000 nodes, compared to bitcoin's 11000 nodes.

sanitize inputs (limit size, range, etc)

we need to limit the input size, range, etc.

eg. if there is a string, we need to give string length range
eg. if it is a number, we need to check for valid range

add sequence to prevent replay attack

add sequence to the tx.
record the sequence in the state (perhaps with the balance). whenever a valid tx is made, sequence is incremented. a valid tx will need to match the current sequence number in the state.

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.