コード例 #1
0
ファイル: Program.cs プロジェクト: zsabbasi/BigchainDbDriver
        static void Main(string[] args)
        {
            Ed25519Keypair ed25519Keypair = new Ed25519Keypair();

            var trans  = new Bigchain_Transaction();
            var result = ed25519Keypair.GenerateKeyPair(new byte[32]);
        }
コード例 #2
0
        public void OnSeedInput_GivesKeyPair()
        {
            var expectedPrivKey = "11111111111111111111111111111111";
            var expectedPubKey  = "4zvwRjXUKGfvwnParsHAS3HuSVzV5cA4McphgmoCtajS";
            var seed            = new byte[32];

            var ed25519Keypair = new Ed25519Keypair();

            var key = ed25519Keypair.GenerateKeyPair(seed);

            Assert.AreEqual(expectedPrivKey, key.PrivateKey, "Private key must be same");

            Assert.AreEqual(expectedPubKey, key.PublicKey, "Public key must be same");

            key = ed25519Keypair.GenerateKeyPair();

            Assert.AreNotEqual(expectedPrivKey, key.PrivateKey, "Private key must not be same");

            Assert.AreNotEqual(expectedPubKey, key.PublicKey, "Public Key must not be same");
        }
コード例 #3
0
        public async Task Provided_Input_Should_Make_Transfer_Transaction_And_PostCommit()
        {
            string id = "282137f67ce65e34a9eb13145606d7bf87bdaf9174111d6053002bfc543575c8";

            var generatekp = new Ed25519Keypair();
            var keys       = generatekp.GenerateKeyPair();

            var connection   = new BigchainConnection(bigchainhost);
            var currentBlock = await connection.ListBlocks(id);

            Bigchain_Transaction transaction = new Bigchain_Transaction();
            var metadata = new Metadata
            {
                Error       = null,
                Status      = "A",
                Transaction = null
            };

            currentBlock.Metadata = JObject.FromObject(metadata);


            var unspentOutput = new UnspentOutput {
                Tx          = currentBlock,
                OutputIndex = 0
            };

            var Outputs = transaction.MakeOutput(Asn1ConditionsHelper.MakeEd25519Condition(currentBlock.Outputs[0].PublicKeys[0]));

            var tx = transaction.MakeTransferTransaction(new List <UnspentOutput> {
                unspentOutput
            },
                                                         Outputs,
                                                         metadata
                                                         );
            var signTransaction = new Bigchain_SignTransaction();
            var signedTx        = signTransaction.SignTransaction(tx, new List <string>()
            {
                keys.ExpandedPrivateKey
            });
            var serializedTransaction = JsonUtility.SerializeTransactionIntoCanonicalString(JsonConvert.SerializeObject(signedTx));

            Assert.Pass();
        }
コード例 #4
0
        public Transaction()
        {
            var keypair = new Ed25519Keypair();

            generatedKeyPair = keypair.GenerateKeyPair();
        }