project-bitmark / bitmark

Bitmark Core
The Unlicense
47 stars 32 forks source link

Discussion on OP_PUSHCODE #115

Open melvincarvalho opened 3 years ago

melvincarvalho commented 3 years ago

@akrmn2021 wrote:

But first note that OP_PUSHCODE is my own invention, so that's why you never heard of it. And yes I think this is needed for the next layer of functioning, i.e. creating a reputation system instead of a vanilla chain, though it can even be used to create a highly secure vanilla chain.

This issue is for discussion around OP_PUSHCODE

melvincarvalho commented 3 years ago

From : https://github.com/project-bitmark/bitmark/issues/103

melvincarvalho commented 3 years ago

@akrmn2021 first question is whether OP_RETURN is currently implemented and whether it's 40/80 bytes

Rest of this issue is about understanding different opcodes mainly OP_PUSHCODE or possibly OP_COMMENT

bitmarkcc commented 3 years ago

Yes OP_RETURN works to push data to the blockchain. There is a 40 byte relay limit, meaning i would be considered a non standard transaction if it had more than 40 bytes, so nodes would nt relay those transaction. Nothing is stopping them from accepting them though if a larger chain is found that has them.

Im working on PUSHCODE in my dev branch https://github.com/akrmn2021/bitmark/tree/dev. I need maybe a couple of weeks until it is ready for testing, and we can discuss more about the details.

melvincarvalho commented 3 years ago

@akrmn2021 thanks for the explanation!

I wasnt sure if it was actually working because i got an error in the RPC when I tried, and when I looked in the code, it was unclear there was anything there:

Have a look at this and see what you think: https://github.com/project-bitmark/bitmark/blob/69c16562c80e516d34594a5d6d3f2aaa1d12f58d/src/script.cpp#L618

Feel free to drop some ideas in here on PUSHCODE, it may be a bit early to start coding as we dont intend to add any new op codes right now. But if you prefer to do things that way round, totally your call

bitmarkcc commented 3 years ago

In script.h look at MAX_OP_RETURN_RELAY. That gives the limit.

Yes it should say 'return false' because that's what OP_RETURN does, it makes the script quickly evaluate to false without having the interpreter push people's data onto the stack. The scripts return value is mainly for deciding whether an input (script sig) is valid, normally to check whether you signed the tx with the right private key.

bitmarkcc commented 3 years ago

What RPC command did you use?

As for OP_PUSHCODE, it's just my work and up to the community to decide if they want it. I agree there should be a high bar for any soft forking changes, so it will need more testing and consensus. Also we can make it an optional service that some nodes can provide, until we really want it. It's not a very complex OP code, but it will take more work to make it useable with a CLI and web interface.