标签: blockchain

将属性添加到IBM Bluemix区块链CA(membersrvc.yaml)

我正在研究区块链的概念证明.我正在使用bluemix网络进行区块链和部署我在本地开发的应用程序.我想测试CA功能,并希望向用户添加属性membersrvs.yaml,并执行基于属性的访问控制.但是,当我的网络托管在bluemix上时,我无法找到如何编辑/更新文件.请原谅我,如果这看起来很基本,我仍然对事情有所了解.

ca blockchain hyperledger ibm-cloud

9
推荐指数
1
解决办法
365
查看次数

有没有办法向Metamask钱包发起断开连接请求?

我正在构建一个分散的应用程序,用户可以在其中将他们的加密货币钱包 (Metamask) 连接到我的网站。

They can initiate a connection request by clicking a button. On success, the wallet is connected and my website can interact with it.

Is there any way to initiate a disconnect request? Similar to a 'Log out' button. Currently, the users have to manually disconnect their wallet within Metamask settings which is not a straightforward process.

blockchain ethereum web3js web3-donotuse metamask

9
推荐指数
1
解决办法
843
查看次数

如何从我的合约中提取所有代币

我创建了一个基本合同。但不知道提现功能。

我尝试创建一个基本功能,但它不起作用

function withdraw() public {
    msg.sender.transfer(address(this).balance);
}
Run Code Online (Sandbox Code Playgroud)

blockchain ethereum solidity smartcontracts erc20

9
推荐指数
1
解决办法
3万
查看次数

如何在 Solidity 中连接两个字符串值

连接两个或多个字符串值 -

pragma solidity 0.8.9;

contract StringConcatation{
    function AppendString(string memory a, string memory b) public pure returns (string memory) {
        return string(abi.encodePacked(a,"-",b));
    }
}
Run Code Online (Sandbox Code Playgroud)

blockchain ethereum solidity

9
推荐指数
1
解决办法
6153
查看次数

在 Solana Anchor 框架内初始化 PDA 的正确方法

我正在尝试使用 Rust/Anchor 编写一个简单的 Solana 程序,该程序使用 PDA,但当我尝试调用它时,我收到 CPI 错误,即使没有发生 CPI(可能是 PDA 帐户初始化?)。

这是程序代码:

use anchor_lang::prelude::*;

declare_id!("51v31qHaEQniLoYuvvtXByZcfiyvog3R2EKC39EPD52p");

#[program]
pub mod solana_sandbox {
  use super::*;
  pub fn initialize(ctx: Context<Initialize>, bump: u8) -> ProgramResult {
    ctx.accounts.sandbox_account.bump = bump;
    Ok(())
  }
}

#[derive(Accounts)]
#[instruction(bump: u8)]
pub struct Initialize<'info> {
  #[account(mut)]
  pub signer: Signer<'info>,
  #[account(
    init,
    seeds = [b"seed".as_ref()],
    bump,
    payer = signer,
  )]
  pub sandbox_account: Account<'info, SandboxAccount>,
  pub system_program: Program<'info, System>,
}

#[account]
#[derive(Default)]
pub struct SandboxAccount {
  pub bump: u8,
}
Run Code Online (Sandbox Code Playgroud)

这是客户端代码:

  const [sandboxPda, …
Run Code Online (Sandbox Code Playgroud)

anchor rust typescript blockchain solana

9
推荐指数
1
解决办法
4002
查看次数

发送交易时如何准确地将ETH转换为WEI?

我正在尝试从一个帐户发送到另一个帐户,但从到 的ETH转换一直让我头疼。在这种情况下,我尝试发送,但在确认窗口中,我收到了。ETHWEI0.11 ETH313.59464925 ETH

// This is my transaction code

await window.ethereum
  .request({
    method: "eth_sendTransaction",
    params: [
        {
          from: window.ethereum.selectedAddress,
          to: "0x4dxxxxxxxxxxxxxxxxxx2dr9820C",
          value: String(0.11 * 1000000000000000000), // convert to WEI
          },
        ],
      })
  .then((result) => console.log(result))
  .catch((error) => console.log(error));
Run Code Online (Sandbox Code Playgroud)

我也尝试过使用BigNumber但它不能解决问题,我想我把事情搞砸了。如何准确转换ETHWEI

blockchain ethereum metamask

9
推荐指数
3
解决办法
2万
查看次数

Solana 空投错误,需要帮助来解决我的问题

当我在命令提示符中键入以下内容时:

solana airdrop 2 -k ./Wallet/.config/solana/Seller.json
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

Requesting airdrop of 2 SOL
Error: airdrop request failed. This can happen when the rate limit is reached.
Run Code Online (Sandbox Code Playgroud)

我能做些什么?

blockchain smartcontracts solana solana-cli

9
推荐指数
2
解决办法
7619
查看次数

以太坊创世纪封锁私人网络

我想在私人网络上挖掘.

如何在边境以太坊中为私人网络创建一个创世块?

我已经看到:https://blog.ethereum.org/2015/07/27/final-steps/但这是为了获取公共Genesis块.

encryption cryptography blockchain ethereum

8
推荐指数
2
解决办法
2483
查看次数

hyperledger fabric在哪里存储区块链的数据库?

我在本地计算机上使用单个验证节点进行了超级分层结构网络设置.我正在开发一个链码,想清除我的区块链.我已经读过hyperledger结构将数据库存储在/ var/hyperledger下.但是,我没有在/ var下看到这个hyperledger目录.这个目录还有其他位置吗?我的开发平台是MAC,我使用docker-compose来启动我的超级结构网络.

blockchain hyperledger hyperledger-fabric

8
推荐指数
1
解决办法
4429
查看次数

如何通过nodejs观察区块链上的比特币交易?

我正在使用这个bitcore npm包. https://bitcore.io/api/lib

我想监视区块链上的所有事务,并读取与该事务关联的输入地址,输出地址和数量.

但我无法找到要调用的javascript方法来完成此任务.即使我无法找到这方面的例子.

我正在寻找类似的东西

var someLib = require('some-bitcore-lib')

someLib.on('transaction-found', function(){
   // print everything
   console.log(arguments);
   // do something else;
})
Run Code Online (Sandbox Code Playgroud)

有帮助吗?我在哪里可以找到some-bitcore-lib或如何在nodejs中创建它?

node.js bitcoin blockchain

8
推荐指数
2
解决办法
2383
查看次数