-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bounty] Multichain Integration #17
Comments
Note that this bounty would be to finish the remaining milestones and undergo the PR process to the Multichain repo. The 'end' of the bounty is when Harmony is integrated with Multichain. |
Issue Status: 1. Open 2. Started 3. Submitted 4. Done This issue now has a funding of 25164.7447 ONE (4970.34 USD @ $0.2/ONE) attached to it.
|
Hi, I have a submission here - https://github.com/harjas27/multichain/tree/bounty-17 |
thanks @harjas27 can you make a PR to upstream repo? https://github.com/harmony-one/multichain |
@gupadhyaya opened a PR here harmony-one/multichain#3. Please review |
thanks @harjas27 for your PR. as per the bounty requirement, can you also pull all harmony commits (yours and previous developers) and make a PR to upstream? https://github.com/renproject/multichain |
Multichain integration Spec
Estimated Time
1-2 Weeks (+ PR Review time from Ren)
Rewards
TBD
Overview
Multichain is a collection of functions, types, interfaces, and runtimes that can be implemented for any blockchain. Those familiar with the Rosetta spec by Coinbase will note similarities in goals. However, multichain's scope is limited to accounts, contract calls, and sending transactions — there is no block data extraction. Moreover, the chain (Harmony) would have to implement the appropriate functions to Ren's multichain repo as a pull request and undergo their review. The Ren Project notes that once Harmony has integrated with the multichain API, we have the possibility for support in the RenVM.
Context
To help bridge the gap between Harmony and other chains, we must explore ways to integrate with chain agnostic interfaces. Having an API that is standard across multiple chains (notably BTC & ETH) will help reduce the friction of getting assets onto Harmony. This document will provide a high level (but technical) overview of the components needed to integrate with Multichain.
Goals & Non-Goals
What APIs would be available:
What extra components are needed:
What will NOT be built:
Implementation Overview
As a reference, we can follow this guide.
Note that we should only rely on imports from the core protocol repo as the go-SDK is subject to change soon.
Communicating with the Harmony network
We will use JSON-RPC 2.0 to communicate with a Harmony node.
We can choose to implement our own requester, or we can re-use solana's RPC requester here as they also use JSON-RPC 2.0.
We will be integrating with 1 shard ONLY (defined as the
target-shard
). This reduces the complexity of transaction functionalities and should be sufficient for the goals of multichain.Docker file for Testing
Multichain requires a docker file to run a node for a chain's test. All docker files will get placed here and get triggered from here.
We do not have any easy way to run a localnet like ganache, therefore we will just replicate the debug localnet (from here) using the latest stable binary within a docker image (exposing the
target-shard
's explorer port) to provide a node for tests. Some of the leg work has been done here & here, however, some integration needs to be done to fit the necessary functionality.Address API
The interface to implement is
EncoderDecoder
, which consists of theEncoder
andDecoder
interfaces.Note that we should use the Bech-32 addresses (a string) cast as
Address
and the byte representation of the Bech-32 addresses cast asRawAddress
. This way, we should not have to redefine/reimplement theAddress
andRawAddress
types & methods. The alternative is to just use the already implemented ETH addresses here and re-export theAddress
.Since we are using the Bech-32 addresses, it should be easy to create a simple address Encoder & Decoder. If we use the built-in ETH address, we do not have to implement a decoder/encoder — all we have to do is re-export it (similar to what Celo has done here).
Account API
The interfaces to implement are:
Tx
,TxBuilder
, andClient
.Note that for signing transactions, we are always in post EIP115 epoch, therefore we must always use the EIP115 signer found here.
For the
Tx
interface, theHash
,From
,To
,Value
,Nonce
, andPayload
methods should be easy to implement with a wrapper around the HarmonyTransaction
object. TheSighashes
method's content can be found here. TheSign
method's implementation can be found here & here. Lastly, theSerialize
method is simply the RLP encoding to bytes to be submitted to the mem pool (example here).For the
TxBuilder
interface, we only have to implement theBuildTx
method. Note that we must include the Chain ID for the EIP115 signer; this can be fetched from the node's metadata within theBuildTx
method. We may also want to include an additional method forTxBuilder
to fetch the appropriate nonce for theBuildTx
param.For the
Client
interface, theTx
method is simply agetTransactionByHash
RPC call. TheSubmitTx
method is not clear as to if it should block until confirmation of tx or not. Since most APIs do not block on the submission of a transaction, we should implement it as such.Contract API
The interface to implement is
Caller
. The only method to implement isCallContract
. Note that theCallData
could be a byte or marshaled version of the call data struct used by thecall
RPC.Gas API
The interface to implement is
Estimator
. The only method to implement isEstimateGasPrice
. Note that we currently do not have a way to estimate the gas price. We can either hard code some value in multichain (citing 5sec block time as an excuse), or we can implement an RPC to get the average gas price in the mem-pool and call that as part of theEstimateGasPrice
method.Final Touchups
Add
ONE
as a supported asset here & ensure tests pass for ALL supported chains.Milestones
Current Scoping & Timeline
Reward
$10,000 equivalent of ONE tokens.
The text was updated successfully, but these errors were encountered: