1000 STEEM bounty - need C code to create, sign and submit a multisig transaction locally for iguana atomic swap

in #iguana8 years ago

In iguana, atomic cross chain swaps are supported, but a coin has to support at a minimum a 2of2 multisig to an arbitrarily specified pair of secp256 pubkeys.

https://steemit.com/steem/@xeroc/steem-transaction-signing-in-a-nutshell

the above shows how to sign a transaction, but not specifically for a 2of2 multisig. Iguana has C library for secp256 already, so the actual signing code is already done. dealing with creating a 2of2 multisig account, serializing it properly for signing, submitting to the p2p network are the parts that are needed.

I realize this "spec" is not 100% precise so the first part would be to come up with a clear interface. please respond if you are able to do this

James

Sort:  

the above shows how to sign a transaction, but not specifically for a 2of2 multisig. Iguana has C library for secp256 already, so the actual signing code is already done. dealing with creating a 2of2 multisig account, serializing it properly for signing, submitting to the p2p network are the parts that are needed.

Let me address some of your points:

  • p2p network code is not required. All you need is a public API know
    for instance node.steem.ws. You can broadcast your tx with a few
    simple JSON-formated RPC calls.
  • Creating a multisig account isn't much of a problem if you want to use
    python code. In fact, the piston.steem library already has a call that
    allows you to setup some basic multisig account (see here)
  • Once you have created a multisig account, all you need to do is add
    more signatures
    to your signed transactions. If you have an account
    with two pubkeys as authority, then you need to sign it with the
    corresponding keys (you can do that in distinct steps). If you have
    another account as an authority, you can (AFAIK) sign with any of the
    keys of that account (owner, active, posting). -- Remark: I am not
    sure if a users posting key can actually be used to approve a multisig
    transaction that transfers funds.

unfortunately no python, needs to be C code. iguana is totally self-contained without any external libs and total codesize is 2MB, so everything needs to be in C to not bloat things.

good that can just post the tx to the public node.steem.ws

as far as the multisig goes, it needs to be something that once an account is configured locally (onetime setup) then automatically the multisig addresses need to be created, tx for it to be created, monitored, etc.

the multisig encodes secrets that are released during the atomic swap protocol and it in turn has a secret that it divulges when it is spent. I am assuming that like bitcoin, to spend a multisig the pubkey for it needs to be divulged. if not, some other mechanism is needed

Let's say Alice wants to exchange 10 bitUSD for 10 bitEuro with Bob. They create a new 2 of two multisig account between the two and send their funds to that account. Now they create a proposal that sends 10 bitUSD to Bob and 10 bitEuro to Alice. They both approve the proposal and the funds are exchanged. That's how I would do it (if not use the dex)

I have things setup so atomic swaps can be done between all bitcoin protocol coins, so if I can make the steemit do the arbitrary 2of2 multisig, then it can pretend it is a bitcoin protocol and that would allow atomic swaps of steem (and sbd?) against all the bitcoin compatibles

@void is currently working on transaction signing in C

great! I assume libsecp256k1 will be used for the actual signing?
Do you know the network wire protocol? iguana likes to be at least a passive peer so it can submit the signed transaction directly

Please see my other comment for the network "code".
Afaik @void is usint libsecp256k1 .. if not you can see how the python code is doing it since it calls the native libspec256k1 methods as well (assuming the req. libraries are installed)

wow amazing post you and very good

Which I knew how to code, that would be a nice bounty. But I am just a small fry without that knowledge.

Nice. I didn't know about it. Keep sharing good content @jl777

The bounty sound too good but unfortunately I don't even know what is c code are . Hopefully you will give bounty for twerking :p

A friend of mine pointed me in this direction. I do understand what you're asking but I'm not very well versed in C. I know C++ and a fair amount of C# but that's as close as it gets for me. But I do want to wish you luck, and please keep us updated with any progress.

Coin Marketplace

STEEM 0.20
TRX 0.20
JST 0.034
BTC 89955.66
ETH 3105.10
USDT 1.00
SBD 2.98