
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@statechannels/nitro-protocol
Advanced tools
Smart contracts and typescript libraries for nitro state channel protocol.
Smart contracts which implement nitro protocol for state channel networks on Ethereum, Filecoin and other EVM-compatible chains. Includes javascript and typescript support.
:new: There is an accompanying documentation website.
.../my-statechannel-app> npm install --save @statechannels/nitro-protocol
Please see this section of our docs.
const {NitroAdjudicatorArtifact, ConsensusAppArtifact, VirtualPaymentAppArtifact} =
require('@statechannels/nitro-protocol').ContractArtifacts;
import {State} from '@statechannels/nitro-protocol';
const state: State = {
channelNonce: 0,
participants: ['0xalice...', '0xbob...'],
appDefinition: '0xabc...',
challengeDuration: '0x258',
outcome: [],
appData: '0x',
turnNum: 0,
isFinal: false,
};
For more information see this section of our docs
import {getChannelId, getFixedPart} from '@statechannels/nitro-protocol';
const channelId = getChannelId(getFixedPart(state));
We use hardhat to develop smart contracts. You can run the solidity compiler in watch mode like this:
npx hardhat watch compilation
After successfully deploying you should see some changes to addresses.json
. Please raise a pull request with this updated file.
INFURA_TOKEN=[your token here] RINKEBY_DEPLOYER_PK=[private key used for rinkeby deploy] yarn contract:deploy-goerli
WARNING: This can be expensive. Each contract will take several million gas to deploy. Choose your moment and gas price wisely!
INFURA_TOKEN=[your token here] MAINNET_DEPLOYER_PK=[private key used for mainnet deploy] yarn contract:deploy-mainnet --gasprice [your-chosen-gasPrice-here]
Contract deployment is handled automatically by our test setup scripts. Note that a different set of contracts is deployed when testing. Those contracts expose some helper functions that should not exist on production contracts.
This is a somewhat manual process, but easier than using the etherscan GUI.
After deployment, run
ETHERSCAN_API_KEY=<a-secret> INFURA_TOKEN=<another-secret> yarn hardhat --network rinkeby verify <DeployedContractAddress> 'ConstructorArgs'
for each contract you wish to verify. Swap rinkeby for mainnet as appropriate!
You need to provide both ETHERSCAN_API_KEY
and INFURA_TOKEN
for this to work. For more info, see the docs.
CALIBRATION_DEPLOYER_PK="<deploy_priv_key>" npx hardhat deploy --tags deploy-fvm --network calibration
npx hardhat starboard-verify NitroAdjudicator <nitro_adjudicator_address>
Starboard is a Filecoin blockchain explorer. The above command utilizes a hardhat
plugin called starboard-verify
to verify the contract on that explorer.
FAQs
Smart contracts and typescript libraries for nitro state channel protocol.
The npm package @statechannels/nitro-protocol receives a total of 0 weekly downloads. As such, @statechannels/nitro-protocol popularity was classified as not popular.
We found that @statechannels/nitro-protocol demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.