Skip to content

taubyte/orbit-eth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

orbit-eth

A standalone Taubyte vm-orbit satellite that exposes the Ethereum host functions to the Taubyte VM. It is a faithful port of tau's in-tree low-orbit ethereum plugin (pkg/vm-low-orbit/ethereum).

Each client dials an Ethereum JSON-RPC endpoint — the guest passes the RPC URL to ethNew — through go-ethereum's ethclient/rpc. The client / contract / transaction / block registry model and locking are preserved exactly, so guest wasm modules see the same "ethereum" module with the same functions and identical ABI semantics as the in-tree plugin.

Where the in-tree plugin embeds tau's helpers.Methods over core/vm.Module, this satellite reimplements the memory bridges it needs against github.com/taubyte/tau/pkg/vm-orbit/satellite.Module (MemoryRead/MemoryWrite/ReadUint32/WriteUint32/...), keeping the same github.com/taubyte/go-sdk/errno codes.

Exported host functions

Registered under the wasm module ethereum. Each satellite method is named W_<Name>; the W_ prefix is stripped when the method is exported to the guest as <Name>.

Client: ethNew, ethCloseClient Chain: ethCurrentChainId, ethCurrentChainIdSize Block: ethBlockByNumber, ethCurrentBlockNumber, ethBlockNumberFromId, ethBlockNumberFromIdSize Contract: ethDeployContract, ethNewContract, ethNewContractSize Contract method: ethGetContractMethod, ethGetContractMethodSize, ethTransactContract, ethCallContract, ethCallContractSize Contract event: ethSubscribeContractEvent (see below) ECDSA: ethPubKeyFromSignedMessage, ethHexToECDSA, ethPubFromPriv Sign: ethSignMessage, ethVerifySignature Transaction: ethGetTransactionFromBlockByHash, ethGetTransactionsFromBlock, ethGetTransactionsFromBlockSize, ethGetTransactionMethodBytes, ethGetTransactionMethodSize, ethGetTransactionMethodUint64, ethTransactionRawSignatures, ethTransactionRawSignaturesSize, ethSendTransaction, ethJson, ethJsonSize

ethSubscribeContractEvent is unsupported in satellite mode

In the in-tree plugin, ethSubscribeContractEvent watches an ABI event and bridges each matching log to a delivery channel (http://, pubsub://, p2p://) using tau's substrate pubsub/p2p services and the executing function's VM context. A standalone satellite is a separate process with no handle to tau's messaging substrate or the guest's VM context, so it cannot deliver events. The export is kept (same signature, unchanged ABI) but returns errno.ErrorSubscribeFailed. Event delivery must stay with the in-tree plugin.

Backend

ethNew dials the given URL and wraps the connection in a Backend — the slice of an eth node the satellite uses: bind.ContractBackend plus BlockByNumber/BlockNumber/ChainID. *ethclient.Client satisfies it. NewBackend is a package var so tests can inject an in-memory backend instead of a live RPC endpoint.

Build & run

go build ./...

The produced binary is a hashicorp/go-plugin server. It is launched by the Taubyte VM as a vm-orbit satellite plugin rather than run directly.

About

Taubyte VM-orbit satellite exposing Ethereum host functions, dialing an eth RPC via ethclient

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages