
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Ethcalate creates containerized state channels for dapps. This repository contains the client-side code for installing and using Ethcalate services within your decentralized application.
This repository is designed to be used in conjunction with the Ethcalate Hub and pre-deployed contracts.
This package is designed for use within a dapp. The package relies on an injected Web3 object from the browser (i.e. MetaMask, which is how the package was developed and tested).
Most functions in this package return Promises. The preferred way to consume the package is to use async/await syntax.
// React App.js
async componentDidMount () {
try {
const ethcalate = new Ethcalate()
await ethcalate.initContract()
const myChannels = await ethcalate.getMyChannels()
} catch (e) {
console.log(e)
}
}
To get started, you can clone this repository or download the Ethcalate package via npm.
npm install ethcalate --save
The client is instantiated to talk to the deployed contract and Hub. The constructor takes one parameter, a web3 instance.
const Ethcalate = require('ethcalate')
const ethcalate = new Ethcalate(web3)
This function creates a new bidirectional payment channel between the msg.sender (taken implicitly), and the to address provided. The depositInEth specifies the stake in ETH the sender is willing to put up for the channel, and challenge is the length of the challenge period in seconds.
Note: This is an on-chain transaction, so there will be a transaction confirmation and gas fee.
const to = '0x627306090abab3a6e1400e9345bc60c78a8bef57'
const depositInEth = 1
const challenge = 3600 // 1 hour
await ethcalate.openChannel({ to, depositInEth, challenge })
// MetaMask will pop up to confirm transaction
Joins a channel that has been opened with your address as the counterparty address.
Note: This is an on-chain transaction, so there will be a transaction confirmation and gas fee.
const channelId = '0xeb9222432938ac4150ea9c08ccb4ba76b5638b5f27627ae1867305f15050a64f'
const depositInEth = 1
await ethcalate.joinChannel({ channelId, depositInEth })
// MetaMask will pop up to confirm transaction
Create a signed state update that the counterparty can use to close the channel. balanceA and balanceB are the updated balances of each party in the channel. Balances must be provided in Wei units using the web3.toWei() function.
Note: This is an off-chain transcation so there are NO transaction fees or gas. Hooray!
const channelId = '0xeb9222432938ac4150ea9c08ccb4ba76b5638b5f27627ae1867305f15050a64f'
const balanceA = web3.toWei(0.5, 'ether')
const balanceB = web3.toWei(1.5, 'ether')
await ethcalate.updateState({ channelId, balanceA, balanceB })
// MetaMask will pop up to sign message with your private key, but not send anything to the blockchain
Takes the last countersigned state update, signs it with your private key, and sends it to the blockchain to move the channel to a challenge period.
Note: This is an on-chain transaction, so there will be a transaction confirmation and gas fee.
const channelId = '0xeb9222432938ac4150ea9c08ccb4ba76b5638b5f27627ae1867305f15050a64f'
await ethcalate.startChallengePeriod(channelId)
// MetaMask will pop up twice, first to confirm signature, and second to confirm transaction
Closes channel if the challenge period is over.
Note: This is an on-chain transaction, so there will be a transaction confirmation and gas fee.
const channelId = '0xeb9222432938ac4150ea9c08ccb4ba76b5638b5f27627ae1867305f15050a64f'
await ethcalate.closeChannel(channelId)
// MetaMask will pop up to confirm transaction
Returns all of the channels associated with the msg.sender.
const myChannels = await ethcalate.getMyChannels()
console.log('myChannels: ', myChannels)
Returns the channel details of the channel that exists between the provided agentA and agentB addresses.
const channel = await ethcalate.getChannelByAddresses(
'0xf17f52151ebef6c7334fad080c5704d77216b732',
'0x627306090abab3a6e1400e9345bc60c78a8bef57'
)
console.log('channel: ', channel)
Returns a channel given an ID.
const channel = await ethcalate.getChannel('0xeb9222432938ac4150ea9c08ccb4ba76b5638b5f27627ae1867305f15050a64f')
console.log('channel: ', channel)
We welcome any contributions and feedback to our code!
To make a contribution, please first open a github issue with a description of the changes that need to be made. Then, submit a pull request referencing the issue.
All pull requests must be based off the master branch.
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
Containerized state channels
We found that ethcalate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.