diff --git a/Cargo.toml b/Cargo.toml index f3d0681..7beade1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ license = "MIT" base58 = "0.1.0" rand = "0.7.3" -blake2 = "0.8.1" -curve25519-dalek = "2.0.0" -ed25519-dalek = "1.0.0-pre.0" -sha2 = "0.7.1" -sha3 = "0.7.1" \ No newline at end of file +blake2 = "0.7.1" +curve25519-dalek = "1.2.3" +ed25519-dalek = "1.0.0-pre.3" +sha2 = "0.8.0" +sha3 = "0.8.0" \ No newline at end of file diff --git a/src/account.rs b/src/account.rs index 6ad2e4a..8b0d1fd 100644 --- a/src/account.rs +++ b/src/account.rs @@ -1,5 +1,5 @@ -use bytebuffer::Buffer; -use transaction::{Transaction, ProvenTransaction}; +use crate::bytebuffer::Buffer; +use crate::transaction::{Transaction, ProvenTransaction}; use base58::*; use curve25519_dalek::constants; @@ -17,8 +17,8 @@ const ADDRESS_VERSION: u8 = 1; const ADDRESS_LENGTH: usize = 26; const HASH_LENGTH: usize = 32; -pub const MAINNET: u8 = 'W' as u8; -pub const TESTNET: u8 = 'T' as u8; +pub const MAINNET: u8 = 'A' as u8; +pub const TESTNET: u8 = 'K' as u8; pub struct Address([u8; ADDRESS_LENGTH]); @@ -149,7 +149,7 @@ fn sig_verify(message: &[u8], public_key: &[u8; PUBLIC_KEY_LENGTH], signature: & ed_pubkey[31] |= sign; PublicKey::from_bytes(&ed_pubkey).unwrap() - .verify::(message,&Signature::from_bytes(&sig).unwrap()) + .verify(message,&Signature::from_bytes(&sig).unwrap()) .is_ok() } @@ -206,9 +206,9 @@ mod tests { #[test] fn test_private_key_from_seed() { - let PrivateKeyAccount(sk, acc) = PrivateKeyAccount::from_seed("acryl"); - assert_eq!(sk, "4oaS7VtASCY9KrVAabrcgKWDWcZ7dKb13UKE9zFcpWWS".from_base58().unwrap().as_slice()); - assert_eq!(acc.to_bytes(), "2GRyKXShb8aJLAm9qUBzeesfXvvVcEbnmeiioD8fh2UL".from_base58().unwrap().as_slice()); - assert_eq!(acc.to_address(TESTNET).0, "3N9QEKMtfcYDPHgn53TCF9tGkmTwDdq6qxT".from_base58().unwrap().as_slice()); + let PrivateKeyAccount(sk, acc) = PrivateKeyAccount::from_seed("test"); + assert_eq!(sk, "5sJHxDyR79erksKWynMWLjWzWwiTx48HFXyNravvb4iz".from_base58().unwrap().as_slice()); + assert_eq!(acc.to_bytes(), "GoToDxRVGy2zvLQUFTW9bF1sgKUdCB4Go9xUjZpbNh3r".from_base58().unwrap().as_slice()); + assert_eq!(acc.to_address(TESTNET).0, "3JRLk6mzxCdb6o1TXzr6tNrcmyLntG2C731".from_base58().unwrap().as_slice()); } -} +} \ No newline at end of file diff --git a/src/transaction.rs b/src/transaction.rs index a409bd5..df882d4 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -312,7 +312,7 @@ mod tests { let pk = PublicKeyAccount([1u8; 32]); let asset = Asset::new([2u8; 32]); let lease = TransactionId::new([3u8; 32]); - let recipient = Address::from_string("3MzZCGFyuxgC4ZmtKRS7vpJTs75ZXdkbp1K"); + let recipient = Address::from_string("3JD4thvVVmzRRynaYHbdnUpv9QF7b1bFf4Y"); let fee = 100000; let ts: u64 = 1536000000000; @@ -321,24 +321,24 @@ mod tests { } check_hash(&Transaction::new_issue(&pk, "coin", "coin", 100000000, 8, false, TESTNET, 100000, ts), - "GHqHz8xot1Yo7fivjPBYiqgtJNW3jR6bvpNh2WH66tEM"); + "AkgNv2ULydQSFSaxrDj2ufsZmMfd8qD6VGNKsSiPZwxC"); check_hash(&Transaction::new_reissue(&pk, &asset, 100000000, false, TESTNET, fee, ts), - "83WaG6AAzxF3NFormpqrJr9Bi8eSdwyp3DEB67N7avvM"); + "8KC9vS4WswhfccZygjZVHVzsgo8HtuuxmFCAa6BQvmQK"); check_hash(&Transaction::new_burn(&pk, &asset, 100000000, TESTNET, fee, ts), - "CfsAEtEAwe4NFKjezeCssaUPevTX56rBsuMeMKRERd6Y"); + "8kwwFWMKuPbR5bi8sf27dQegifxRNXjVx89URgMjYAjJ"); check_hash( &Transaction::new_transfer(&pk, &recipient, Some(&asset), 10, None, fee, Some("atta ch me"), ts), - "8cJiFqBMXMsp5sPMyoN3vbeGPovfYCe4FFdrsvmCfgp6"); + "4xKPSytfy69czvTJdHH1tcduvkjNP6CY7Zcqpz3mgZPd"); check_hash(&Transaction::new_lease(&pk, &recipient, 10, TESTNET, fee, ts), - "4hb6dvZ1CvNBc3zLKoHMLG98rsM4VhF2qqkFMwnjxGkW"); + "GWz6Wyc7dMbLv6cAHrdMeMYUhq4iNAPiTCnJu9jz2cL8"); check_hash(&Transaction::new_lease_cancel(&pk, &lease, TESTNET, fee, ts), - "9BQLzTCHi9H9jqKeC5rvN7x9m8xfHQh1iApqmAPFTFEU"); + "7KjBpRnNWEWW4gVcQWrMa9k9qydvYCohHR8ZFMJBfkaq"); let alias = Transaction::new_alias(&pk, "lilias", TESTNET, fee, ts); - check_hash(&alias, "GPyHWQSCT6znfZmjfZfsS6TXPV3zueVZKFUWG7duku1Z"); + check_hash(&alias, "FRTvY7Amme8czANsqa7Gj3CM1bM4MtDeFuoLx8JL8bwu"); let transfers = vec![(&recipient, 10), (&recipient, 10)]; check_hash(&Transaction::new_mass_transfer(&pk, Some(&asset), transfers, Some("mass trans"), fee, ts), - "C8yeQ2eNT6FuRkUZVEAxYo1F4qc5bGqjihkJnpDZLZsj"); + "53mKjWQW8iHugRAvUfVpptj4czehfTRfEN1Uw2hxe3JN"); let arr = vec![4u8; 32]; let bin_entry = DataEntry::Binary("bin", &arr); @@ -352,9 +352,9 @@ mod tests { let script = vec![1, 6, 183, 111, 203, 71]; check_hash(&Transaction::new_script(&pk, Some(script.as_slice()), TESTNET, fee, ts), - "HASXvcgoikizpWnCLd2cXNeCN5DxdKojCfcn8f7T3KjK"); + "9hAcaE3yDMMbwXMcZpdANC9YNXPgqK6Exyqd5U9jXhUq"); check_hash(&Transaction::new_script(&pk, None, TESTNET, fee, ts), - "1gwS1qkKKShwk5scB7M7N9t6L3eX2Hpkp9hF5RG8HJD"); + "AphhKVVhyBH2SFYTaSzWbGL7NPHZ1F9RUkFN4uhMZ9QE"); check_hash(&Transaction::new_sponsor(&pk, &asset, Some(100), fee, ts), "9zmHx3fyXz7pW6bRazPP28PGjnM8XjoHuyjzXCMHE2PY"); }